Vehicles Not respawning! Help please -
eemalekorraks - 05.09.2013
Hello people of the forum.
I have currently added vehicles using
since it allows respawn.
Then sometimes using the vehicle spawner shit gets really messed up I needed to clear all them vehicles, so I searched a bit and someone had made this.
Код:
if( strcmp( cmdtext, "/deleteallcars", true ) == 0 )
{
for( new veh; veh < MAX_VEHICLES; veh ++ )
{
if ( veh != INVALID_VEHICLE_ID )
{
DestroyVehicle( veh );
}
}
SendClientMessage(playerid, 0xFFFF00AA, "Deleted all cars on the server!");
return 1;
}
This deletes all the cars like needed.
But the vehicles WONT Respawn after 15 seconds, YES I have added a 15 sec timer I know how
works.
Why won't they respawn? what am I doing wrong?
Helper will be repped,
Regards, Eemale
EDIT: Also this destorys my BOT's lawn mower how would I avoid that?
Re: Vehicles Not respawning! Help please -
CoaPsyFactor - 05.09.2013
Can you show us part of code where you respawn vehicles.
Re: Vehicles Not respawning! Help please -
dusk - 05.09.2013
Well, you destroy them, so they won't get back to they spot...
You can use "SetVehicleToRespawn" to reset a vehicles' start position.
Re: Vehicles Not respawning! Help please -
CoaPsyFactor - 05.09.2013
Oh, I didn't figured out ok what he wanted to say.
+1 to dusk

, but if you destroy all vehicles you'll need to CreateVehicle again
Re: Vehicles Not respawning! Help please -
Dragonsaurus - 05.09.2013
Edit: Already answered.
Re: Vehicles Not respawning! Help please -
Konstantinos - 05.09.2013
Like dusk said, you destroy the vehicles so you cannot respawn invalid vehicles back.
I'm sure you declare a variable for the NPC's vehicle. If so,
pawn Код:
if ( veh != INVALID_VEHICLE_ID && veh != /* the one you stored the vehicle for the NPC */)
Re: Vehicles Not respawning! Help please -
IceBilizard - 05.09.2013
pawn Код:
if( strcmp( cmdtext, "/deleteallcars", true ) == 0 )
{
for( new veh=0; veh < MAX_VEHICLES; veh ++ )
{
if ( veh != INVALID_VEHICLE_ID )
{
DestroyVehicle( veh );
}
}
SendClientMessage(playerid, 0xFFFF00AA, "Deleted all cars on the server!");
return 1;
}
Re: Vehicles Not respawning! Help please -
Luis- - 05.09.2013
Why have you just copied and pasted the code and re-posted it?
Re: Vehicles Not respawning! Help please -
eemalekorraks - 05.09.2013
So is there any other way to remove all the vehicles, and those added in the script as
"CreateVehicle" will respawn?
Under where and how should I use
Код:
SetVehicleToRespawn?
Re: Vehicles Not respawning! Help please -
dusk - 05.09.2013
I don't follow you anymore...but if you want the vehicles to be set to respawn:
pawn Код:
if(!strcmp(cmdtext,"respawnallvehicles"))
{
for(new i = 1; i < MAX_VEHICLES; i++)
{
if(IsValidVehicle(i))
{
SetVehicleToRespawn(i);
}
}
return 1;
}
Note that the function IsValidVehicle must be declared native:
pawn Код:
native IsValidVehicle(vehicleid);