SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 09/12/2009, 04:55 PM   #1
DJDhan
High-roller
 
DJDhan's Avatar
 
Join Date: Oct 2009
Location: Canada
Posts: 1,150
Reputation: 6
Default Adding Explosive Barrels?

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??
__________________
DJDhan is offline  
Old 09/12/2009, 04:58 PM   #2
dice7
High-roller
 
Join Date: Apr 2009
Location: Slovenia
Posts: 2,200
Reputation: 22
Default Re: Adding Explosive Barrels?

pawn Code:
new barrel = CreateObject();
SetTimer("BarrelRespawn", 60000, true);

forward BarrelRespawn();
public BarrelRespawn()
{
  DestroyObject(barrel);
  barrel = CreateObject();
}
dice7 is offline  
Old 09/12/2009, 05:09 PM   #3
DJDhan
High-roller
 
DJDhan's Avatar
 
Join Date: Oct 2009
Location: Canada
Posts: 1,150
Reputation: 6
Default Re: Adding Explosive Barrels?

Dude I have like 50 barrels .....how can do that easier?
__________________
DJDhan is offline  
Old 09/12/2009, 05:13 PM   #4
Sergei
High-roller
 
Sergei's Avatar
 
Join Date: Mar 2008
Location: Slovenia
Posts: 2,862
Reputation: 230
Default Re: Adding Explosive Barrels?

I would do that with foreach in such case.

pawn Code:
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;
}
__________________
Watch out, scouts everywhere!
Sergei is offline  
Old 09/12/2009, 05:16 PM   #5
dice7
High-roller
 
Join Date: Apr 2009
Location: Slovenia
Posts: 2,200
Reputation: 22
Default Re: Adding Explosive Barrels?

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 Code:
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
}
dice7 is offline  
Old 10/12/2009, 08:31 AM   #6
DJDhan
High-roller
 
DJDhan's Avatar
 
Join Date: Oct 2009
Location: Canada
Posts: 1,150
Reputation: 6
Default Re: Adding Explosive Barrels?

I was not waiting to copy everything dice7
I guess i gotta do it one by one.
__________________
DJDhan is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Need Help] Explosive Help. Hash [NL-RP] Help Archive 3 11/05/2010 02:25 AM
OMGGGG BARRELS~! PANNA Help Archive 11 26/11/2009 05:23 PM
Explosive barrel bug?? MB@ Client Support 3 26/08/2009 05:39 AM
Barrels carshing game Enzo_Ferrari_V12 Help Archive 3 27/07/2009 01:16 AM


All times are GMT. The time now is 07:32 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.