Respawn all unused vehicles - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Respawn all unused vehicles (
/showthread.php?tid=168468)
Respawn all unused vehicles -
LZLo - 16.08.2010
i have a problem
i want, to respawn all unused vehicles in every 2h 30 mins with forward
pls help!
at the beginning
PHP код:
forward RespawnVehs();
under ongamemodeinit
PHP код:
SetTimer("RespawnVehs", 9000000, true);
at the end
PHP код:
public RespawnVehs()
{
////////HELP
////////HELP
////////HELP
////////HELP//////
////////HELP
////////HELP
return 1;
}
Re: Respawn all unused vehicles -
Mike_Peterson - 16.08.2010
It something with SetVehicleToRespawn
Re: Respawn all unused vehicles -
LZLo - 16.08.2010
just pls help
Re: Respawn all unused vehicles -
Mike_Peterson - 16.08.2010
Код:
public RespawnVehs()
{
for(new i=0;i<MAX_VEHICLES;i++)
{
if(IsVehicleOccupied(i) == 0)
{
SetVehicleToRespawn(i);
}
}
SendClientMessageToAll([YOURCOLOR],"All unused vehicles have been respawned");
return 1;
i hope it works
EDIT: errmm your timer 9000000 or sumthing isnt that 1,30 hours each time? use 150(00000)
Re: Respawn all unused vehicles -
Mike_Peterson - 16.08.2010
Lol, to test it you need to be on ur server 2,30 hours long, set the timer to every 23 seconds (simple delete some 0s) then check if it works, if it works set the timer to 2,30 hours
Re: Respawn all unused vehicles -
LZLo - 16.08.2010
ok thanks
Re: Respawn all unused vehicles -
LZLo - 16.08.2010
error 017: undefined symbol "IsVehicleOccupied" bug xD
Re: Respawn all unused vehicles -
Mike_Peterson - 16.08.2010
hmm, wait
EDIT: add this to the bottom of your script:
Код:
stock IsVehicleOccupied(vehicleid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerInVehicle(i,vehicleid))
return 1;
}
return 0;
}
Re: Respawn all unused vehicles -
LZLo - 16.08.2010
ok i just wait
Re: Respawn all unused vehicles -
Mike_Peterson - 16.08.2010
Now im about sure it works, may i test it on your server? dont forget to set the timer 23 secs btw (if you wanna test it with me )