14.02.2017, 20:58
Good evening everyone,
I'm trying to make a DMV system with an exam, so I managed everything ...
The problem is when I enter the car and go to the checkpoint nothing happens ...
I mean the current checkpoint disappears but the next one doesn't appear ?? !
Here is my code :
The command :
When the Player enters the DMV car :
And ... THIS IS THE PART OF THE CHECKPOINT, What I did is when players who have the Exam Variables enabled and get to the location of the checkpoint A, it disappears and then the checkpoint B appears ... and it will go like that to the last one.
PLEASE, if anyone could help me solve this, I would appreciate it very much ... Thanks in advance !
I'm trying to make a DMV system with an exam, so I managed everything ...
The problem is when I enter the car and go to the checkpoint nothing happens ...
I mean the current checkpoint disappears but the next one doesn't appear ?? !
Here is my code :
The command :
PHP код:
CMD:exam(playerid, params[])
{
// Basically it is working fine and it enables the variable LicenseTest and CP2 so I can enter the DMV car and stuff ...
GivePlayerCash(playerid, -10000);
LicenseTest[playerid] =1;
CP2[playerid] = 1;
SendClientMessage(playerid,COLOR_LIGHTBLUE,"* Drivers Center: Get into a car outside to begin the test.");
return 1;
}
PHP код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(!ispassenger)
{
if(IsDMVCar(vehicleid))
{
if(!LicenseTest[playerid])
{
new Float:pos[3];
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
SendClientMessage(playerid, COLOR_ORANGE, "You are not taking a drivers license test.");
}
else
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* GPS: Finish the test by driving through all of the checkpoints on your GPS.");
SetPlayerCheckpoint(playerid,2040.7101,-1930.1340,13.4667,5);
SendClientMessage(playerid, COLOR_RED, "If you exit the car your test will be failed and it will have to be re-done.");
}
}
// ..............
And ... THIS IS THE PART OF THE CHECKPOINT, What I did is when players who have the Exam Variables enabled and get to the location of the checkpoint A, it disappears and then the checkpoint B appears ... and it will go like that to the last one.
PHP код:
if(CP[playerid] == 1) // Drivers License Test
{
if(IsPlayerInRangeOfPoint(playerid,5,2040.7101,-1930.1340,13.4667)) // Checkpoint 1
{
SetPlayerCheckpoint(playerid,1948.1033,-1930.6860,13.4751,5);
}
else if(IsPlayerInRangeOfPoint(playerid,5,1948.1033,-1930.6860,13.4751)) // Checkpoint 2
{
SetPlayerCheckpoint(playerid,1830.9167,-1930.0353,13.4754,5);
}
else if(IsPlayerInRangeOfPoint(playerid,5,1830.9167,-1930.0353,13.4754)) // Checkpoint 3
{
SetPlayerCheckpoint(playerid,1823.9110,-1791.2739,13.4752,5);
}
else if(IsPlayerInRangeOfPoint(playerid,5,1823.9110,-1791.2739,13.4752)) // Checkpoint 4
{
SetPlayerCheckpoint(playerid,1824.1433,-1629.3223,13.4751,5);
}
else if(IsPlayerInRangeOfPoint(playerid,5,1824.1433,-1629.3223,13.4751)) // Checkpoint 5
{
SetPlayerCheckpoint(playerid,1929.6962,-1614.7090,13.4751,5);
}
else if(IsPlayerInRangeOfPoint(playerid,5,1929.6962,-1614.7090,13.4751)) // Checkpoint 6
{
SetPlayerCheckpoint(playerid,1938.9127,-1738.9067,13.4751,5);
}
else if(IsPlayerInRangeOfPoint(playerid,5,1938.9127,-1738.9067,13.4751)) // Checkpoint 7
{
SetPlayerCheckpoint(playerid,1959.0842,-1765.3502,13.4750,5);
}
else if(IsPlayerInRangeOfPoint(playerid,5,1959.0842,-1765.3502,13.4750)) // Checkpoint 8
{
SetPlayerCheckpoint(playerid,1975.3130,-1814.8724,13.4751,5);
}
else if(IsPlayerInRangeOfPoint(playerid,5,1975.3130,-1814.8724,13.4751)) // Checkpoint 9
{
SetPlayerCheckpoint(playerid,2066.9341,-1814.9067,13.4751,5);
}
else if(IsPlayerInRangeOfPoint(playerid,5,2066.9341,-1814.9067,13.4751 )) // Checkpoint 10
{
SetPlayerCheckpoint(playerid,2078.9148,-1897.3009,13.4473,5);
}
else if(IsPlayerInRangeOfPoint(playerid,5,2078.9148,-1897.3009,13.4473)) // Checkpoint 11
{
SetPlayerCheckpoint(playerid,2074.2095,-1907.4380,13.6393,5);
}
else if(IsPlayerInRangeOfPoint(playerid,5,2074.2095,-1907.4380,13.6393)) // Checkpoint 12
{
new Float:Health;
GetVehicleHealth(GetPlayerVehicleID(playerid), Health);
if(Health > 900)
{
DisablePlayerCheckpoint(playerid);
PlayerInfo[playerid][pCarLic] = 1;
LicenseTest[playerid] = 0;
CP[playerid] = 0;
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Driving Center: You have successfully passed the test and received your license.");
}
else
{
DisablePlayerCheckpoint(playerid);
LicenseTest[playerid] = 0;
CP[playerid] = 0;
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Driving Center: You have damaged your vehicle hardly, therefore you failed the test.");
}
}
}
else DisablePlayerCheckpoint(playerid);