Dmv test system
#1

How to make this work? When you go though the first checkpoint it completes the whole test i want it to make it able to go though the checkpoints one by one. Please help?


pawn Код:
if(DCP[playerid]==200)
    {
        if(IsPlayerInVehicle(playerid, dmv1) || IsPlayerInVehicle(playerid, dmv2) || IsPlayerInVehicle(playerid, dmv3) || IsPlayerInVehicle(playerid, dmv4) || IsPlayerInVehicle(playerid, dmv5))
        {
            DisablePlayerCheckpoint(playerid);
            DCP[playerid] = 201;
            SetPlayerCheckpoint(playerid, 2073.780029,-1912.620361,13.244957, 5.0);
        }
        else
        {
            SendClientMessage(playerid, COLOR_LIGHTBLUE,"DMV: You are not in the car!");
            SendClientMessage(playerid, COLOR_LIGHTBLUE,"DMV: You didn't passed the test, please try again!");
            DisablePlayerCheckpoint(playerid);
            RemovePlayerFromVehicle(playerid);
            SetVehicleToRespawn(GetPlayerVehicleID(playerid));
            TakingLesson[playerid] = 0;
        }
        if(DCP[playerid]==201)
        {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "Driver Instructor says: Always drive on the Right side of the road!");
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 202;
                SetPlayerCheckpoint(playerid, 2079.123291,-1871.586303,13.048537, 5.0);
        }
        if(DCP[playerid]==202)
        {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "Driver Instructor says: Never drink and drive!");
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 203;
                SetPlayerCheckpoint(playerid, 2079.742431,-1802.388427,13.081876, 5.0);
        }
        if(DCP[playerid]==203)
        {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "Driver Instructor says: Pedestrians always have the right of way!");
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 204;
                SetPlayerCheckpoint(playerid, 2087.171142,-1763.789306,13.093797, 5.0);
        }
        if(DCP[playerid]==204)
        {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "Driver Instructor says: Pull over to the side of the road for emergency vehicles!");
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 205;
                SetPlayerCheckpoint(playerid,2107.624023,-1750.020996,13.089978, 5.0);
        }
        if(DCP[playerid]==205)
        {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "Driver Instructor says: Never use your phone while driving!");
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 206;
                SetPlayerCheckpoint(playerid, 2152.177490,-1750.022827,13.082652, 5.0);
        }
        if(DCP[playerid]==206)
        {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "Driver Instructor says: National speed limit is 97 km/h (60 mph)!");
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 207;
                SetPlayerCheckpoint(playerid, 2182.246826,-1718.454956,13.037333, 5.0);
        }
        if(DCP[playerid]==207)
        {
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 208;
                SetPlayerCheckpoint(playerid, 2196.131347,-1639.325927,15.037650, 5.0);
        }
        if(DCP[playerid]==208)
        {
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 209;
                SetPlayerCheckpoint(playerid, 2210.470458,-1516.888671,23.5245725, 5.0);
        }
        if(DCP[playerid]==209)
        {
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 210;
                SetPlayerCheckpoint(playerid, 2210.367919,-1396.513427,23.513124, 5.0);
        }
        if(DCP[playerid]==210)
        {
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 211;
                SetPlayerCheckpoint(playerid, 2189.148681,-1387.298950,23.506103, 5.0);
        }
        if(DCP[playerid]==211)
        {
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 212;
                SetPlayerCheckpoint(playerid,2125.980468,-1386.713378,23.509986, 5.0);
        }
        if(DCP[playerid]==212)
        {
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 213;
                SetPlayerCheckpoint(playerid, 2115.220947,-1404.61699,23.521949, 5.0);
        }
        if(DCP[playerid]==213)
        {
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 214;
                SetPlayerCheckpoint(playerid, 2115.123779,-1505.220458,23.473100, 5.0);
        }
        if(DCP[playerid]==214)
        {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "Driver Instructor says: Never get distracted while driving!");
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 215;
                SetPlayerCheckpoint(playerid,2114.831298,-1676.845214,13.123315, 5.0);
        }
        if(DCP[playerid]==215)
        {
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 217;
                SetPlayerCheckpoint(playerid, 2098.753906,-1739.837768,13.085525, 5.0);
        }
        if(DCP[playerid]==217)
        {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "Driver Instructor says: Stop at intersections for atleast 3s!");
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 218;
                SetPlayerCheckpoint(playerid,2084.242431,-1822.566650,13.074979 , 5.0);
        }
        if(DCP[playerid]==218)
        {
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 219;
                SetPlayerCheckpoint(playerid, 2084.016845,-1890.064941,13.066734, 5.0);
        }
        if(DCP[playerid]==219)
        {
                new pName[24];
                new str[128];
                GetPlayerName(playerid, pName, 24);
                pName[strfind(pName,"_")] = ' ';
                GivePlayerCash(playerid, -500);
                format(str, 128,"DMV: Congratulations %s! You passed the test.", pName);
                SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
                RemovePlayerFromVehicle(playerid);
                SetVehicleToRespawn(GetPlayerVehicleID(playerid));
                TakingLesson[playerid] = 0;
                PlayerInfo[playerid][pCarLic] = 1;
                DisablePlayerCheckpoint(playerid);
        }
        else
        {
        DisablePlayerCheckpoint(playerid);
        }
        return 1;
    }
