AddStaticVehicle - 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: AddStaticVehicle (
/showthread.php?tid=609276)
AddStaticVehicle -
karoliko - 10.06.2016
can i respawn all the AddStaticVehicleґs if they arenґt used for like a 10 minutes?
Re: AddStaticVehicle -
Konstantinos - 10.06.2016
That's why
AddStaticVehicleEx exists because it has a
respawn_delay parameter. It is in seconds, so set it to 600 seconds (equals to 10 minutes).
Re: AddStaticVehicle -
karoliko - 10.06.2016
Quote:
Originally Posted by Konstantinos
That's why AddStaticVehicleEx exists because it has a respawn_delay parameter. It is in seconds, so set it to 600 seconds (equals to 10 minutes).
|
Yes but only if the vehicle has been left, i want to make it to respawn if it arenґt used not when they left...
PLAYER ON VEHICLE - NOT RESPAWN
VEHICLE ALONE 10 MINUTES - RESPAWN
Donґt start the count when the player left the vehicle...
Re: AddStaticVehicle -
Kenway - 10.06.2016
You can do it by setting at AttStaticVehicleEX
You have an paramter of timer
i doing it by 8000 seconds
PHP код:
AddStaticVehicleEx (520, 2109.1763, 1503.0453, 32.2887, 82.2873, -1, -1, 8000);
Re: AddStaticVehicle -
Alpay0098 - 10.06.2016
Quote:
Originally Posted by karoliko
Yes but only if the vehicle has been left, i want to make it to respawn if it arenґt used not when they left...
PLAYER ON VEHICLE - NOT RESPAWN
VEHICLE ALONE 10 MINUTES - RESPAWN
Donґt start the count when the player left the vehicle...
|
Your car won't respawn if there's a driver, driving it.
https://sampwiki.blast.hk/wiki/AddStaticVehicleEx
"respawn_delay The delay until the car is respawned without a driver, in seconds."
Take care
Re: AddStaticVehicle -
Sime30 - 11.06.2016
I think he wants to respawn all vehicles even if they weren't used, right?
AddStaticVehicleEx will only respawn a vehicle after being left so what you would need is a timer.
pawn Код:
new carResetTimer; // create a reference-variable for the timer
carResetTimer = SetTimer("CarResetTimer",600000,1); //timer that will call a callback "CarResetTimer" every 10 minutes. OnGameModeInit
KillTimer(carResetTimer); // put this OnGameModeExit , you need it
IsVehicleOccupied(vehicleid) // function to check if someone is using the vehicle. Useful if you don't want vehicles to be respawned while the player is using it. Place it outside other publics
{
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++) // loop through every player
{
if(IsPlayerInVehicle(i, vehicleid)) return 1;
}
return 0;
}
forward CarResetTimer();
public CarResetTimer()
{
for(new i = 1, j = GetVehiclePoolSize(); i <= j; i++) // loop through every vehicle
{
if(!IsVehicleOccupied(i)) // if the vehicle IS NOT being used at the moment!
{
SetVehicleToRespawn(i);
}
}
SendClientMessageToAll(-1, "All vehicles have been respawned!");
return 1;
}
Re: AddStaticVehicle -
Alpay0098 - 11.06.2016
If its not used, so what's the point to respawn it there again?
Re: AddStaticVehicle -
Sime30 - 11.06.2016
Quote:
Originally Posted by Alpay0098
If its not used, so what's the point to respawn it there again?
|
There are some points:
1. If a player runs into a car and moves it that way where he wants
2. If some vehicles are bugged/glitched
3. Just proper cleaning
AddStaticVehicleEx won't help you at those points, only a manual respawn or an automatic via timer will help you.
Re: AddStaticVehicle -
Alpay0098 - 11.06.2016
Quote:
Originally Posted by Sime30
There are some points:
1. If a player runs into a car and moves it that way where he wants
2. If some vehicles are bugged/glitched
3. Just proper cleaning
AddStaticVehicleEx won't help you at those points, only a manual respawn or an automatic via timer will help you.
|
Well I guess you're right. sooooo he got a lot of work to do

)
EDIT: I forgot you already gave him the code, so gj +rep from me too xD