Vehicles despawning randomly -
Mellnik - 29.01.2013
After a uptime of 1-2 days the vehicles on my server begins to despawn short after you create them with CreateVehicle. It also seems, that when creating them the vehicle, someone else's despawns.
I got a /v command which lets you create a vehicle per player.
I'm handling the vehicles via variables, so when someone creates a vehicle the old one gets destroyed.
I'm also using number plates...
respawn_delay is -1 in all cases
Re: Vehicles despawning randomly -
Threshold - 29.01.2013
This happens a lot on my server, basically you need to do checks under OnPlayerDisconnect and under the command /v. For example:
pawn Код:
CMD:v(playerid, params[])
{
//Whatever you have here
if(PlayerCar[playerid] != -1) //If they have a car spawned
{
DestroyVehicle(PlayerCar[playerid]); //Destroy the car they have spawned
PlayerCar[playerid] = -1; //Reset for debugging purposes
}
PlayerCar[playerid] = CreateVehicle(...
//Code continues...
}
Same on Onplayerdisconnect...
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
if(PlayerCar[playerid] != -1)
{
DestroyVehicle(PlayerCar[playerid]);
PlayerCar[playerid] = -1;
}
return 1;
}
Also make sure you reset the variable to an INVALID_VEHICLE_ID OnPlayerConnect.
AW: Vehicles despawning randomly -
Mellnik - 29.01.2013
Of course im doing all of this, also setting the var to -1 at OnPlayerConnect.
Re: Vehicles despawning randomly -
Threshold - 29.01.2013
Can you show your v command? :S
AW: Vehicles despawning randomly -
Mellnik - 29.01.2013
its not because of that, they also despawn in derby and races ....
Re: Vehicles despawning randomly -
Babul - 29.01.2013
...then show ALL your DestroyVehicle lines in your entire script+filterscript(s).
it looks like a memory leak, caused by variables not being reset, or maybe an array/pointer problem (using wrong variables in the vehicle array, like vehicle[id] instead vehicleid[playerid]. this can happen anytime when using variables as pointers in array cells.
AW: Vehicles despawning randomly -
Mellnik - 30.01.2013
I check them all once again but found nothing

Also crashdetect doesnt print any warnings.