SA-MP Forums Archive
cooldown problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: cooldown problem (/showthread.php?tid=620857)



cooldown problem - TobiasJones - 03.11.2016

So I got a cooldown for my command, I want it to be hours:minutes, for example if you have to wait 24 hours then it'll be like >> 24:00, after 1 minute >> 23:59, after 1 more minute >> 23:58, etc.

How to do that? Here's my code;

PHP код:
        new iString[120];
        new 
currenttime gettime();
        new 
cooldown = (Cooldown[playerid] + 86400) - currenttime;
        
format(iStringsizeof(iString),"You have to wait %02d:%02d:%02d"cooldown 60cooldown 60cooldown 60);
           if(
currenttime < (Cooldown[playerid] + 120)) return SendClientMessage(playerid, -1iString);
        
Cooldown[playerid] = gettime(); 



Re: cooldown problem - DTV - 04.11.2016

I'm not too sure if this could help you, but you could try using this.


Re: cooldown problem - TobiasJones - 04.11.2016

I saw a lot of players using the same code i'm using, the gettime but making it hours:minutes instead of minuteseconds.

Anyone?