SA-MP Forums Archive
Errors - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Errors (/showthread.php?tid=589457)



[fixed]Errors - TheKnown - 19.09.2015

error 001: expected token: ")", but found ".."
error 029: invalid expression, assumed zero
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line

Код:
if(vehicleid == ArmyVeh[0]..[19] && GetPlayerClass[playerid] == ARMY_CLASS)
	{
 		ClearAnimations(playerid);
		GameTextForPlayer(playerid,"Army Vehicle",3000,4);
	}



Re: Errors - TheKnown - 19.09.2015

help?


Re: Errors - Andre02 - 19.09.2015

What are the 2 dots doing there between [0] and [19] ?

pawn Код:
if(vehicleid == ArmyVeh[0][19] && GetPlayerClass[playerid] == ARMY_CLASS)
{
    ClearAnimations(playerid);
    GameTextForPlayer(playerid,"Army Vehicle",3000,4);
}



Re: Errors - xVIP3Rx - 19.09.2015

It actually depends on your array..if the example above didn't work, and you wanna check for all the army vehicles, do this.
pawn Код:
if(GetPlayerClass[playerid] == ARMY_CLASS)
{
    for(new i; i<20; i++)//change 20 to "sizeof(ArmyVeh)" if you want it for all the Army Vehicles..
    {
        if(vehicleid == ArmyVeh[i])
        {
            ClearAnimations(playerid);
            GameTextForPlayer(playerid,"Army Vehicle",3000,4);
        }
    }
}



Re: Errors - TheKnown - 19.09.2015

how do i change it to sizeof(ArmyVeh)?


Re : Errors - KillerDVX - 19.09.2015

PHP код:
if(GetPlayerClass[playerid] == ARMY_CLASS)
{
    for(new 
ii<sizeof(ArmyVeh); i++)
    {
        if(
vehicleid == ArmyVeh[i])
        {
            
ClearAnimations(playerid);
            
GameTextForPlayer(playerid,"Army Vehicle",3000,4);
        }
    }




Re: Errors - xVIP3Rx - 19.09.2015

Quote:
Originally Posted by TheKnown
Посмотреть сообщение
how do i change it to sizeof(ArmyVeh)?
do this ONLY if you know what are you doing, if you wanna check for the whole array use it, if not just use the number.

Quote:
Originally Posted by KillerDVX
Посмотреть сообщение
pawn Код:
if(GetPlayerClass[playerid] == ARMY_CLASS)
{
    for(new i; i<sizeof(ArmyVeh); i++)
    {
        if(vehicleid == ArmyVeh[i])
        {
            ClearAnimations(playerid);
            GameTextForPlayer(playerid,"Army Vehicle",3000,4);
        }
    }
}



Re: Errors - TheKnown - 19.09.2015

Is the code right?
Код:
if(GetPlayerClass[playerid] != ARMY_CLASS)
	{
		for(new i; i<sizeof(ArmyVeh); i++)//change 20 to "sizeof(ArmyVeh)" if you want it for all the Army Vehicles..
		{
			if(vehicleid == ArmyVeh[i])
			{
				ClearAnimations(playerid);
				GameTextForPlayer(playerid,"Army Vehicle",3000,4);
			}
		}
	}
	if(GetPlayerClass[playerid] != ARMY_CLASS || GetPlayerClass[playerid] != COP_CLASS)
	{
		for(new i; i<sizeof(PDVeh); i++)//change 20 to "sizeof(ArmyVeh)" if you want it for all the Army Vehicles..
		{
			if(vehicleid == PDVeh[i])
			{
    			SendClientMessage(playerid, COLOR_RED, "Wanted Level Increased");
	    		SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid)+3);
	    		SetPlayerColor(playerid, COLOR_ORANGE);
	    		if(GetPlayerWantedLevel(playerid) >= 4)
	    		{
	    		    SetPlayerColor(playerid, COLOR_RED);
	    		}
			}
		}
	}
 	if(pInfo[playerid][Adminlevel] != 1)
	{
		for(new i; i<sizeof(AdminVeh); i++)//change 20 to "sizeof(ArmyVeh)" if you want it for all the Army Vehicles..
		{
			if(vehicleid == AdminVeh[i])
			{
				ClearAnimations(playerid);
				GameTextForPlayer(playerid,"Admin Vehicle",3000,4);
			}
		}
	}
I can't enter the other cars..It says Admin Vehicle on the cars on the street
And when i enter the PDVeh as a cop i get wanted level


Re: Errors - xVIP3Rx - 19.09.2015

This should work, IF the "AdminVeh" array's probably created, show me how do you create the admin cars..


Re: Errors - TheKnown - 19.09.2015

i fixed it