Cooldown time is negativeFixed
/mymini followed by /nomini followed by /mymini results in "You must wait before a new mini copter (-33.26667 min)

MyMiniCopter.json as follows:

{
"Chat Settings": {
"Prefix": "[My MiniCopter] :",
"SteamIDIcon": "xxxxxxxxxxxxxxxx"
},
"Cooldown (on permission)": {
"Use Cooldown": true,
"Value in minutes": "3"
}
}
I have a player getting the same message but I am able to spawn one as admin.
Thanks, will check.
@rfc1920 you need to fix up your cooldown logic, it's not working properly. Change the config to seconds (and change from float to int) to add more granularity. Then use this logic:
            bool hascooldownperm = permission.UserHasPermission(player.UserIDString, MinicopterCooldown);
            int secondsleft = 0;
            if (hascooldownperm && useCooldown)
            {
                if (!storedData.playercounter.ContainsKey(player.userID))
                {
                    storedData.playercounter.Add(player.userID, secondsSinceEpoch);
                }
                else
                {
                    int count = new int();
                    storedData.playercounter.TryGetValue(player.userID, out count);
                    secondsleft = cooldownseconds - (secondsSinceEpoch - count);
                    if (debug) Puts($"Player DID NOT reach cooldown return.");
					if (secondsleft > 0) 
					{
						Player.Message(player, $"{lang.GetMessage("CooldownMsg", this, player.UserIDString)} ({secondsleft} seconds)", Prefix);
						return;
					}
                }
            }
            else
            {
                if (storedData.playercounter.ContainsKey(player.userID))
                {
                    storedData.playercounter.Remove(player.userID);
                }
            }


Merged post

Alternatively for minimal changes, you can just use this:
                    minleft = cooldownmin - ((secondsSinceEpoch - count) / 60);
					int roundedUp = (int)Math.Ceiling(minleft);
					if (minleft > 0)
					{
						if (debug) Puts($"Player DID NOT reach cooldown return.");
						Player.Message(player, $"{lang.GetMessage("CooldownMsg", this, player.UserIDString)} ({roundedUp} min)", Prefix);
						return;
					}​
Ya same issue.

Merged post

thanks kinesis that worked.
Should be fixed in 0.0.5.  I ended up switching to double after looking at some other plugins' implementations of cooldowns.
Locked automatically