Reply
#2

After the first "if" make all "if"s a "elseif"
Like
pawn Код:
if(hey)
{
    return 1;
}
else if(hey)
{
      // etc //etc..
}
else if(lol)
{
       // etc // etc
}
>>>>>EDIT<<<<<<: make ALL of them else if , not just one , except the first one
Reply
#3

I tired that and when i go though the seconed check point it does not show third
Reply
#4

Errors

C:\Users\Itzgamecast\Desktop\UVRP SCRIPT\gamemodes\UGRP [NEW].pwn(1364 : error 029: invalid expression, assumed zero
C:\Users\Itzgamecast\Desktop\UVRP SCRIPT\gamemodes\UGRP [NEW].pwn(1364 : warning 215: expression has no effect
C:\Users\Itzgamecast\Desktop\UVRP SCRIPT\gamemodes\UGRP [NEW].pwn(1364 : error 001: expected token: ";", but found "if"


pawn Код:
if(DCP[playerid]==200)
    {
        if(IsPlayerInVehicle(playerid, dmv1) || IsPlayerInVehicle(playerid, dmv2) || IsPlayerInVehicle(playerid, dmv3) || IsPlayerInVehicle(playerid, dmv4) || IsPlayerInVehicle(playerid, dmv5))
        {
            DisablePlayerCheckpoint(playerid);
            DCP[playerid] = 201;
            SetPlayerCheckpoint(playerid, 2073.780029,-1912.620361,13.244957, 5.0);
        }
        else
        {
            SendClientMessage(playerid, COLOR_LIGHTBLUE,"DMV: You are not in the car!");
            SendClientMessage(playerid, COLOR_LIGHTBLUE,"DMV: You didn't passed the test, please try again!");
            DisablePlayerCheckpoint(playerid);
            RemovePlayerFromVehicle(playerid);
            SetVehicleToRespawn(GetPlayerVehicleID(playerid));
            TakingLesson[playerid] = 0;
        }
        This line >>>>>>>>else if(DCP[playerid]==201)
        {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "Driver Instructor says: Always drive on the Right side of the road!");
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 202;
                SetPlayerCheckpoint(playerid, 2079.123291,-1871.586303,13.048537, 5.0);
        }
        else if(DCP[playerid]==202)
        {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "Driver Instructor says: Never drink and drive!");
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 203;
                SetPlayerCheckpoint(playerid, 2079.742431,-1802.388427,13.081876, 5.0);
        }
Reply
#5

You made it incorrect..
pawn Код:
if(DCP[playerid] == 200)
        {
            if(IsPlayerInVehicle(playerid, dmv1) || IsPlayerInVehicle(playerid, dmv2) || IsPlayerInVehicle(playerid, dmv3) || IsPlayerInVehicle(playerid, dmv4) || IsPlayerInVehicle(playerid, dmv5))
            {
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 201;
                SetPlayerCheckpoint(playerid, 2073.780029,-1912.620361,13.244957, 5.0);
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTBLUE,"DMV: You are not in the car!");
                SendClientMessage(playerid, COLOR_LIGHTBLUE,"DMV: You didn't passed the test, please try again!");
                DisablePlayerCheckpoint(playerid);
                RemovePlayerFromVehicle(playerid);
                SetVehicleToRespawn(GetPlayerVehicleID(playerid));
                TakingLesson[playerid] = 0;
            }
        }
        else if(DCP[playerid] == 300)
        {
            return 1;
        }
Reply
#6

Where you get dcp 300 from?
Reply
#7

Try "return 1;" at the end of every if?
Reply
#8

Just if or else if, Could you do it for me on this code


pawn Код:
if(DCP[playerid]==200)
    {
        if(IsPlayerInVehicle(playerid, dmv1) || IsPlayerInVehicle(playerid, dmv2) || IsPlayerInVehicle(playerid, dmv3) || IsPlayerInVehicle(playerid, dmv4) || IsPlayerInVehicle(playerid, dmv5))
        {
            DisablePlayerCheckpoint(playerid);
            DCP[playerid] = 201;
            SetPlayerCheckpoint(playerid, 2073.780029,-1912.620361,13.244957, 5.0);
        }
        else
        {
            SendClientMessage(playerid, COLOR_LIGHTBLUE,"DMV: You are not in the car!");
            SendClientMessage(playerid, COLOR_LIGHTBLUE,"DMV: You didn't passed the test, please try again!");
            DisablePlayerCheckpoint(playerid);
            RemovePlayerFromVehicle(playerid);
            SetVehicleToRespawn(GetPlayerVehicleID(playerid));
            TakingLesson[playerid] = 0;
        }
        else if(DCP[playerid]==201)
        {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "Driver Instructor says: Always drive on the Right side of the road!");
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 202;
                SetPlayerCheckpoint(playerid, 2079.123291,-1871.586303,13.048537, 5.0);
        }
        else if(DCP[playerid]==202)
        {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "Driver Instructor says: Never drink and drive!");
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 203;
                SetPlayerCheckpoint(playerid, 2079.742431,-1802.388427,13.081876, 5.0);
        }
        else if(DCP[playerid]==203)
        {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "Driver Instructor says: Pedestrians always have the right of way!");
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 204;
                SetPlayerCheckpoint(playerid, 2087.171142,-1763.789306,13.093797, 5.0);
        }
        else if(DCP[playerid]==204)
        {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "Driver Instructor says: Pull over to the side of the road for emergency vehicles!");
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 205;
                SetPlayerCheckpoint(playerid,2107.624023,-1750.020996,13.089978, 5.0);
        }
        else if(DCP[playerid]==205)
        {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "Driver Instructor says: Never use your phone while driving!");
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 206;
                SetPlayerCheckpoint(playerid, 2152.177490,-1750.022827,13.082652, 5.0);
        }
        else if(DCP[playerid]==206)
        {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "Driver Instructor says: National speed limit is 97 km/h (60 mph)!");
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 207;
                SetPlayerCheckpoint(playerid, 2182.246826,-1718.454956,13.037333, 5.0);
        }
        else if(DCP[playerid]==207)
        {
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 208;
                SetPlayerCheckpoint(playerid, 2196.131347,-1639.325927,15.037650, 5.0);
        }
        else if(DCP[playerid]==208)
        {
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 209;
                SetPlayerCheckpoint(playerid, 2210.470458,-1516.888671,23.5245725, 5.0);
        }
        else if(DCP[playerid]==209)
        {
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 210;
                SetPlayerCheckpoint(playerid, 2210.367919,-1396.513427,23.513124, 5.0);
        }
        else if(DCP[playerid]==210)
        {
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 211;
                SetPlayerCheckpoint(playerid, 2189.148681,-1387.298950,23.506103, 5.0);
        }
        else if(DCP[playerid]==211)
        {
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 212;
                SetPlayerCheckpoint(playerid,2125.980468,-1386.713378,23.509986, 5.0);
        }
        else if(DCP[playerid]==212)
        {
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 213;
                SetPlayerCheckpoint(playerid, 2115.220947,-1404.61699,23.521949, 5.0);
        }
        else if(DCP[playerid]==213)
        {
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 214;
                SetPlayerCheckpoint(playerid, 2115.123779,-1505.220458,23.473100, 5.0);
        }
        else if(DCP[playerid]==214)
        {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "Driver Instructor says: Never get distracted while driving!");
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 215;
                SetPlayerCheckpoint(playerid,2114.831298,-1676.845214,13.123315, 5.0);
        }
        else if(DCP[playerid]==215)
        {
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 217;
                SetPlayerCheckpoint(playerid, 2098.753906,-1739.837768,13.085525, 5.0);
        }
        else if(DCP[playerid]==217)
        {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "Driver Instructor says: Stop at intersections for atleast 3s!");
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 218;
                SetPlayerCheckpoint(playerid,2084.242431,-1822.566650,13.074979 , 5.0);
        }
        else if(DCP[playerid]==218)
        {
                DisablePlayerCheckpoint(playerid);
                DCP[playerid] = 219;
                SetPlayerCheckpoint(playerid, 2084.016845,-1890.064941,13.066734, 5.0);
        }
        else if(DCP[playerid]==219)
        {
                new pName[24];
                new str[128];
                GetPlayerName(playerid, pName, 24);
                pName[strfind(pName,"_")] = ' ';
                GivePlayerCash(playerid, -500);
                format(str, 128,"DMV: Congratulations %s! You passed the test.", pName);
                SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
                RemovePlayerFromVehicle(playerid);
                SetVehicleToRespawn(GetPlayerVehicleID(playerid));
                TakingLesson[playerid] = 0;
                PlayerInfo[playerid][pCarLic] = 1;
                DisablePlayerCheckpoint(playerid);
        }
        else
        {
        DisablePlayerCheckpoint(playerid);
        }
        return 1;
    }
