[Help] Driving test checkpoint
#1

Anyone please help me, i'm newbie.
i was create object for driving test but i didn't know yet how to add checkpoint for driving test,
i want to make flying licenses with same reason after this case finish.

don't make this script please just teach me how to make this script.

help me for
if someone who have driving licenses enter the test car then eject him.
if someone who do not have driving licenses enter the test car then give him that checkpoint.
if the car got damage make it respawn the car, and if player enter last checkpoint (finish that test)car will back, safeplayermoney -5000$ and get car license.
give time from first checkpoint to last checkpoint not for a checkpoint to next checkpoint.

1st checkpoint: -2082.2686,-109.3409,35.1953
2nd checkpoint: -2076.8125,-173.2952,35.1949
3rd checkpoint: -2033.0032,-156.6557,35.1984
4th cp: -2080.2837,-228.4482,35.1951
5th: -2046.7188,-255.5424,35.1953
6th: -2022.4805,-261.8100,35.1954
7th: -2031.8352,-133.2813,35.1449
8th: -2067.3608,-147.7365,35.1953
9th/last checkpoint: -2061.2510,-108.7827,35.1986

I'm so confused how to make that.
correct me if i'm wrong

ss attach
Reply
#2

In this case,
PHP код:
    carlic[0] = AddStaticVehicle(405,-2040.9938,-104.4011,35.0525,89.9623,1,1); // 1st Car Lic
    
carlic[1] = AddStaticVehicle(405,-2040.9857,-107.1175,35.0754,89.2423,1,1); // 2nd
    
carlic[2] = AddStaticVehicle(405,-2040.9625,-109.8366,35.0762,90.3471,1,1); // 3rd
    
carlic[3] = AddStaticVehicle(405,-2040.7599,-112.5689,35.0697,90.2739,1,1); // 4th
    
carlic[4] = AddStaticVehicle(405,-2040.6396,-115.1902,35.0670,89.4729,1,1); // 5th
    
