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: explosion loop (
/showthread.php?tid=643222)
explosion loop -
CSLangdale - 15.10.2017
Is there anyway i can make a createexplosion loop so that it will create a new explosion every 2-3 seconds and keep doing it for around 5 minutes?
Re: explosion loop -
Escobabe - 15.10.2017
Well, you could do something like /explode and /explodeoff. If you want this, i'll script it, it's easy.
Re: explosion loop -
Abagail - 15.10.2017
Quote:
Originally Posted by CSLangdale
Is there anyway i can make a createexplosion loop so that it will create a new explosion every 2-3 seconds and keep doing it for around 5 minutes?
|
Quick example I wrote using timers, haven't tested compiling or using it and it's not complete. Probably could also be better optimized, my example also allows for multiple loops of these. extraid would be the index from explosionTimerData.
pawn Код:
#define MAX_CONCURRENT_EXPLOSION_TIMERS (5)
enum explosionTimerData_
{
explosionTimerID,
explosionTimerEndTime
// add more flags here
};
new explosionTimerData[MAX_CONCURRENT_EXPLOSION_TIMERS][explosionTimerData_];
forward ProcessExplosions(Float: x, Float: y, Float: z, extraid);
public ProcessExplosions(Float: x, Float: y, Float: z, extraid)
{
CreateExplosion(...)
if(explosionTimerData[extaid][explosionTimerEndTime] >= gettime())
{
KillTimer(explosionTimerData[extraid][explosionTimerID]);
explosionTimerData[extraid][explosionTimerID] = 0;
}
return 1;
}
// call it
explosionTimerData[extraid][explosionTimerEndTime] = gettime()+300;
explosionTimerData[extraid][explosionTimerTimerID] = CreateTimerEx("ProcessExplosions", 2000, true, "fffi", x, y, z, extraid);