Vehicle Automatic Respawn - Help ASAP - 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: Vehicle Automatic Respawn - Help ASAP (
/showthread.php?tid=395071)
Vehicle Automatic Respawn - Help ASAP -
Threshold - 25.11.2012
Hello,
I am in a vital need for a automatic unused car respawner. So every unused vehicle respawns after 20 seconds.
Please somebody help me with this. I tried making it with timers but totally failed. If someone could kindly make it for me, I'll be Thankful.
PS - I also searched but only found where they respawn with a command. I want it automatically every 20 seconds
Re: Vehicle Automatic Respawn - Help ASAP -
jakejohnsonusa - 25.11.2012
https://sampwiki.blast.hk/wiki/AddStaticVehicleEx See this... Set respawn_delay (The delay until the car is respawned without a driver, in seconds) to 20.
Hope I helped
Re: Vehicle Automatic Respawn - Help ASAP -
Threshold - 25.11.2012
Yes, I saw that. But the car respawns in that amount of time after the player exits it. I want every unused car to respawn after 20 seconds. Driven or not.
Re: Vehicle Automatic Respawn - Help ASAP -
jakejohnsonusa - 25.11.2012
That should respawn every car if it had been undriven for 20 seconds... However here is a topic asking the same question as you
https://sampforum.blast.hk/showthread.php?tid=166660 There is a command you should use on this topic by Ritchie999.
Re: Vehicle Automatic Respawn - Help ASAP -
Threshold - 25.11.2012
Fixed. I got a Timer to work.
Thanks to Grim on another Thread
Quote:
// Somewhere, like in a command
SetTimer( "RespawnVehicles", 5000, false ); // Change '5000' to make a different delay
// After main( )
forward RespawnVehicles( );
public RespawnVehicles( )
{
new vehicles[ MAX_VEHICLES ];
for( new i = 0; i < MAX_PLAYERS; i ++ )
{
if( IsPlayerInAnyVehicle( i ) )
{
vehicles[ GetPlayerVehicleID( i ) ] = 1;
}
}
for( new v = 0; v < MAX_VEHICLES; v ++ )
{
if( vehicles[ v ] == 1 ) continue;
SetVehicleToRespawn( v );
}
return 1;
}
|