19.05.2017, 18:26
Hello everyone,
I got a simple system I'm working on recognizing if a player is taking a driving license test and if the player leave the vehicle during the exam it should return the player to the DMV and cancel the test.
So far the returning the player to the DMV is working properly, but I'm trying to understand how to get it to know if the player is taking the test or not. Right now it kicks the player from any vehicle even if they are not doing a test.
PlayerInfo[playerid][pCarDrivingTest] gets updated when the player enters a checkpoint during the test. If the player is not taking a driving test it is per default at 0, but if a player is taking the test the value can be anywhere between 1-51 depending on how many checkpoints the driving exam got.
So how do I get it to know if the value is anywhere above 0?
I got a simple system I'm working on recognizing if a player is taking a driving license test and if the player leave the vehicle during the exam it should return the player to the DMV and cancel the test.
So far the returning the player to the DMV is working properly, but I'm trying to understand how to get it to know if the player is taking the test or not. Right now it kicks the player from any vehicle even if they are not doing a test.
PlayerInfo[playerid][pCarDrivingTest] gets updated when the player enters a checkpoint during the test. If the player is not taking a driving test it is per default at 0, but if a player is taking the test the value can be anywhere between 1-51 depending on how many checkpoints the driving exam got.
PHP код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(PlayerInfo[playerid][pCarDrivingTest] < 1 || PlayerInfo[playerid][pTruckDrivingTest] < 1)
{
GetPlayerVehicleID(playerid);
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;
}