19.05.2017, 18:42
You can use a global boolean variable
Set it to false inside OnPlayerConnect
You can set it to true when the player starts the driving test
Set it to false when the player ends the driving test or when he leaves the vehicle.
And OnPlayerExitVehicle
Код:
new bool:isTakingDrivingTest[MAX_PLAYERS];
Код:
public OnPlayerConnect(playerid) { isTakingDrivingTest[playerid] = false; }
Код:
isTakingDrivingTest[playerid] = true;
Код:
if(PlayerEndedTest) isTakingDrivingTest[playerid] = false;
Код:
public OnPlayerExitVehicle(playerid, vehicleid) { if(!isTakingDrivingTest[playerid]) //is the same as using: if(isTakingDrivingTest[playerid] == false) { GetPlayerVehicleID(playerid); //This line should be deleted because you're not storing its result in any variable so is useless DestroyVehicle(vehicleid); PlayerInfo[playerid][pDrivingTest] = 0; DisablePlayerCheckpoint(playerid); SetPlayerPos(playerid, -147.2725,1079.0540,19.7500); SetPlayerFacingAngle(playerid, 88.3368); SetPlayerInterior(playerid, 0); SetCameraBehindPlayer(playerid); SendClientMessage(playerid, COLOR_WHITE, "{F0F8FF}You{F0F8FF} {FF6347}FAILED{FF6347} {F0F8FF}the driving test for abandoning the license vehicle.{F0F8FF}"); return 1; } return 1; }