SA-MP Forums Archive
timers - 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: timers (/showthread.php?tid=594072)



timers - SalmaN97 - 13.11.2015

Hello guys i want to make a code that every 5 min there will be explosions for 1 min and then explosions stop after one minute is done.

i have did this so far

PHP код:
public OnGameModeInit()
{
    
SetTimer("bombtime"3000001);
    return 
1;
}
public 
bombtime()
{
    
SetTimer("OneMinBomb"600001);
     return 
1;




Re: timers - 7days7 - 13.11.2015

Try with it - http://pastebin.com/X36CqKZq


Re: timers - SalmaN97 - 13.11.2015

can you explain the code for me please


Re: timers - 7days7 - 13.11.2015

First what you're going to do is create a global timer which is started every 1 second.
On top of your gamemode you're creating a new variable which is a value for check "if" in timer.
after 60 seconds explosions you're waiting (5 minutes) for get 360 (5 minutes + 1 minute explosions) value from variable GlobalSec and then set the value to 0.

There's pastebin with comments - http://pastebin.com/zxXz6RKZ


Re: timers - SalmaN97 - 13.11.2015

thanks man the code worked


Re: timers - SalmaN97 - 25.11.2015

i have problem the explosion not repeating after passed 5 minutes since last explosion