Skip to content

Commit

Permalink
Added CD
Browse files Browse the repository at this point in the history
Should have not taken this long but its done
  • Loading branch information
babyboucher committed Sep 9, 2020
1 parent 15f6073 commit 0af0ae7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
3 changes: 3 additions & 0 deletions ZombieSuicideHotline/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ public class Config : IConfig {
[Description("Is the plugin enabled?")]
public bool IsEnabled { get; set; } = true;

[Description("How long between each use of Recall?")]
public float RecallCD { get; set; } = 20f;

[Description("A list of classes that should beable to call the suicide hotline and what precent of their health is done")]
public Dictionary<string, float> HotlineCalls { get; set; } = new Dictionary<string, float>
{
Expand Down
23 changes: 21 additions & 2 deletions ZombieSuicideHotline/RecallCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using CommandSystem;
using Exiled.API.Features;
using RemoteAdmin;
using UnityEngine;

namespace ZombieSuicideHotline
{
Expand All @@ -28,8 +29,15 @@ public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out s
{
if (players.Role == RoleType.Scp0492)
{
players.Position = player.Position;
response = "Zombies recalled!";
if (Timerfunc())
{
players.Position = player.Position;
response = "Zombies recalled!";
}
else
{
response = "Recall is on cooldown for " + (Lasttime + Plugin.Singleton.Config.RecallCD - Time.time).ToString();
}
}
}
if (response == "")
Expand All @@ -41,7 +49,18 @@ public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out s
{
response = "You must be SCP 049 to use this command!";
}
//return true;
return true;
}
public float Lasttime = 0;
public bool Timerfunc()
{
if (Lasttime + Plugin.Singleton.Config.RecallCD < Time.time)
{
Lasttime = Time.time;
return true;
}
return false;
}
}
}

0 comments on commit 0af0ae7

Please sign in to comment.