SA-MP Forums Archive
Need help with admin system - 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: Need help with admin system (/showthread.php?tid=465688)



Need help with admin system - Voxel - 23.09.2013

Hello dear SA-MP communuty,

I started working on a script and today i started on the admin part of things, but since i am new to Scripting i dont really know what this means and how to solve this.

the error:

pawn Код:
(1308) : error 017: undefined symbol "AdminLevel"
(1312) : error 028: invalid subscript (not an array or too many subscripts): "PlayerInfo"
(1312)error 001: expected token: ";", but found "]"
1312)error 029: invalid expression, assumed zero
(1312) : fatal error 107: too many error messages on one line
Heres the code im using:

pawn Код:
enum PlayerInfo
{
    Pass[129],
    Adminlevel,
    VIPlevel,
    Money,
    Scores,
    Kills,
    Deaths
}

new pInfo[MAX_PLAYERS][PlayerInfo];

        //my other commands are above here
    if(!strcmp(cmdtext[1],"makeadmin",true,9))
    {
        if(!IsPlayerAdmin(playerid)||pInfo[playerid][AdminLevel]<5)return     SendClientMessage(playerid,0xFF0000FF,"You're not authorized to use that command");
        new tmpspace = strfind(cmdtext," ",true,11);
        if(!cmdtext[11])return SendClientMessage(playerid,0xFF0000FF,"USAGE: /MakeAdmin <playerid> <admin level>");
        if(!cmdtext[tmpspace+1])return SendClientMessage(playerid,0xFF0000FF,"USAGE: /MakeAdmin <playerid>              <admin level>");
        /*line 1312*/PlayerInfo[strval(cmdtext[11])][AdminLevel]=strval(cmdtext[tmpspace+1]);
        new tmpstring[128];
        GetPlayerName(strval(cmdtext[11]),tmpstring,MAX_PLAYER_NAME);
        format(tmpstring,128,"You made %s AdminLevel %d",tmpstring,strval(cmdtext[tmpspace+1]));
        SendClientMessage(playerid,0xFFFFFFFF,tmpstring);
        GetPlayerName(playerid,tmpstring,MAX_PLAYER_NAME);
        format(tmpstring,128,"%s made you AdminLevel %d",tmpstring,strval(cmdtext[tmpspace+1]));
        return SendClientMessage(strval(cmdtext[11]),0xFFFFFFFF,tmpstring);
    }
    return 0;
}
Thank you for your time!


Re: Need help with admin system - Swyft™ - 23.09.2013

pawn Код:
enum PlayerInfo
{
    Pass[129],
    Adminlevel,
    VIPlevel,
    Money,
    Scores,
    Kills,
    Deaths
}

new pInfo[MAX_PLAYERS][PlayerInfo];

        //my other commands are above here
    if(!strcmp(cmdtext[1],"makeadmin",true,9))
    {
        if(!IsPlayerAdmin(playerid)||pInfo[playerid][Adminlevel]<5)return     SendClientMessage(playerid,0xFF0000FF,"You're not authorized to use that command");
        new tmpspace = strfind(cmdtext," ",true,11);
        if(!cmdtext[11])return SendClientMessage(playerid,0xFF0000FF,"USAGE: /MakeAdmin <playerid> <admin level>");
        if(!cmdtext[tmpspace+1]) return SendClientMessage(playerid,0xFF0000FF,"USAGE: /MakeAdmin <playerid>              <admin level>");
        pInfo[strval(cmdtext[11])][Adminlevel] = strval(cmdtext[tmpspace+1]);
        new tmpstring[128];
        GetPlayerName(strval(cmdtext[11]),tmpstring,MAX_PLAYER_NAME);
        format(tmpstring,128,"You made %s Adminlevel %d",tmpstring,strval(cmdtext[tmpspace+1]));
        SendClientMessage(playerid,0xFFFFFFFF,tmpstring);
        GetPlayerName(playerid,tmpstring,MAX_PLAYER_NAME);
        format(tmpstring,128,"%s made you AdminLevel %d",tmpstring,strval(cmdtext[tmpspace+1]));
        return SendClientMessage(strval(cmdtext[11]),0xFFFFFFFF,tmpstring);
    }
    return 0;
}
Also just FYI, no one uses strcmp cmds anymore... I recommend you use a command processor like DCMD or ZCMD.


Re: Need help with admin system - Dragonsaurus - 23.09.2013

Where you have "AdminLevel" change to "Adminlevel".
Also at the other line, replace "PlayerInfo" with "pInfo".


Re: Need help with admin system - Voxel - 23.09.2013

Thank you both, worked!


Re: Need help with admin system - Swyft™ - 23.09.2013

No problem