SA-MP Forums Archive
Deleting then re-creating objects on 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: Deleting then re-creating objects on timers (/showthread.php?tid=416233)



Deleting then re-creating objects on timers - nmader - 16.02.2013

Basically I am working on a script for a firealarm that will be located in any major building, faction HQ, house, etcetra in my roleplay server. Now, I have all the sounds working perfectly fine; however how would I go about making two objects (red and white lights via the PointLight objects) flash on times of 500ms? This is simple but it is messing with my head after a long night.

Any and all assistance will be greatly appreciated (but rep not guaranteed unless you deserve it)

~Nmader


Re: Deleting then re-creating objects on timers - DaRk_RaiN - 16.02.2013

pawn Код:
//The Timer Which will destroy bla bla,
SetTimer("flash",500,1);
pawn Код:
//this will be the variable which will check for the flash
new Flashing;
pawn Код:
forward flash();
public flash()
{
if(Flashing == 1)//We are checking for the object status
{
//Un-comment the lines bellow with the objects
//CreateObject(//first object bla bla
//CreateObject(//bla bla
}
else if(Flashing == 0)//We are checking for the object status
{
//Un-comment the lines bellow with the objects
//DestroyObject(//Destroying the first object
//CreateObject(//Destroying the Second object
}
}