Invalid Expression
#1

Hi guys, can't figure this one out, need a lil bit of help

Here's the command:
Код:
#define MAX_BARRICADES 15
new Barricade[MAX_BARRICADES];


CMD:deploybarrier(playerid, params[])
{
    if((PlayerInfo[playerid][pFaction] == 1 || PlayerInfo[playerid][pFaction] == 4 || PlayerInfo[playerid][pFaction] == 5))
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            SendClientMessage(playerid, COLOUR_GREY, "You must be on foot to use this command.");
            return 1;
        }
        new number, string[128], Float:Position[4];
        if(sscanf(params,"d",number))
        {
            SendClientMessage(playerid,COLOUR_BLUE,"USAGE: /deploycade <1/2/3/4/5/6/7>");
            SendClientMessage(playerid,TEAM_FBI,"| 1: Small Roadblock | 2: Medium Roadblock");
            SendClientMessage(playerid,TEAM_FBI,"| 3: Big Roadblock | 4: Traffic cone");
            SendClientMessage(playerid,TEAM_FBI,"| 5: Detour sign | 6: Will be sign");
            SendClientMessage(playerid,TEAM_FBI,"| 5: Line closed sign");
            SendClientMessage(playerid,COLOUR_WHITE,"----------------------");
            return 1;
        }
        for(new i; i<MAX_BARRICADES; i++)
        {
            if(Barricade[i] == 0)
            {
            GetPlayerPos(playerid, Position[0], Position[1], Position[2]);
            GetPlayerFacingAngle(playerid, Position[3]);
            switch(number)
            {
                case 1:
                {
                    Barricade[i] = CreateDynamicObject(1459, Position[0], Position[1]+1, Position[2]-0.5, 0.0, 0.0, Position[3],-1, -1, -1, 200.0);
                }
                case 2:
                {
                    Barricade[i] = CreateDynamicObject(978, Position[0], Position[1]+1, Position[2], 0.0, 0.0, Position[3],-1, -1, -1, 200.0);
                }
                case 3:
                {
                    Barricade[i] = CreateDynamicObject(981, Position[0], Position[1]+1, Position[2], 0.0, 0.0, Position[3]+180.0, -1, -1, -1, 200.0);
                    SetPlayerPos(playerid, Position[0], Position[1], Position[2]+5);
                }
                case 4:
                {
                    Barricade[i] = CreateDynamicObject(1238, Position[0], Position[1]+1, Position[2]-0.5, 0.0, 0.0, Position[3],-1, -1, -1, 200.0);
                }
                case 5:
                {
                    Barricade[i] = CreateDynamicObject(1425, Position[0], Position[1]+1, Position[2]-0.5, 0.0, 0.0, Position[3],-1, -1, -1, 200.0);
                }
                case 6:
                {
                    Barricade[i] = CreateDynamicObject(3265, Position[0], Position[1]+1, Position[2]-0.9, 0.0, 0.0, Position[3],-1, -1, -1, 200.0);
                }
                case 7:
                {
                    Barricade[i] = CreateDynamicObject(3091, Position[0], Position[1]+1, Position[2]-0.25, 0.0, 0.0, Position[3],-1, -1, -1, 200.0);
                }
            }
                GetPlayerPos(playerid, Position[0], Position[1], Position[2]);
                GetPlayerFacingAngle(playerid, Position[3]);
                new zone[MAX_ZONE_NAME];
                GetPlayer3DZone(playerid, zone, sizeof(zone));
                format(string, sizeof(string), "HQ: A barricade has been deployed by %s at %s.", GetNameEx(playerid), zone);
                foreach(Player, x)
                {
                    if((PlayerInfo[x][pFaction] == 4 || PlayerInfo[x][pFaction] == 5 || PlayerInfo[x][[pFaction] == 1))//THIS IS LINE 12007
                    {
                        SendClientMessage(x, TEAM_BLUE_COLOR, string);
                    }
                }
                return 1;
            }
        }
        SendClientMessage(playerid, COLOUR_GREY, "All available barriers have been deployed.");
    }
    else
    {
        SendClientMessage(playerid, COLOUR_GREY, "You are not an LEO.");
    }
    return 1;
}
Here's the error log:
Код:
C:\Users\Bradley\Documents\Everest RP TEST\gamemodes\bcrp.pwn(12007) : error 029: invalid expression, assumed zero
C:\Users\Bradley\Documents\Everest RP TEST\gamemodes\bcrp.pwn(12007) : error 029: invalid expression, assumed zero
C:\Users\Bradley\Documents\Everest RP TEST\gamemodes\bcrp.pwn(12007) : error 029: invalid expression, assumed zero
C:\Users\Bradley\Documents\Everest RP TEST\gamemodes\bcrp.pwn(12007) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Here's line 12007:
Код:
                    if((PlayerInfo[x][pFaction] == 4 || PlayerInfo[x][pFaction] == 5 || PlayerInfo[x][[pFaction] == 1))//THIS IS LINE 12007
Reply
#2

Код:
if((PlayerInfo[x][pFaction] == 4 || PlayerInfo[x][pFaction] == 5 || PlayerInfo[x][[pFaction] == 1))
Remove the red bracket.

Shoud look like:

Код:
if(PlayerInfo[x][pFaction] == 4 || PlayerInfo[x][pFaction] == 5 || PlayerInfo[x][pFaction] == 1)
Reply
#3

Oh wow! Haha clearly didn't notice that one, thanks!
Reply
#4

You're also getting the players position and angle twice when you can simply do it once.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)