carlic[5] = AddStaticVehicle(405,-2040.8125,-118.0442,35.0744,88.0005,1,1); // Last 
public OnPlayerEnterCheckpoint(playerid)
PHP код:
if(CP[playerid]==2)//dmv_01
{
    if(
IsPlayerInVehicle(playeridcarlic[0]) || IsPlayerInVehicle(playeridcarlic[1]) || IsPlayerInVehicle(playeridcarlic[2]) || IsPlayerInVehicle(playeridcarlic[3]) || IsPlayerInVehicle(playeridcarlic[4]) || IsPlayerInVehicle(playeridcarlic[5]) || IsPlayerInVehicle(playeridcarlic[6]))
    {
        
DisablePlayerCheckpoint(playerid);
        
CP[playerid] = 3;
        
SetPlayerCheckpoint(playerid, -2076.8125,-173.2952,35.19495.0);
    }
    else
    {
        
SendClientMessage(playeridCOLOR_LIGHTBLUE,"DMV: You are not in the car!");
        
SendClientMessage(playeridCOLOR_LIGHTBLUE,"DMV: You didn't passed the test, please try again!");
        
DisablePlayerCheckpoint(playerid);
        
RemovePlayerFromVehicle(playerid);
        
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
        
TakingLesson[playerid] = 0;
    }
}
else if(
CP[playerid]==3)//dmv_02
{
    
DisablePlayerCheckpoint(playerid);
    
CP[playerid] = 4;
    
SetPlayerCheckpoint(playerid, -2033.0032,-156.6557,35.19845.0);
}
else if(
CP[playerid]==4)//dmv_03
{
    
DisablePlayerCheckpoint(playerid);
    
CP[playerid] = 5;
    
SetPlayerCheckpoint(playerid, -2080.2837,-228.4482,35.19515.0);
}
else if(
CP[playerid]==5)//dmv_04
{
    
DisablePlayerCheckpoint(playerid);
    
CP[playerid] = 6;
    
SetPlayerCheckpoint(playerid, -2046.7188,-255.5424,35.19535.0);
}
else if(
CP[playerid]==6)//dmv_05
{
    
DisablePlayerCheckpoint(playerid);
    
CP[playerid] = 7;
    
SetPlayerCheckpoint(playerid, -2022.4805,-261.8100,35.19545.0);
}
else if(
CP[playerid]==7)//dmv_06
{
    
DisablePlayerCheckpoint(playerid);
    
CP[playerid] = 8;
    
SetPlayerCheckpoint(playerid, -2031.8352,-133.2813,35.14495.0);
}
else if(
CP[playerid]==8)//dmv_07
{
    
DisablePlayerCheckpoint(playerid);
    
CP[playerid] = 9;
    
SetPlayerCheckpoint(playerid, -2067.3608,-147.7365,35.19535.0);
}
else if(
CP[playerid]==9)//dmv_08
{
    
DisablePlayerCheckpoint(playerid);
    
CP[playerid] = 10;
    
SetPlayerCheckpoint(playerid, -2061.2510,-108.7827,35.19865.0);
}
else if(
CP[playerid]==10)//dmv_Final
{
    new 
pName[24];
    new 
str[128];
    
SendClientMessage(playeridCOLOR_LIGHTBLUE"You bought a driving License for $5,000");
    
SafeGivePlayerMoney(playerid, - 5000);
    
PlayerInfo[playerid][pCarLic] = 1;
    
format(str128,"DMV: Congratulations %s! You passed the test."pName);
    
SendClientMessage(playeridCOLOR_LIGHTBLUEstr);
    
RemovePlayerFromVehicle(playerid);
    
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
    
DisablePlayerCheckpoint(playerid);

public OnPlayerCommandText(playerid, cmdtext[])
PHP код:
if(strcmp(cmd"/takeexam"true) == 0)
{
    if(
PlayerInfo[playerid][pCarLic] == 0)
    {
        if(
IsPlayerInVehicle(playeridcarlic[0]) || IsPlayerInVehicle(playeridcarlic[1]) || IsPlayerInVehicle(playeridcarlic[2]) || IsPlayerInVehicle(playeridcarlic[3]) || IsPlayerInVehicle(playeridcarlic[4]) || IsPlayerInVehicle(playeridcarlic[5]) || IsPlayerInVehicle(playeridcarlic[6]))
        {
            
TogglePlayerControllable(playerid1);
            
CP[playerid] = 2;
            
SetPlayerCheckpoint(playerid, -2082.2686,-109.3409,35.19534.0);
                   
SendClientMessage(playeridCOLOR_LIGHTBLUE"DMV: Please follow the checkpoints and drive safety!");
            return 
1;
        }
    }    

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
PHP код:
if(IsACarLic(vehicleid))
{
    
format(string,sizeof(string),"You are entering to a %s (%d)   Owner: Licenses Center",vehiclevehicleid);
    
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
    if(
IsPlayerConnected(playerid))
          {
               if(
PlayerInfo[playerid][pPassport] == 0) return SendClientMessage(playeridCOLOR_GREY,"* You need a passport before starting this car!!");
         {
                    if(
PlayerInfo[playerid][pCarLic] == 0)
            {
                if(
GetPlayerMoney(playerid) < 5000)
                {
                             
SendClientMessage(playeridCOLOR_GREY"You don't have enough money for a driving license");
                             return 
1;
                }
                else
                {
                    
SendClientMessage(playeridCOLOR_LIGHTBLUE"Type /TakeExam to start the Drivers License test");
                }
            }
            else
            {
                
SendClientMessage(playeridCOLOR_LIGHTBLUE"You already own a driving license");
                return 
1;
            }
        }
    }

i can't go to next checkpoint when i enter first CP.
i was type /takeexam but when i'm enter the first cp, that's DisablePlayerCheckpoint BUT next Cp not show.
What's wrong with that? please help.
Reply
#3

please help me anyone?
Reply
#4

Use streamer to add more than 1 checkpoint

[Plugin] [REL] Streamer Plugin v2.5.2 R2
Reply
#5

Quote:
Originally Posted by Tanush123
Посмотреть сообщение
Use streamer to add more than 1 checkpoint

[Plugin] [REL] Streamer Plugin v2.5.2 R2
He wants a race sort of thing, he does NOT need a streamer. If he did that, people would go straight to the finishline.

Make an array of the checkpoints.
Create the first one.
Have an array curCP[MAX_PLAYERS] to store the current CP.
When entering a CP, add one to curCP and show the array index [curCP].
Use sizeof() to check when they are at the last CP.
Reply
#6

i was change the CP to curCP, but when i enter CP, the next cp still not show.
this is the script what's wrong with that tell me where's the line that wrong.

http://www.mediafire.com/?657hp558dzhez2p
don't change the script, let me know where's the problem.

or tell me exactly where i must edit the script.
Reply
#7

It's not good to do it like that.

Here's a test GM I wrote in about 5 minutes. I've tested it, works absolutely fine.

http://pastebin.com/XLbKQvfx

Good luck. Let me know if you need any help.
Reply
#8

Thanks a lot !
that's work !!

and now, can you help me for "if the car got damage make it respawn the car"

by the way, how to create circle checkpoint at air? for flying license
Reply
#9

Just change the CP_TYPE to 3.
I will make the respawning when I get home in like 2 hours.
Reply
#10

Okay, it's quite simple. No timers needed. When they enter a checkpoint, use GetVehicleHealth and check if it's lower than x (I would recommend 500 health).
If it is, SetVehiclePos back to the start, and show the first CP again.
Simples.

Also remember to fail them if they die.

Oh and, you should set curCP to 0 when a player starts the race, to ensure it doesn't break.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)