RANDOM FIRE. - 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: RANDOM FIRE. (
/showthread.php?tid=458356)
RANDOM FIRE. -
dorperez - 16.08.2013
Hey,
How can I make a timer that after 15 minuts of starting the server 3 objects of fire will activate together,there will be 15 diffrent places that the objects will activated and it will be random,can someone help me plz ?
Re: RANDOM FIRE. -
Kells - 16.08.2013
i can't understand you mean make the gamemode with time?
Re: RANDOM FIRE. -
dorperez - 16.08.2013
Quote:
Originally Posted by Kells
i can't understand you mean make the gamemode with time?
|
No,I will try to explain again
I want to do that after 15 minuts that I start the server,a frew fire object will show in random place that I will define.
Re : RANDOM FIRE. -
Garwan50 - 16.08.2013
pawn Code:
forward SpawnObject();
public SpawnObject()
{
// Object to add
}
public OnGameModeInit()
{
SetTimer("SpawnObject", 15*60000, 0) // after 15minuts, the SpawnObject function will be called.
}
Re: Re : RANDOM FIRE. -
dorperez - 16.08.2013
Quote:
Originally Posted by Garwan50
pawn Code:
forward SpawnObject(); public SpawnObject() { // Object to add }
public OnGameModeInit() { SetTimer("SpawnObject", 15*60000, 0) // after 15minuts, the SpawnObject function will be called. }
|
Tnx but I also want it to choose from a random list...
I mean I have 3 places with 5 objects each and I want it to choose 1 and spawn his objects untill someone sprays water on it.
Re: RANDOM FIRE. -
[MM]RoXoR[FS] - 16.08.2013
I think you should create an array of position's you want like
pawn Code:
new Float:pos[15][3] = {
{0,0,0}, //Replace 0,0,0 and 1,1,1 with position's
{1,1,1}, //Do for all 15 positions
.
.
.
};
Now create a timer when game start's
pawn Code:
forward StartFire();
public OnGameModeInit()
{
SetTimer("StartFire", 15*60000, 0)
}
Now the function to create object
pawn Code:
public StartFire()
{
for(new i=0;i<3;++i){
new rand = random(sizeof(pos));
CreateObject(18689,pos[rand][0],pos[rand][1],pos[rand][2],0,0,0);}
}
Re: RANDOM FIRE. -
dorperez - 16.08.2013
Quote:
Originally Posted by [MM]RoXoR[FS]
I think you should create an array of position's you want like
pawn Code:
new Float:pos[15][3] = { {0,0,0}, //Replace 0,0,0 and 1,1,1 with position's {1,1,1}, //Do for all 15 positions . . . };
Now create a timer when game start's
pawn Code:
forward StartFire();
public OnGameModeInit() { SetTimer("StartFire", 15*60000, 0) }
Now the function to create object
pawn Code:
public StartFire() {
for(new i=0;i<3;++i){ new rand = random(sizeof(pos)); CreateObject(18689,pos[rand][0],pos[rand][1],pos[rand][2],0,0,0);} }
|
22 Errors... There is a missing barracks or something..
Can I get another code guys ?
Re: RANDOM FIRE. -
RedJohn - 16.08.2013
pawn Code:
new Float:pos[15][3] = {
{0,0,0}, //Replace 0,0,0 and 1,1,1 with position's
{1,1,1}, //Do for all 15 positions
.
.
.
};
Show us these, I think you have comma at the last line.