PDA

View Full Version : Respawn Vehicles don't respawn spawned cars


JaKe Elite
19/05/2013, 09:34 AM
Hello,
I've found out that /respawnveh doesn't respawn the spawned vehicles


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


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

VanillaRain
19/05/2013, 12:30 PM
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 (http://paste.ubuntu.com/5680118/)



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

see the example here! AddStaticVehicleEx (http://wiki.sa-mp.com/wiki/AddStaticVehicleEx)

JaKe Elite
19/05/2013, 12:34 PM
I'm not a n00b.
I use CreateVehicle for spawning in /car

If i use /respawnveh. The spawned vehicle disappears.

VanillaRain
19/05/2013, 12:50 PM
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

JaKe Elite
20/05/2013, 07:03 AM
bump.

Guest123
20/05/2013, 08:13 AM
try this


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);
}

JaKe Elite
20/05/2013, 08:17 AM
never mind guys. i forgot that OnVehicleSpawn all spawned vehicles are deleted. Anyway thanks for trying to help me