SA-MP Forums Archive
wait then respawn - 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: wait then respawn (/showthread.php?tid=376510)



wait then respawn - phil_lendon - 10.09.2012

Whats the code for
Quote:

Wait 15 seconds
Respawn/make another one of CAR1

(for eg)
make another one of would be preffered


Re: wait then respawn - Roach_ - 10.09.2012

The function is:
pawn Код:
SetVehicleToRespawn( vehicleid );
You can use a timer for what you want to do!


AW: wait then respawn - BiosMarcel - 10.09.2012

Respawn so SetVehicleToRespawn(vehicleid);


Re: wait then respawn - phil_lendon - 10.09.2012

How can I use a timer?
Is there a respawn ALL vehichles?


Re: wait then respawn - Roach_ - 10.09.2012

Here is a little script that let you respawn all vehicles:

Foreach version
pawn Код:
for( new V = 0; V < MAX_VEHICLES; V ++ )
{
    foreach(new i : Player)
    {
        if( IsPlayerInVehicle( i, V ) ) SetVehicleToRespawn( V );
    }
}
Loop version
pawn Код:
for( new V = 0; V < MAX_VEHICLES; V ++ )
{
    for( new i = 0; i < MAX_PLAYERS; i ++ )
    {
        if( IsPlayerInVehicle( i, V ) ) SetVehicleToRespawn( V );
    }
}



Re: wait then respawn - mamorunl - 10.09.2012

@Roach_: The foreach loop is a loop as well, so naming the loop version 'loop version' is a bit wrong naming convention. The second example is just a nested for loop.

Also: isn't it possible to have a foreach in a foreach?