Driving Test & OnPlayerExitVehicle
#2

You can use a global boolean variable
Код:
new bool:isTakingDrivingTest[MAX_PLAYERS];
Set it to false inside OnPlayerConnect
Код:
public OnPlayerConnect(playerid)
{
     isTakingDrivingTest[playerid] = false;
}
You can set it to true when the player starts the driving test
Код:
isTakingDrivingTest[playerid] = true;
Set it to false when the player ends the driving test or when he leaves the vehicle.
Код:
if(PlayerEndedTest)
	isTakingDrivingTest[playerid] = false;
And OnPlayerExitVehicle
Код:
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; 
}
Reply


Messages In This Thread
Driving Test & OnPlayerExitVehicle - by freddiebox - 19.05.2017, 18:26
Re: Driving Test & OnPlayerExitVehicle - by Aly - 19.05.2017, 18:42

Forum Jump:


Users browsing this thread: 2 Guest(s)