Command not working
#1

in onplayerconnect i have put this line: PlayerInfo[playerid][pAdmin] = 0;

This command is suppost to give the player admin, but it doesn't.
pawn Код:
CMD:rconmakeadmin(playerid, params[]) //using ZCMD this is how your command will start off looking like.
{
    if(IsPlayerAdmin(playerid))
    {
        new adminname[MAX_PLAYER_NAME],pname[MAX_PLAYER_NAME],otherplayerid, adminlevel;
        GetPlayerName(otherplayerid,pname,sizeof(pname));
        GetPlayerName(playerid,adminname,sizeof(adminname));
        if(sscanf(params, "ui", otherplayerid, adminlevel))
            SendClientMessage(playerid, 0xFFFFFFFF, "/makeadmin [playerid/name] [adminlevel]");
        else if(otherplayerid == INVALID_PLAYER_ID)
            SendClientMessage(playerid, 0xFFFFFFFF, "This player is not connected");
        else
        {
            new string[250];
            format(string, sizeof(string), "Admin %s Has Given Admin Permissions To %s",adminname,pname);
            SendClientMessageToAll(0xFFFFFFFF,string);
            PlayerInfo[otherplayerid][pAdmin] = adminlevel;
           
            new query[200]; //Creates the variables
            GetPlayerName(playerid, pname, 24); //Gets the players name.
            format(query, sizeof(query), "UPDATE playerdata SET admin=%d WHERE user='%s'", adminlevel, pname);
            mysql_query(query);
            mysql_free_result();
        }
    }
    else
    {
        SendClientMessage(playerid, 0xAAAAAAAA, "You are not admin or the required level.");
        mysql_free_result();
    }
    return 1;
}
It says the player has been given admin but when they type /ban /kick /ahelp, they don't work.

Ahelp

pawn Код:
CMD:ahelp(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        if(PlayerInfo[playerid][pAdmin] >= 1)
        {
            SendClientMessage(playerid,COLOR_LIGHTBLUE, "LEVEL 1 COMMANDS: /setskin");

        }
        if(PlayerInfo[playerid][pAdmin] >= 2)
        {
            SendClientMessage(playerid,COLOR_LIGHTBLUE, "LEVEL 2 COMMANDS: /kick");

        }
        if(PlayerInfo[playerid][pAdmin] >= 3)
        {
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "LEVEL 3 COMMANDS: /ban /givegun");

        }
        if(PlayerInfo[playerid][pAdmin] >= 5)
        {
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "LEVEL 5 COMMANDS: /gmx");

        }
        if(PlayerInfo[playerid][pAdmin] >= 6)
        {
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "LEVEL 6 COMMANDS: /makeadmin");
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)