SignalCooldown

Moved

Total Downloads: 339 - First Release: Apr 18, 2018 - Last Update: Apr 20, 2018

5/5, 4 likes
  1. Vliek [NL] submitted a new resource:

    SignalCooldown - Limits the amount of signals to be dropped to X supply signals every X seconds

    Read more about this resource...
     
  2. Vliek [NL] updated SignalCooldown with a new update entry:

    1.0.1

     
  3. Works great Thank you so much!!!
     
  4. Only works with left click, does not block right click throwing.

    Fixed it by adding

    Code:
    private void OnExplosiveDropped(BasePlayer player, BaseEntity entity)
            {
                if (entity.ShortPrefabName != "grenade.smoke.deployed")
                    return;
                if (!permission.UserHasPermission(player.UserIDString, cooldownPerm))
                {
                    if (signalCooldown.Contains(player.userID))
                    {
                        float difference = (lastRun[player.userID] + timeCooldown) - UnityEngine.Time.time;
                        float finaldifference = Mathf.Round(difference);
                        entity.Kill();
                        Player.Message(player, GetLang("cooldownActive", player.UserIDString), null, messageIcon, finaldifference);
                        if (refundSignal)
                        {
                            Item item = ItemManager.CreateByName("supply.signal", 1);
                            if (item != null)
                            {
                                player.inventory.GiveItem(item, player.inventory.containerBelt);
                            }
                        }
                        return;
                    }                signalCooldown.Add(player.userID);
                    lastRun.Add(player.userID, UnityEngine.Time.time);
                    timer.Once(timeCooldown, () =>
                    {
                        signalCooldown.Remove(player.userID);
                        lastRun.Remove(player.userID);
                        Player.Message(player, GetLang("cooldownOver", player.UserIDString), null, messageIcon);
                    });
                    Puts("Signal cooldown started on " + player.displayName);
                    return;
                }
                return;
            }
    after : private void OnExplosiveThrown(BasePlayer player, BaseEntity entity)

    Not sure if this is good but it works (I don't know what i'm doing)
     
    Last edited by a moderator: Apr 20, 2018
  5. It will be easier and cleaner to redirect OnExplosiveDropped to OnExplosiveThrown, I'll post an update soon :) Thank you!
     
  6. Alright ! :)
     
  7. Vliek [NL] updated SignalCooldown with a new update entry:

    1.0.2

     
  8. Is there a way to add a count within 'x' time? This way someone can throw 3 signals within 5 minutes, but then makes them wait 5 minutes to throw that 4th?
     
  9. Code:
    Failed to run a 300.00 timer in 'SignalCooldown v1.0.2' (NullReferenceException: Object reference not set to an instance of an object)
      at BasePlayer.SendConsoleCommand (System.String command, System.Object[] obj) [0x00000] in :0
      at Oxide.Game.Rust.Libraries.Player.Message (BasePlayer player, System.String message, System.String prefix, System.UInt64 userId, System.Object[] args) [0x00038] in :0
      at Oxide.Plugins.SignalCooldown+c__AnonStorey0.<>m__0 () [0x00064] in :0
      at Oxide.Core.Libraries.Timer+TimerInstance.FireCallback () [0x00018] in :0