SA-MP Forums Archive
Respawn Vehicles don't respawn spawned cars - 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: Respawn Vehicles don't respawn spawned cars (/showthread.php?tid=438218)



Respawn Vehicles don't respawn spawned cars - JaKe Elite - 19.05.2013

Hello,
I've found out that /respawnveh doesn't respawn the spawned vehicles

pawn Code:
CMD:respawnveh(playerid, params[])
{
    CL(playerid);
    if(pInfo[playerid][Admin] >= 4)
    {
        SendClientMessage(playerid, COLOR_GREEN, "You have successfully Respawned all Vehicles!");
        GameTextForAll("~n~~n~~n~~n~~n~~n~~r~Vehicles ~g~Respawned!", 3000, 3);
        for(new cars=0; cars<MAX_VEHICLES; cars++)
        {
            SetVehicleToRespawn(cars);
        }
    }
    else return Error(playerid, 6);
    return 1;
}
How can i fix it?

this is how i do in /car

pawn Code:
foreach(new i : Player)
        {
            if(pCar[playerid] != -1)
            {
                if(IsPlayerInVehicle(i, pCar[playerid])) return 1;
                else
                    DestroyVehicle(pCar[playerid]);
            }
        }
        pCar[playerid] = vehicle;



Re: Respawn Vehicles don't respawn spawned cars - VanillaRain - 19.05.2013

You don't have explained which cars in which coordinates respawn all vehicles! you must add

AddStaticVehicle(VEHICLE ID ,X ,Y ,Z , ANGLE ,COLOR 1 ,COLOR 2);

and must be something like this at the end THIS



You can consider using also the AddStaticVehicleEx that automatically every X seconds respawn every car!

see the example here! AddStaticVehicleEx


Re: Respawn Vehicles don't respawn spawned cars - JaKe Elite - 19.05.2013

I'm not a n00b.
I use CreateVehicle for spawning in /car

If i use /respawnveh. The spawned vehicle disappears.


Re: Respawn Vehicles don't respawn spawned cars - VanillaRain - 19.05.2013

Quote:
Originally Posted by _Jake_
View Post
I'm not a n00b.
I use CreateVehicle for spawning in /car

If i use /respawnveh. The spawned vehicle disappears.
I'm not here to tell you are a noob, i'm here to tell you what i should use to do this function, that was my advice, but you are absolutely free to use what you want. Peace


Re: Respawn Vehicles don't respawn spawned cars - JaKe Elite - 20.05.2013

bump.


Re: Respawn Vehicles don't respawn spawned cars - Guest123 - 20.05.2013

try this

pawn Code:
CMD:respawnveh(playerid, params[])
{
    #pragma unused params
    if(pInfo[playerid][Admin] >= 4)
    {
        SendClientMessage(playerid, COLOR_GREEN, "You have successfully Respawned all Vehicles!");
        GameTextForAll("~n~~n~~n~~n~~n~~n~~r~Vehicles ~g~Respawned!", 3000, 3);
        for(new cars=0; cars<MAX_VEHICLES; cars++)
        {
            if(!VehicleOccupied(cars))
            {
                SetVehicleToRespawn(cars);
            }
        }
        return 1;
    }
    else return Error(playerid, 6);
}



Re: Respawn Vehicles don't respawn spawned cars - JaKe Elite - 20.05.2013

never mind guys. i forgot that OnVehicleSpawn all spawned vehicles are deleted. Anyway thanks for trying to help me