vehicle wont destroy - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: vehicle wont destroy (
/showthread.php?tid=618971)
vehicle wont destroy -
StR_MaRy - 12.10.2016
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
Re: vehicle wont destroy -
Threshold - 12.10.2016
The only way this could occur is 'VehTruckID[playerid]' does not store the correct vehicle ID at the time of use.
Re: vehicle wont destroy -
azzerking - 12.10.2016
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?