Problem with else if and truck license system
#1

Код:
C:\Users\Liam Leonard\Desktop\UVRP SCRIPT\gamemodes\UGRP.pwn(13650) : error 029: invalid expression, assumed zero
C:\Users\Liam Leonard\Desktop\UVRP SCRIPT\gamemodes\UGRP.pwn(13650) : warning 215: expression has no effect
C:\Users\Liam Leonard\Desktop\UVRP SCRIPT\gamemodes\UGRP.pwn(13650) : error 001: expected token: ";", but found "if"
Код:
 	if(CP[playerid]==200)
 	{
     	{
			new carid = GetPlayerVehicleID(playerid);
			if(IsTruckerDMV(carid))
   				{
      				 DisablePlayerCheckpoint(playerid);
 	       			 CP[playerid] = 201;
 	       			 SendClientMessage(playerid, COLOR_LIGHTGREEN,"Driveing instructor: You must drive on the right side of the road!");
				}
    			else
       			{
       	             SendClientMessage(playerid, COLOR_LIGHTBLUE,"DMV: You are not in the test truck!");
       	             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(CP[playerid]==201)
	        {
	            DisablePlayerCheckpoint(playerid);
	                CP[playerid] = 202;
	                SetPlayerCheckpoint(playerid, 1752.3639,-1658.2120,13.1464, 5.0);
	        }
	        else if(CP[playerid]==202)
	        {
	            DisablePlayerCheckpoint(playerid);
	                CP[playerid] = 203;
	                SetPlayerCheckpoint(playerid, 1736.7103,-1595.6973,13.1432, 5.0);
	        }
	        else if(CP[playerid]==203)
	        {
	            DisablePlayerCheckpoint(playerid);
	                CP[playerid] = 204;
	                SetPlayerCheckpoint(playerid, 1687.8896,-1590.0183,13.1437, 5.0);
	        }
	        else if(CP[playerid]==204)
	        {
	            DisablePlayerCheckpoint(playerid);
	                CP[playerid] = 205;
	                SetPlayerCheckpoint(playerid,1659.9729,-1576.3081,13.1554, 5.0);
	        }
	        else if(CP[playerid]==205)
	        {
	            DisablePlayerCheckpoint(playerid);
	                CP[playerid] = 206;
	                SetPlayerCheckpoint(playerid, 1671.7783,-1550.3525,13.1477, 5.0);
	        }
	        else if(CP[playerid]==206)
	        {
	            DisablePlayerCheckpoint(playerid);
	                CP[playerid] = 207;
	                SetPlayerCheckpoint(playerid, 1703.8721,-1529.2175,13.1462, 5.0);
	        }
	        else if(CP[playerid]==207)
	        {
	            DisablePlayerCheckpoint(playerid);
	                CP[playerid] = 208;
	                SetPlayerCheckpoint(playerid, 1703.7292,-1494.8180,13.1478, 5.0);
	        }
	        else if(CP[playerid]==208)
	        {
	            DisablePlayerCheckpoint(playerid);
	                CP[playerid] = 209;
	                SetPlayerCheckpoint(playerid, 1685.5736,-1477.3523,13.1478, 5.0);
	        }
	        else if(CP[playerid]==209)
	        {
	            DisablePlayerCheckpoint(playerid);
	                CP[playerid] = 210;
	                SetPlayerCheckpoint(playerid, 1660.1571,-1463.7006,13.1488, 5.0);
	        }
	        else if(CP[playerid]==210)
	        {
	            DisablePlayerCheckpoint(playerid);
	                CP[playerid] = 211;
	                SetPlayerCheckpoint(playerid, 1670.6409,-1443.4304,13.1478, 5.0);
	        }
	        else if(CP[playerid]==211)
	        {
	            DisablePlayerCheckpoint(playerid);
	                CP[playerid] = 212;
	                SetPlayerCheckpoint(playerid,1724.5146,-1443.2325,13.1419, 5.0);
	        }
	        else if(CP[playerid]==212)
	        {
	            DisablePlayerCheckpoint(playerid);
	                CP[playerid] = 213;
	                SetPlayerCheckpoint(playerid, 1792.2803,-1457.1416,13.1310, 5.0);
	        }
	        else if(CP[playerid]==213)
	        {
	                DisablePlayerCheckpoint(playerid);
	                CP[playerid] = 214;
	                SetPlayerCheckpoint(playerid, 1830.5924,-1462.6305,13.1340, 5.0);
	        }
	        else if(CP[playerid]==214)
	        {
	            DisablePlayerCheckpoint(playerid);
	                CP[playerid] = 215;
	                SetPlayerCheckpoint(playerid,1843.9456,-1485.2588,13.1320, 5.0);
	        }
	        else if(CP[playerid]==215)
	        {
	            DisablePlayerCheckpoint(playerid);
	                CP[playerid] = 217;
	                SetPlayerCheckpoint(playerid, 1825.9863,-1555.5261,13.1349, 5.0);
	        }
	        else if(CP[playerid]==217)
	        {
	            DisablePlayerCheckpoint(playerid);
	                CP[playerid] = 218;
	                SetPlayerCheckpoint(playerid,1819.1287,-1610.5667,13.1455 , 5.0);
	        }
	        else if(CP[playerid]==218)
	        {
	            DisablePlayerCheckpoint(playerid);
	                CP[playerid] = 219;
	                SetPlayerCheckpoint(playerid, 1819.4927,-1678.5614,13.1476, 5.0);
	        }
	        else if(CP[playerid]==219)
	        {
	            DisablePlayerCheckpoint(playerid);
	                CP[playerid] = 220;
	                SetPlayerCheckpoint(playerid, 1819.3573,-1718.8311,13.1460, 5.0);
	        }
	        else if(CP[playerid]==220)
	        {
	            DisablePlayerCheckpoint(playerid);
	                CP[playerid] = 221;
	                SetPlayerCheckpoint(playerid, 1809.9911,-1730.2688,13.1540, 5.0);
	        }
	        else if(CP[playerid]==221)
	        {
	            DisablePlayerCheckpoint(playerid);
	                CP[playerid] = 222;
	                SetPlayerCheckpoint(playerid, 1803.1420,-1718.2678,13.2990, 5.0);
	        }
	        else if(CP[playerid]==222)
	        {
	                new pName[24];
	                new str[128];
	                GetPlayerName(playerid, pName, 24);
	                GivePlayerCash(playerid, -3500);
	                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][pTruckLic] = 1;
	                DisablePlayerCheckpoint(playerid);
	        }
	        else
	        {
	        DisablePlayerCheckpoint(playerid);
	        }
	        return 1;
	}

I fixed this before by removing all the else but then when i went in game and drove to the first check point it would give me my truck license insted if showing next checkpoint any help would be nice thanks
Reply
#2

Precise line ?
Reply
#3

Quote:
Originally Posted by Chipardeur
Посмотреть сообщение
Precise line ?
else if(CP[playerid]==201)
Reply
#4

pawn Код:
if(CP[playerid]==200)
{
    new carid = GetPlayerVehicleID(playerid);
    if(IsTruckerDMV(carid))
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 201;
        SendClientMessage(playerid, COLOR_LIGHTGREEN,"Driveing instructor: You must drive on the right side of the road!");
    }
    else
    {
        SendClientMessage(playerid, COLOR_LIGHTBLUE,"DMV: You are not in the test truck!");
        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(CP[playerid]==201)
{
    DisablePlayerCheckpoint(playerid);
    CP[playerid] = 202;
    SetPlayerCheckpoint(playerid, 1752.3639,-1658.2120,13.1464, 5.0);
}
else if(CP[playerid]==202)
{
    DisablePlayerCheckpoint(playerid);
    CP[playerid] = 203;
    SetPlayerCheckpoint(playerid, 1736.7103,-1595.6973,13.1432, 5.0);
}
else if(CP[playerid]==203)
{
    DisablePlayerCheckpoint(playerid);
    CP[playerid] = 204;
    SetPlayerCheckpoint(playerid, 1687.8896,-1590.0183,13.1437, 5.0);
}
else if(CP[playerid]==204)
{
    DisablePlayerCheckpoint(playerid);
    CP[playerid] = 205;
    SetPlayerCheckpoint(playerid,1659.9729,-1576.3081,13.1554, 5.0);
}
else if(CP[playerid]==205)
{
    DisablePlayerCheckpoint(playerid);
    CP[playerid] = 206;
    SetPlayerCheckpoint(playerid, 1671.7783,-1550.3525,13.1477, 5.0);
}
else if(CP[playerid]==206)
{
    DisablePlayerCheckpoint(playerid);
    CP[playerid] = 207;
    SetPlayerCheckpoint(playerid, 1703.8721,-1529.2175,13.1462, 5.0);
}
else if(CP[playerid]==207)
{
    DisablePlayerCheckpoint(playerid);
    CP[playerid] = 208;
    SetPlayerCheckpoint(playerid, 1703.7292,-1494.8180,13.1478, 5.0);
}
else if(CP[playerid]==208)
{
    DisablePlayerCheckpoint(playerid);
    CP[playerid] = 209;
    SetPlayerCheckpoint(playerid, 1685.5736,-1477.3523,13.1478, 5.0);
}
else if(CP[playerid]==209)
{
    DisablePlayerCheckpoint(playerid);
    CP[playerid] = 210;
    SetPlayerCheckpoint(playerid, 1660.1571,-1463.7006,13.1488, 5.0);
}
else if(CP[playerid]==210)
{
    DisablePlayerCheckpoint(playerid);
    CP[playerid] = 211;
    SetPlayerCheckpoint(playerid, 1670.6409,-1443.4304,13.1478, 5.0);
}
else if(CP[playerid]==211)
{
    DisablePlayerCheckpoint(playerid);
    CP[playerid] = 212;
    SetPlayerCheckpoint(playerid,1724.5146,-1443.2325,13.1419, 5.0);
}
else if(CP[playerid]==212)
{
    DisablePlayerCheckpoint(playerid);
    CP[playerid] = 213;
    SetPlayerCheckpoint(playerid, 1792.2803,-1457.1416,13.1310, 5.0);
}
else if(CP[playerid]==213)
{
    DisablePlayerCheckpoint(playerid);
    CP[playerid] = 214;
    SetPlayerCheckpoint(playerid, 1830.5924,-1462.6305,13.1340, 5.0);
}
else if(CP[playerid]==214)
{
    DisablePlayerCheckpoint(playerid);
    CP[playerid] = 215;
    SetPlayerCheckpoint(playerid,1843.9456,-1485.2588,13.1320, 5.0);
}
else if(CP[playerid]==215)
{
    DisablePlayerCheckpoint(playerid);
    CP[playerid] = 217;
    SetPlayerCheckpoint(playerid, 1825.9863,-1555.5261,13.1349, 5.0);
}
else if(CP[playerid]==217)
{
    DisablePlayerCheckpoint(playerid);
    CP[playerid] = 218;
    SetPlayerCheckpoint(playerid,1819.1287,-1610.5667,13.1455 , 5.0);
}
else if(CP[playerid]==218)
{
    DisablePlayerCheckpoint(playerid);
    CP[playerid] = 219;
    SetPlayerCheckpoint(playerid, 1819.4927,-1678.5614,13.1476, 5.0);
}
else if(CP[playerid]==219)
{
    DisablePlayerCheckpoint(playerid);
    CP[playerid] = 220;
    SetPlayerCheckpoint(playerid, 1819.3573,-1718.8311,13.1460, 5.0);
}
else if(CP[playerid]==220)
{
    DisablePlayerCheckpoint(playerid);
    CP[playerid] = 221;
    SetPlayerCheckpoint(playerid, 1809.9911,-1730.2688,13.1540, 5.0);
}
else if(CP[playerid]==221)
{
    DisablePlayerCheckpoint(playerid);
    CP[playerid] = 222;
    SetPlayerCheckpoint(playerid, 1803.1420,-1718.2678,13.2990, 5.0);
}
else if(CP[playerid]==222)
{
    new pName[24];
    new str[128];
    GetPlayerName(playerid, pName, 24);
    GivePlayerCash(playerid, -3500);
    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][pTruckLic] = 1;
    DisablePlayerCheckpoint(playerid);
}
else
{
    DisablePlayerCheckpoint(playerid);
}
return 1;
Try that.
Reply
#5

Sorry but that did not work it crashed my pawno
Reply
#6

Can any one help me please really need this asap
Reply
#7

Anyone?
Reply
#8

Could you please show me the line you are getting error in the code you gave also, you pawno crashes if you get too many errors. Make sure you have CP[MAX_PLAYERS]; at the top of your script.
Reply
#9

Quote:
Originally Posted by Imperor
Посмотреть сообщение
Could you please show me the line you are getting error in the code you gave also, you pawno crashes if you get too many errors. Make sure you have CP[MAX_PLAYERS]; at the top of your script.
Here is the line i am getting the error on

else if(CP[playerid]==201)
Reply
#10

Make sure you have CP[MAX_PLAYERS]; at the top of your script.
Then, add this code below.
pawn Код:
if(CP[playerid]==200)
        {
            new carid = GetPlayerVehicleID(playerid);
            if(IsTruckerDMV(carid))
                {
                     DisablePlayerCheckpoint(playerid);
                     CP[playerid] = 201;
                     SendClientMessage(playerid, COLOR_LIGHTGREEN,"Driveing instructor: You must drive on the right side of the road!");
                }
                else
                {
                     SendClientMessage(playerid, COLOR_LIGHTBLUE,"DMV: You are not in the test truck!");
                     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(CP[playerid]==201)
            {
                DisablePlayerCheckpoint(playerid);
                    CP[playerid] = 202;
                    SetPlayerCheckpoint(playerid, 1752.3639,-1658.2120,13.1464, 5.0);
            }
            if(CP[playerid]==202)
            {
                DisablePlayerCheckpoint(playerid);
                    CP[playerid] = 203;
                    SetPlayerCheckpoint(playerid, 1736.7103,-1595.6973,13.1432, 5.0);
            }
            f(CP[playerid]==203)
            {
                DisablePlayerCheckpoint(playerid);
                    CP[playerid] = 204;
                    SetPlayerCheckpoint(playerid, 1687.8896,-1590.0183,13.1437, 5.0);
            }
            if(CP[playerid]==204)
            {
                DisablePlayerCheckpoint(playerid);
                    CP[playerid] = 205;
                    SetPlayerCheckpoint(playerid,1659.9729,-1576.3081,13.1554, 5.0);
            }
            if(CP[playerid]==205)
            {
                DisablePlayerCheckpoint(playerid);
                    CP[playerid] = 206;
                    SetPlayerCheckpoint(playerid, 1671.7783,-1550.3525,13.1477, 5.0);
            }
            if(CP[playerid]==206)
            {
                DisablePlayerCheckpoint(playerid);
                    CP[playerid] = 207;
                    SetPlayerCheckpoint(playerid, 1703.8721,-1529.2175,13.1462, 5.0);
            }
            if(CP[playerid]==207)
            {
                DisablePlayerCheckpoint(playerid);
                    CP[playerid] = 208;
                    SetPlayerCheckpoint(playerid, 1703.7292,-1494.8180,13.1478, 5.0);
            }
            if(CP[playerid]==208)
            {
                DisablePlayerCheckpoint(playerid);
                    CP[playerid] = 209;
                    SetPlayerCheckpoint(playerid, 1685.5736,-1477.3523,13.1478, 5.0);
            }
            if(CP[playerid]==209)
            {
                DisablePlayerCheckpoint(playerid);
                    CP[playerid] = 210;
                    SetPlayerCheckpoint(playerid, 1660.1571,-1463.7006,13.1488, 5.0);
            }
            if(CP[playerid]==210)
            {
                DisablePlayerCheckpoint(playerid);
                    CP[playerid] = 211;
                    SetPlayerCheckpoint(playerid, 1670.6409,-1443.4304,13.1478, 5.0);
            }
            if(CP[playerid]==211)
            {
                DisablePlayerCheckpoint(playerid);
                    CP[playerid] = 212;
                    SetPlayerCheckpoint(playerid,1724.5146,-1443.2325,13.1419, 5.0);
            }
            if(CP[playerid]==212)
            {
                DisablePlayerCheckpoint(playerid);
                    CP[playerid] = 213;
                    SetPlayerCheckpoint(playerid, 1792.2803,-1457.1416,13.1310, 5.0);
            }
            if(CP[playerid]==213)
            {
                    DisablePlayerCheckpoint(playerid);
                    CP[playerid] = 214;
                    SetPlayerCheckpoint(playerid, 1830.5924,-1462.6305,13.1340, 5.0);
            }
            if(CP[playerid]==214)
            {
                DisablePlayerCheckpoint(playerid);
                    CP[playerid] = 215;
                    SetPlayerCheckpoint(playerid,1843.9456,-1485.2588,13.1320, 5.0);
            }
            if(CP[playerid]==215)
            {
                DisablePlayerCheckpoint(playerid);
                    CP[playerid] = 217;
                    SetPlayerCheckpoint(playerid, 1825.9863,-1555.5261,13.1349, 5.0);
            }
            if(CP[playerid]==217)
            {
                DisablePlayerCheckpoint(playerid);
                    CP[playerid] = 218;
                    SetPlayerCheckpoint(playerid,1819.1287,-1610.5667,13.1455 , 5.0);
            }
            if(CP[playerid]==218)
            {
                DisablePlayerCheckpoint(playerid);
                    CP[playerid] = 219;
                    SetPlayerCheckpoint(playerid, 1819.4927,-1678.5614,13.1476, 5.0);
            }
            if(CP[playerid]==219)
            {
                DisablePlayerCheckpoint(playerid);
                    CP[playerid] = 220;
                    SetPlayerCheckpoint(playerid, 1819.3573,-1718.8311,13.1460, 5.0);
            }
            if(CP[playerid]==220)
            {
                DisablePlayerCheckpoint(playerid);
                    CP[playerid] = 221;
                    SetPlayerCheckpoint(playerid, 1809.9911,-1730.2688,13.1540, 5.0);
            }
            if(CP[playerid]==221)
            {
                DisablePlayerCheckpoint(playerid);
                    CP[playerid] = 222;
                    SetPlayerCheckpoint(playerid, 1803.1420,-1718.2678,13.2990, 5.0);
            }
            if(CP[playerid]==222)
            {
                    new pName[24];
                    new str[128];
                    GetPlayerName(playerid, pName, 24);
                    GivePlayerCash(playerid, -3500);
                    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][pTruckLic] = 1;
                    DisablePlayerCheckpoint(playerid);
            }
            if(CP[playerid] > 222 )
            {
            DisablePlayerCheckpoint(playerid);
            }
            return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)