[SIMPLE] /v command
#1

Greetings,


I have this /v command, but I can`t complie it as well because I get this errors:

pawn Код:
C:\Users\usuario\Sa-Mp\filterscripts\Commands.pwn(254) : error 029: invalid expression, assumed zero
C:\Users\usuario\Sa-Mp\filterscripts\Commands.pwn(254) : warning 215: expression has no effect
C:\Users\usuario\Sa-Mp\filterscripts\Commands.pwn(254) : error 001: expected token: ";", but found "]"
C:\Users\usuario\Sa-Mp\filterscripts\Commands.pwn(254) : error 029: invalid expression, assumed zero
C:\Users\usuario\Sa-Mp\filterscripts\Commands.pwn(254) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
LINE 254:
pawn Код:
if([pInfo][pAdmin] >=1) return SendClientMessage(playerid, COL_RED, "SERVER: You are not allowed to use this command");
If anyone can help me,

Regards,
Pablo.
Reply
#2

Show me your pInfo enum
Reply
#3

Here is it

pawn Код:
enum pInfo
{
    pAdmin
}
Reply
#4

pawn Код:
[pInfo][pAdmin]
How do you expect it to be compiled with the code above?

I'll give you an example:
pawn Код:
enum pInfo
{
    pAdmin
};

new PlayerInfo[MAX_PLAYERS][pInfo];
So, it should be:
pawn Код:
PlayerInfo[playerid][pAdmin]
Change it according to your variable.
Reply
#5

Maybe should be:
pawn Код:
if(pInfo[playerid][pAdmin] >=1) return SendClientMessage(playerid, COL_RED, "SERVER: You are not allowed to use this command");
Edit: Wrong, I didn't refresh the page... And I didn't see the posts above...
Reply
#6

If you mean something like this

pawn Код:
if(pInfo[playerid][pAdmin] >=1) return SendClientMessage(playerid, COL_RED, "SERVER: You are not allowed to use this command");
If I am not wrong, I get this:

pawn Код:
C:\Users\usuario\Sa-Mp\filterscripts\Commands.pwn(254) : error 028: invalid subscript (not an array or too many subscripts): "pInfo"
C:\Users\usuario\Sa-Mp\filterscripts\Commands.pwn(254) : warning 215: expression has no effect
C:\Users\usuario\Sa-Mp\filterscripts\Commands.pwn(254) : error 001: expected token: ";", but found "]"
C:\Users\usuario\Sa-Mp\filterscripts\Commands.pwn(254) : error 029: invalid expression, assumed zero
C:\Users\usuario\Sa-Mp\filterscripts\Commands.pwn(254) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Reply
#7

Add this at the top of your script:
PHP код:
new gPlayerInfo[MAX_PLAYERS][pInfo]; 
And change the function to:
PHP код:
if(gPlayerInfo[playerid][pAdmin] >=1) return SendClientMessage(playeridCOL_RED"SERVER: You are not allowed to use this command"); 
Reply
#8

pawn Код:
enum pInfo{    pAdmin};new PlayerInfo[MAX_PLAYERS][pInfo];
is the solution just replace it and instead of pInfo[playerid[pAdmin] do PlayerInfo[playerid][pAdmin] etc
Reply
#9

Okay, I made with your way and I get this:

pawn Код:
C:\Users\usuario\Sa-Mp\filterscripts\Commands.pwn(255) : error 035: argument type mismatch (argument 2)
C:\Users\usuario\Sa-Mp\filterscripts\Commands.pwn(262) : error 035: argument type mismatch (argument 2)
C:\Users\usuario\Sa-Mp\filterscripts\Commands.pwn(266) : error 035: argument type mismatch (argument 2)
C:\Users\usuario\Sa-Mp\filterscripts\Commands.pwn(285) : error 035: argument type mismatch (argument 2)
LINES:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[200], idx;
    cmd = strtok(cmdtext, idx);

    if(strcmp(cmd, "/spawn", true, 10) == 0)
    {
        if(PlayerInfo[playerid][pAdmin] >=1) return SendClientMessage(playerid, COL_RED, "SERVER: You are not allowed to use this command"); //THIS

        new String[200];
        new tmp[256];
        new Float:x, Float:y, Float:z;

        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, COL_RED, "ERROR: You didn`t give a name"); //THIS

        new vehicle = GetVehicleModelIDFromName(tmp);

        if(vehicle < 400 || vehicle > 611) return SendClientMessage(playerid, COL_RED, "ERROR: Vehicle not found"); //THIS

        new Float:a;
        GetPlayerFacingAngle(playerid, a);
        GetPlayerPos(playerid, x, y, z);

        if(IsPlayerInAnyVehicle(playerid) == 1)
        {
            GetXYInFrontOfPlayer(playerid, x, y, 8);
        }
        else
        {
            GetXYInFrontOfPlayer(playerid, x, y, 5);
        }

        new PlayersVehicle = CreateVehicle(vehicle, x, y, z, a+90, -1, -1, -1);
        LinkVehicleToInterior(PlayersVehicle, GetPlayerInterior(playerid));

        format(String, sizeof(String), "VEHICLE: You have spawned a %s", aVehicleNames[vehicle - 400]);
        SendClientMessage(playerid, COL_ORANGE, String); //THIS
        return 1;
    }
    return 0;
}
Reply
#10

pawn Код:
if(PlayerInfo[playerid][pAdmin] >=1) return SendClientMessage(playerid, COL_RED, "SERVER: You are not allowed to use this command");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)