explosion loop
#1

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?
Reply
#2

Well, you could do something like /explode and /explodeoff. If you want this, i'll script it, it's easy.
Reply
#3

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);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)