Vehicles despawning randomly
#2

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.
Reply


Messages In This Thread
Vehicles despawning randomly - by Mellnik - 29.01.2013, 11:59
Re: Vehicles despawning randomly - by Threshold - 29.01.2013, 12:42
AW: Vehicles despawning randomly - by Mellnik - 29.01.2013, 13:40
Re: Vehicles despawning randomly - by Threshold - 29.01.2013, 13:52
AW: Vehicles despawning randomly - by Mellnik - 29.01.2013, 15:03
Re: Vehicles despawning randomly - by Babul - 29.01.2013, 18:22
AW: Vehicles despawning randomly - by Mellnik - 30.01.2013, 15:50

Forum Jump:


Users browsing this thread: 1 Guest(s)