SA-MP Forums Archive
Create explosion loop - 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: Create explosion loop (/showthread.php?tid=642902)



Create explosion loop - CSLangdale - 09.10.2017

Hi I have a system to do fires for fire faction but can someone tell me how I can make it so when a random fire starts it will keep exploding until it runs out of time?

Create explosion then wait a few seconds then another explosion in same place then wait and keep doing that for maybe 5-10 minutes


Re: Create explosion loop - Jstylezzz - 09.10.2017

If you use SetTimerEx you could pass the location of the explosion to the function you're calling. Then after the explosion function is called, check if it's still within the 5-10 minutes (you could use timestamps, save the timestamp when the fire starts and then get a new timestamp to check the passed time in seconds). Then simply set the timer again.

SetTimerEx
Timestamps (gettime)

To get a timestamp. you can simply use:
Код:
new stamp = gettime();
No need to enter the hour, minute, second variables if you don't need them

Example of passing variables with SetTimerEx:
PHP код:
SetTimerEx("SomeFunction"1000false"isf"10"string value"10.0);
forward SomeFunction(integerVariablestringVariable[], Float:floatVariable);
public 
SomeFunction(integerVariablestringVariable[], Float:floatVariable)
{
    
printf("Data: %d %s %f"integerVariablestringVariablefloatVariable);