explosion loop
#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


Messages In This Thread
explosion loop - by CSLangdale - 15.10.2017, 16:29
Re: explosion loop - by Escobabe - 15.10.2017, 16:44
Re: explosion loop - by Abagail - 15.10.2017, 16:56

Forum Jump:


Users browsing this thread: 1 Guest(s)