AddStaticVehicle
#1

can i respawn all the AddStaticVehicleґs if they arenґt used for like a 10 minutes?
Reply
#2

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).
Reply
#3

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...
Reply
#4

You can do it by setting at AttStaticVehicleEX
You have an paramter of timer
i doing it by 8000 seconds

PHP код:
 AddStaticVehicleEx (5202109.17631503.045332.288782.2873, -1, -18000); 
Reply
#5

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
Reply
#6

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;
}
Reply
#7

If its not used, so what's the point to respawn it there again?
Reply
#8

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.
Reply
#9

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)