Reply
#9

Try this . pretty sure I fixed it
Код:
	if(DCP[playerid]==200)
	{
		if(IsPlayerInVehicle(playerid, dmv1) || IsPlayerInVehicle(playerid, dmv2) || IsPlayerInVehicle(playerid, dmv3) || IsPlayerInVehicle(playerid, dmv4) || IsPlayerInVehicle(playerid, dmv5))
		{
			DisablePlayerCheckpoint(playerid);
			DCP[playerid] = 201;
			SetPlayerCheckpoint(playerid, 2073.780029,-1912.620361,13.244957, 5.0);
		}
		else
		{
			SendClientMessage(playerid, COLOR_LIGHTBLUE,"DMV: You are not in the car!");
			SendClientMessage(playerid, COLOR_LIGHTBLUE,"DMV: You didn't passed the test, please try again!");
			DisablePlayerCheckpoint(playerid);
			RemovePlayerFromVehicle(playerid);
			SetVehicleToRespawn(GetPlayerVehicleID(playerid));
			TakingLesson[playerid] = 0;
		}
	}
	else if(DCP[playerid]==201)
	{
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "Driver Instructor says: Always drive on the Right side of the road!");
		DisablePlayerCheckpoint(playerid);
		DCP[playerid] = 202;
		SetPlayerCheckpoint(playerid, 2079.123291,-1871.586303,13.048537, 5.0);
	}
	else if(DCP[playerid]==202)
	{
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "Driver Instructor says: Never drink and drive!");
		DisablePlayerCheckpoint(playerid);
		DCP[playerid] = 203;
		SetPlayerCheckpoint(playerid, 2079.742431,-1802.388427,13.081876, 5.0);
	}
	else if(DCP[playerid]==203)
	{
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "Driver Instructor says: Pedestrians always have the right of way!");
		DisablePlayerCheckpoint(playerid);
		DCP[playerid] = 204;
		SetPlayerCheckpoint(playerid, 2087.171142,-1763.789306,13.093797, 5.0);
	}
	else if(DCP[playerid]==204)
	{
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "Driver Instructor says: Pull over to the side of the road for emergency vehicles!");
		DisablePlayerCheckpoint(playerid);
		DCP[playerid] = 205;
		SetPlayerCheckpoint(playerid,2107.624023,-1750.020996,13.089978, 5.0);
	}
	else if(DCP[playerid]==205)
	{
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "Driver Instructor says: Never use your phone while driving!");
		DisablePlayerCheckpoint(playerid);
		DCP[playerid] = 206;
		SetPlayerCheckpoint(playerid, 2152.177490,-1750.022827,13.082652, 5.0);
	}
	else if(DCP[playerid]==206)
	{
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "Driver Instructor says: National speed limit is 97 km/h (60 mph)!");
		DisablePlayerCheckpoint(playerid);
		DCP[playerid] = 207;
		SetPlayerCheckpoint(playerid, 2182.246826,-1718.454956,13.037333, 5.0);
	}
	else if(DCP[playerid]==207)
	{
		DisablePlayerCheckpoint(playerid);
		DCP[playerid] = 208;
		SetPlayerCheckpoint(playerid, 2196.131347,-1639.325927,15.037650, 5.0);
	}
	else if(DCP[playerid]==208)
	{
		DisablePlayerCheckpoint(playerid);
		DCP[playerid] = 209;
		SetPlayerCheckpoint(playerid, 2210.470458,-1516.888671,23.5245725, 5.0);
	}
	else if(DCP[playerid]==209)
	{
		DisablePlayerCheckpoint(playerid);
		DCP[playerid] = 210;
		SetPlayerCheckpoint(playerid, 2210.367919,-1396.513427,23.513124, 5.0);
	}
	else if(DCP[playerid]==210)
	{
		DisablePlayerCheckpoint(playerid);
		DCP[playerid] = 211;
		SetPlayerCheckpoint(playerid, 2189.148681,-1387.298950,23.506103, 5.0);
	}
	else if(DCP[playerid]==211)
	{
		DisablePlayerCheckpoint(playerid);
		DCP[playerid] = 212;
		SetPlayerCheckpoint(playerid,2125.980468,-1386.713378,23.509986, 5.0);
	}
	else if(DCP[playerid]==212)
	{
		DisablePlayerCheckpoint(playerid);
		DCP[playerid] = 213;
		SetPlayerCheckpoint(playerid, 2115.220947,-1404.61699,23.521949, 5.0);
	}
	else if(DCP[playerid]==213)
	{
		DisablePlayerCheckpoint(playerid);
		DCP[playerid] = 214;
		SetPlayerCheckpoint(playerid, 2115.123779,-1505.220458,23.473100, 5.0);
	}
	else if(DCP[playerid]==214)
	{
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "Driver Instructor says: Never get distracted while driving!");
		DisablePlayerCheckpoint(playerid);
		DCP[playerid] = 215;
		SetPlayerCheckpoint(playerid,2114.831298,-1676.845214,13.123315, 5.0);
	}
	else if(DCP[playerid]==215)
	{
		DisablePlayerCheckpoint(playerid);
		DCP[playerid] = 217;
		SetPlayerCheckpoint(playerid, 2098.753906,-1739.837768,13.085525, 5.0);
	}
	else if(DCP[playerid]==217)
	{
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "Driver Instructor says: Stop at intersections for atleast 3s!");
		DisablePlayerCheckpoint(playerid);
		DCP[playerid] = 218;
		SetPlayerCheckpoint(playerid,2084.242431,-1822.566650,13.074979 , 5.0);
	}
	else if(DCP[playerid]==218)
	{
		DisablePlayerCheckpoint(playerid);
		DCP[playerid] = 219;
		SetPlayerCheckpoint(playerid, 2084.016845,-1890.064941,13.066734, 5.0);
	}
	else if(DCP[playerid]==219)
	{
		new pName[24];
		new str[128];
		GetPlayerName(playerid, pName, 24);
		pName[strfind(pName,"_")] = ' ';
		GivePlayerCash(playerid, -500);
		format(str, 128,"DMV: Congratulations %s! You passed the test.", pName);
		SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
		RemovePlayerFromVehicle(playerid);
		SetVehicleToRespawn(GetPlayerVehicleID(playerid));
		TakingLesson[playerid] = 0;
		PlayerInfo[playerid][pCarLic] = 1;
		DisablePlayerCheckpoint(playerid);
	}
	else
	{
		DisablePlayerCheckpoint(playerid);
	}
	return 1;
}
Reply
#10

Crashes my pawno
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)