Car Respawn Command doesn't work -
ImTobi - 26.07.2017
Pawn Code:
CMD:respawncars(playerid, params[])
{
for(new i=0; i<MAX_VEHICLES; i++)
SetVehicleToRespawn(i);
SCMToAll(gelb,"Alle Autos wurden respawned.");
return 1;
}
When i type ingame. /respawncars the cars just disappear and don't respawn
Re: Car Respawn Command doesn't work -
Crystallize - 26.07.2017
Код:
for(new i = GetVehiclePoolSize(); i > 0; i--)
{
SetVehicleToRespawn(i);
}
https://sampwiki.blast.hk/wiki/Function:SetVehicleToRespawn
Re: Car Respawn Command doesn't work -
ImTobi - 26.07.2017
Doesn't work...
The Cars just disappear but don't respawn
Re: Car Respawn Command doesn't work -
Kane - 26.07.2017
Don't use SCMToAll() in the loop. It'll spam the message depending on the amount of vehicles respawned.
PHP код:
CMD:respawncars(playerid, params[])
{
new vehiclesExist = 0;
for(new i = GetVehiclePoolSize(); i > 0; i--)
{
SetVehicleToRespawn(i);
vehiclesExist++;
}
if (vehiclesExist)
SCMToAll(gelb,"Alle Autos wurden respawned.");
else
SendClientMessage(playerid, -1, "No vehicles were available to respawn.");
return true;
}
EDIT:
It isn't possible to destroy the vehicle using SetVehicleToRespawn.
Check
public OnVehicleSpawn(vehicleid) and see if DestroyVehicle(vehicleid) is in there.
Re: Car Respawn Command doesn't work -
ImTobi - 26.07.2017
I have this in there:
public OnVehicleSpawn(vehicleid,playerid)
{
SetVehiclePos(vehicleid,vx,vy,vz);
SetVehicleZAngle(vehicleid,vr);
SetVehicleHealth(vehicleid,399);
return 1;
}
Because when a car explodes, it respawns where it exploded
Edit: Without it, it works..
But i still want this in there
Re: Car Respawn Command doesn't work -
Kane - 26.07.2017
Remove that completely. It doesn't help you at all having that.
There's no playerid parameter in OnVehicleSpawn and where are you grabbing vx, vy, vz and vr from to set their positions?
OnVehicleDeath is called when a vehicle is destroyed.
https://sampwiki.blast.hk/wiki/OnVehicleDeath
Re: Car Respawn Command doesn't work -
ImTobi - 26.07.2017
I already fixed it, thank you all <3
My Vehicles Spawn where they exploded, and i can respawn all cars, Thanks