SA-MP Forums Archive
[SIMPLE] /v command - 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: [SIMPLE] /v command (/showthread.php?tid=462545)



[SIMPLE] /v command - PabloDiCostanzo - 07.09.2013

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.


Re: [SIMPLE] /v command - Stanford - 07.09.2013

Show me your pInfo enum


Respuesta: [SIMPLE] /v command - PabloDiCostanzo - 07.09.2013

Here is it

pawn Код:
enum pInfo
{
    pAdmin
}



Re: [SIMPLE] /v command - Konstantinos - 07.09.2013

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.


Re: [SIMPLE] /v command - Dragonsaurus - 07.09.2013

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...


Respuesta: [SIMPLE] /v command - PabloDiCostanzo - 07.09.2013

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.



Re: [SIMPLE] /v command - Tomer!.$ - 07.09.2013

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"); 



Re: [SIMPLE] /v command - Stanford - 07.09.2013

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


Respuesta: [SIMPLE] /v command - PabloDiCostanzo - 07.09.2013

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;
}



Re: [SIMPLE] /v command - Dragonsaurus - 07.09.2013

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