Dear forum users! In compliance with the new European GDPR regulations, we'd just like to inform you that if you have an account, your email address is stored in our database. We do not share your information with third parties, and your email address and password are encrypted for security reasons.

New to the forum? Say hello in this topic! Also make sure to read the rules.

[REQUEST] No Hardscoping (Script)

Custom scripts
Forum rules
By using the forum you agree to the following rules.
Post Reply
User avatar
Mighty Spirit the 2
Superfighter
Superfighter
Posts: 187
Joined: Mon Jun 25, 2018 5:02 pm
Title: Wasted potential
SFD Account: ake004
SFD Alias: Retired SFD player
Started SFD: When melee was good
Location: SFD Veteran trauma hospital
Gender:
Age: 22

[REQUEST] No Hardscoping (Script)

Post by Mighty Spirit the 2 » Thu Apr 01, 2021 6:28 pm

I'm sure some people have seen this script before. It's a simple Script used for Crates, when aiming for more then a certain amount of time, the scope resets. This is a script i have looked for everywhere and it seems to have vanished (Not on workshop or SFDmaps)
I already asked Sree, the creator, but he no longer has it. I would appreciate it if someone had it tucked away on some dusty external drive somewhere. I need it for hosting competitive Crates.
0 x
🎶I will tell your story if you die
I will tell your story and keep you alive the best i can
...
But I've always had the feeling we would die young
Some die young
🎵
https://i.imgur.com/D479VLi.png

User avatar
Mighty Spirit the 2
Superfighter
Superfighter
Posts: 187
Joined: Mon Jun 25, 2018 5:02 pm
Title: Wasted potential
SFD Account: ake004
SFD Alias: Retired SFD player
Started SFD: When melee was good
Location: SFD Veteran trauma hospital
Gender:
Age: 22

Post by Mighty Spirit the 2 » Sat Aug 20, 2022 10:07 pm

Yeah, so i decided to just post this on here anyway, in-case someone ever comes looking for this, because you are tired of hardscopes presumably.
Script was originally made by Sree, but he deleted it. Re-uploaded the original txt from "Crates - Comp" map by Sree.
If you know what your doing you could replace timer trigger with Events.UpdateCallback.Start().
Interesting script i have to say. Sad to see comp Crates was ushered away.

Code: Select all

public void OnStartup() //script by Sree!
 {
  Game.RunCommand("/ia 1");
  Game.RunCommand("/ie 1");
  Game.RunCommand("/msg welcome to crates comp by Sree!");

  foreach(IPlayer tplayer in Game.GetPlayers())
  {
   tplayer.GiveWeaponItem(WeaponItem.SNIPER);
   tplayer.GiveWeaponItem(WeaponItem.MACHETE);
   tplayer.GiveWeaponItem(WeaponItem.MAGNUM);
  }

  IObjectTimerTrigger exttimer = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger");
  exttimer.SetIntervalTime(1);
  exttimer.SetRepeatCount(0); // infinite times
  exttimer.SetScriptMethod("CheckManualAimers");
  exttimer.Trigger();
 }

public void CheckManualAimers(TriggerArgs args)	
 {
  foreach (IPlayer tplayer in Game.GetPlayers())
    {
     if (!tplayer.IsDead) 
      {
        Playertimer timer = GetPlayertimer(tplayer);
        timer.Update();
      }
    }
 }

 private Dictionary<int, Playertimer> timer = new Dictionary<int, Playertimer>();

 private Playertimer GetPlayertimer(IPlayer tplayer)
   {
    Playertimer playertimer = null;
    if (!timer.TryGetValue(tplayer.UniqueID, out playertimer))
      {
       playertimer = new Playertimer(tplayer);
       timer.Add(tplayer.UniqueID, playertimer);
      }
       return playertimer;
    }

 private class Playertimer
   {
      private const float timerestricted = 1000f;
      private float timeelapsed = 0f;
      private IPlayer tplayer;

 public Playertimer(IPlayer player)
   {
      tplayer = player;
      timeelapsed = Game.TotalElapsedGameTime;
   }

 public void RemoveWep()
   {
    if (!tplayer.IsDead)
     {
      tplayer.RemoveWeaponItemType(WeaponItemType.Rifle);
      tplayer.RemoveWeaponItemType(WeaponItemType.Handgun);
      tplayer.GiveWeaponItem(WeaponItem.SNIPER);
      tplayer.GiveWeaponItem(WeaponItem.MAGNUM);
      Game.PlayEffect("CFTXT",tplayer.GetWorldPosition() + new Vector2(0,4),"no hardscoping scrub");
     }
   }

  public void Update()
   {
    if (tplayer.IsManualAiming)
     {
      if (Game.TotalElapsedGameTime - timeelapsed > timerestricted)
        {
         RemoveWep();
         timeelapsed = Game.TotalElapsedGameTime;
        }
     }
      else
        {
         timeelapsed = Game.TotalElapsedGameTime;
        }
     }
}




1 x
🎶I will tell your story if you die
I will tell your story and keep you alive the best i can
...
But I've always had the feeling we would die young
Some die young
🎵
https://i.imgur.com/D479VLi.png

Post Reply