vehicle wont destroy
#1

hey guys i have a sistem when a player works and disconnects it delete his car but is a bug when a player Crash his car wont delete

i have this under onplayerdisconnect

ClearJob(playerid);
ClearPizzaJob(playerid);

and the sistem is

Код HTML:
function ClearJob(playerid)
{
    if(VehTruckID[playerid] != -1)
	{
        vDBID[ VehTruckID[playerid] ] = 0;
	    DestroyVehicle(VehTruckID[playerid]);
		VehTruckID[playerid] = -1;
		Truckers--;
		DisableRemoteVehicleCollisions(playerid, 0);
		InJob[playerid] = 0;
		JobCollect[playerid] = 0;
		PlayerTextDrawHide(playerid, HelpTextdraw[playerid]);
		SendClientMessage( playerid, COLOR_SYN, "(!) {FFFFFF}Ai decis sa inchei aceasta slujba!" );
		CP[playerid] = 0;
		DisablePlayerCheckpoint(playerid);
		PlayerTextDrawHide(playerid, ExamTextdraw[playerid]);
	}
}
i did an example just for trucker, i know is 1 of 1000 chance a player to crash but i hate that chance
Reply
#2

The only way this could occur is 'VehTruckID[playerid]' does not store the correct vehicle ID at the time of use.
Reply
#3

Information

OnPlayerDisconnect is called even when a player crashes, you must be using the reasons to control data is saved and removed.

Where in OnPlayerDisconnect have you placed ClearJob( playerid ); ?

Also you might have not stored the correct ID for the vehicle when they crash?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)