Adding Explosive Barrels?
#1

Yo
So i was adding explosive barrels to my server map :P and realised they don't respawn back after being hit
I used CreateObject so there is no respawn time
Any solution??
Reply
#2

pawn Код:
new barrel = CreateObject();
SetTimer("BarrelRespawn", 60000, true);

forward BarrelRespawn();
public BarrelRespawn()
{
  DestroyObject(barrel);
  barrel = CreateObject();
}
Reply
#3

Dude I have like 50 barrels .....how can do that easier?
Reply
#4

I would do that with foreach in such case.

pawn Код:
Itter_Create(Barrier,MAX_BARRIERS);

Itter_Add(Barrier,CreateObject(...));


SetTimer("BarRespawn",60000,true);
public BarRespawn()
{
  foreach(Barrier,x)
  {
    DestroyObject(x);
    Itter_Remove(Barrier,x);
    Itter_Add(Barrier,CreateObject(...));
  }
  return;
}
Reply
#5

Quote:
Originally Posted by DJDhan
Dude I have like 50 barrels .....how can do that easier?
By thinking a little and not waiting to copy everything you see

pawn Код:
new barrel[50];
barrel[0] = CreateObject();
// ...
barrel[49] = CreateObject();
//no there is no faster/better way

SetTimer("BarrelRespawn", 60000, true);

forward BarrelRespawn();
public BarrelRespawn()
{
  //loop start here
  DestroyObject(barrel[index]); //or whatever you'll use in the loop
  barrel[index] = CreateObject();
  //loop end here
}
Reply
#6

I was not waiting to copy everything dice7
I guess i gotta do it one by one.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)