DMV system problem
#1

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 :

PHP код:
CMD:exam(playeridparams[])
{
// 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;

When the Player enters the DMV car :

PHP код:
public OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
    if(!
ispassenger)
    {
        if(
IsDMVCar(vehicleid))
        {
            if(!
LicenseTest[playerid])
            {
                new 
Float:pos[3];
                
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
                
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
                
SendClientMessage(playeridCOLOR_ORANGE"You are not taking a drivers license test.");
            }
            else
            {
                
SendClientMessage(playeridCOLOR_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(playeridCOLOR_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(playeridCOLOR_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(playeridCOLOR_LIGHTBLUE"* Driving Center: You have damaged your vehicle hardly, therefore you failed the test.");
            }
        }
    }
    else 
DisablePlayerCheckpoint(playerid); 
PLEASE, if anyone could help me solve this, I would appreciate it very much ... Thanks in advance !

Reply
#2

Код:
new OnExam[MAX_PLAYERS];

COMMAND:exam(playerid, params[])
{

    OnExam[playerid] = 1;
}


OnPlayerEnterCheckpoint 
{
If(OnExam[playerid] == 1)
     {
      SetPlayerCheckpoint
      OnExam[playerid] = 2;
      }
else if (OnExam[playerid] == 2)
      {
       SetCP
       OnExam[playerid] = 3;
       }
And so on.

PS i've woten it in phone sorry.
Reply
#3

Thanks. But is there a better way or a way to get my method fixed ??

EDIT: in a second thought, I'm just going to use your suggestion, but I'm going to use a switch instead of the if statements. Thanks again
Reply
#4

Please, I did everything well but it happens again, the same problem when I reach the first Checkpoint nothing happens !

OnPlayerEnterCheckpoint
PHP код:
public OnPlayerEnterCheckpoint(playerid)
{
    switch(
DMVExam[playerid])
    {
        case 
1// DMV SYSTEM CHECKPOINT 1 ( it was set when the player enter the DMV car )
        
{
            
DisablePlayerCheckpoint(playerid);
            
SetPlayerCheckpoint(playerid,1948.1033,-1930.6860,13.4751,5); // 2
            
DMVExam[playerid] = 2;
        }
        case 
2:
        {
            
DisablePlayerCheckpoint(playerid); 
            
SetPlayerCheckpoint(playerid,1830.9167,-1930.0353,13.4754,5); // 3
            
DMVExam[playerid] = 3;
        }
        case 
3:
        {
            
DisablePlayerCheckpoint(playerid);
            
SetPlayerCheckpoint(playerid,1823.9110,-1791.2739,13.4752,5); // 4
            
DMVExam[playerid] = 4;
        }
        case 
4:
        {
            
DisablePlayerCheckpoint(playerid);
            
SetPlayerCheckpoint(playerid,1824.1433,-1629.3223,13.4751,5); // 5
            
DMVExam[playerid] = 5;
        }
        case 
5:
        {
            
DisablePlayerCheckpoint(playerid);
            
SetPlayerCheckpoint(playerid,1929.6962,-1614.7090,13.4751,5); // 6
            
DMVExam[playerid] = 6;
        }
        case 
6:
        {
            
DisablePlayerCheckpoint(playerid);
            
SetPlayerCheckpoint(playerid,1938.9127,-1738.9067,13.4751,5); // 7
            
DMVExam[playerid] = 7;
        }
        case 
7:
        {
            
DisablePlayerCheckpoint(playerid);
            
SetPlayerCheckpoint(playerid,1959.0842,-1765.3502,13.4750,5); // 8
            
DMVExam[playerid] = 8;
        }
        case 
8:
        {
            
DisablePlayerCheckpoint(playerid);
            
SetPlayerCheckpoint(playerid,1975.3130,-1814.8724,13.4751,5); // 9
            
DMVExam[playerid] = 9;
        }
        case 
9:
        {
            
DisablePlayerCheckpoint(playerid);
            
SetPlayerCheckpoint(playerid,2066.9341,-1814.9067,13.4751,5); // 10
            
DMVExam[playerid] = 10;
        }
        case 
10:
        {
            
DisablePlayerCheckpoint(playerid);
            
SetPlayerCheckpoint(playerid,2078.9148,-1897.3009,13.4473,5); // 11
            
DMVExam[playerid] = 11;
        }
        case 
11:
        {
            
DisablePlayerCheckpoint(playerid);
            
SetPlayerCheckpoint(playerid,2074.2095,-1907.4380,13.6393,5); // 12
            
DMVExam[playerid] = 12;
        }
        case 
12:
        {
            new 
Float:Health;
            
GetVehicleHealth(GetPlayerVehicleID(playerid), Health);
            if(
Health 950)
            {
                
DisablePlayerCheckpoint(playerid);
                
PlayerInfo[playerid][pCarLic] = 1;
                
LicenseTest[playerid] = 0;
                
CP2[playerid] = 0;
                
DMVExam[playerid] = 0;
                
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
                
SendClientMessage(playeridCOLOR_LIGHTBLUE"* Driving Center: You have successfully passed the test and received your license.");
            }
            else
            {
                
DisablePlayerCheckpoint(playerid);
                
LicenseTest[playerid] = 0;
                
CP2[playerid] = 0;
                
DMVExam[playerid] = 0;
                
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
                
SendClientMessage(playeridCOLOR_LIGHTBLUE"* Driving Center: You have damaged your vehicle hardly, therefore you failed the test.");
            }
        } 
Please Help me .. REP+ whoever could fix my problem <3
Reply
#5

This is working fine:
PHP код:
new DMVExam[MAX_PLAYERS];
public 
OnPlayerEnterCheckpoint(playerid
{
    switch(
DMVExam[playerid]) 
    { 
        case 
1// DMV SYSTEM CHECKPOINT 1 ( it was set when the player enter the DMV car ) 
        

            
DisablePlayerCheckpoint(playerid);   
            
SetPlayerCheckpoint(playerid,1948.1033,-1930.6860,13.4751,5); // 2 
            
DMVExam[playerid] = 2
        } 
        case 
2
        { 
            
DisablePlayerCheckpoint(playerid);   
            
SetPlayerCheckpoint(playerid,1830.9167,-1930.0353,13.4754,5); // 3 
            
DMVExam[playerid] = 3
        }
        case 
3:
        {
            
DisablePlayerCheckpoint(playerid); 
        }
    }
    return 
1;
}
CMD:test(playeridparams[])
{
    
SetPlayerCheckpoint(playerid,2078.9148,-1897.3009,13.4473,5); 
    
DMVExam[playerid]++;
    return 
1
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)