1. Code:
            [ChatCommand("test")]
            private void TestCommand(BasePlayer player, string command, string[] args)
                {
                    if (!Cooldowns.Contains(player.userID))
                    {
                        Cooldowns.Add(player.userID);
                        timer.Once(30, () => Cooldowns.Remove(player.userID));
                        PrintToChat(player, "Loot fast! You will be teleported to town in 30 seconds!");
                    }
                    if (!Cooldowns.Remove(player.userID))
                    {
                        string tptown = "teleport.topos {0} -279 75 -310";
                        player.SendConsoleCommand(string.Format(tptown, player.displayName));
                    }
                }
    Hello. I have small problem, beacuse i am not good at C# :p How to make command which is called 30 seconds after the other? :(
     
  2. Update. @hoppel just help me and it works, but i have another problem. How to initlialize this command when player kills NPC? This code don't send errors and not working :(
    Code:
    using Oxide.Core;
    using System.Collections.Generic;namespace Oxide.Plugins
    {
        [Info("Execute", "ThePitereq", "1.0.2")]
        class Execute : RustPlugin
        {
            HashSet<ulong> Cooldowns = new HashSet<ulong>();
            #region Commands
            private void OnKillNPC(BasePlayer npc, BasePlayer player)
            {
                if (!Cooldowns.Contains(player.userID))
                {
                    Cooldowns.Add(player.userID);
                    timer.Once(30, () =>
                    {
                        Cooldowns.Remove(player.userID);
                        string tptown = "teleport.topos {0} -279 75 -310";
                        player.SendConsoleCommand(string.Format(tptown, player.displayName));
                    });
                    PrintToChat(player, "PL: Gratulacje! Zbieraj loot szybko! Za <color=#008215>60 sekund</color> zostaniesz przeteleportowany do <color=#008215>towna</color>! \nEN: Congratulations! Loot fast! You will be teleported to <color=#008215>town</color> in <color=#008215>60 seconds</color>!");
                }
            }
            #endregion
        }
    }
    
     
  3. OnKillNPC is not correct Event. Use OnEntityDeath :


    Code:
    using System.Collections.Generic;namespace Oxide.Plugins
    {
        [Info("Execute", "ThePitereq", "1.0.2")]
        class Execute : RustPlugin
        {
            HashSet<ulong> Cooldowns = new HashSet<ulong>();        #region Hooks        private void OnEntityDeath(BaseCombatEntity entity, HitInfo hitInfo)
            {
                var npc = entity as BaseNpc;
                var player = hitInfo.Initiator as BasePlayer;
                if (null != npc && null != player)
                {
                    OnKillNPC(npc, player);
                }
            }
            #endregion        #region Commands
            private void OnKillNPC(BaseNpc npc, BasePlayer player)
            {
                if (!Cooldowns.Contains(player.userID))
                {
                    Cooldowns.Add(player.userID);
                    timer.Once(30, () =>
                    {
                        Cooldowns.Remove(player.userID);
                        string tptown = "teleport.topos {0} -279 75 -310";
                        player.SendConsoleCommand(string.Format(tptown, player.displayName));
                    });
                    PrintToChat(player, "PL: Gratulacje! Zbieraj loot szybko! Za <color=#008215>60 sekund</color> zostaniesz przeteleportowany do <color=#008215>towna</color>! \nEN: Congratulations! Loot fast! You will be teleported to <color=#008215>town</color> in <color=#008215>60 seconds</color>!");
                }
            }
            #endregion
        }
    }
    
     
  4. Thanks, but still not working :( after killing npc, nothing happens :(
     
  5. After killing Scientist i have that error:
    Code:
    Failed to call hook 'OnEntityDeath' on plugin 'Execute v1.0.4' (NullReferenceException: Object reference not set to an instance of an object)
      at Oxide.Plugins.Execute.OnEntityDeath (BaseCombatEntity entity, HitInfo hitInfo) [0x00007] in <7055eabc1c4d479bae6fe14cbb288dd8>:0
      at Oxide.Plugins.Execute.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00061] in <7055eabc1c4d479bae6fe14cbb288dd8>:0
      at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <e5ac390771dc411395a594de571775c7>:0
      at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <fc2b4388d9974d719a0972b08cea0f17>:0
      at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <fc2b4388d9974d719a0972b08cea0f17>:0