Help.. setlevel command and admins
#1

pawn Код:
CMD:setlevel(playerid, params[])
{
    if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][Level] >= 5)
    {
        new alevel, level, user, pName1[MAX_PLAYER_NAME], str[250];
        GetPlayerName(user, pName1, MAX_PLAYER_NAME);
        alevel = PlayerInfo[playerid][Level];

        if(sscanf(params, "ui", user, level)) return SendClientMessage(playerid, -1, "Usage: /setlevel [id] [level]");
        if(level < 0 || level > 5) return SendClientMessage(playerid, red, "Level must be between 0 and 5!");
        if(playerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, red, "Player is not connected!");
        if(alevel == level) return SendClientMessage(playerid, red, "Admin is already this level!");

        format(str, sizeof(str), "Head administrator %s has set your level to %i", pName1, level);
        SendClientMessage(playerid, -1, str);

        if(alevel < level) return GameTextForPlayer(user, "Demoted", 5000, 4);
        if(alevel > level) return GameTextForPlayer(user, "Promoted", 5000, 4);
        PlayerInfo[playerid][Level] = level;
    }
    return 1;
}
I got two problems, it sends the formatted message BUT, I Dunno if it really sets me as an admin, the .ini log shows it doesnt.

Also this

pawn Код:
CMD:admins(playerid, params[])
{
    if(PlayerInfo[playerid][Level] >= 1)
    {
        new count = 0;
        new string[128];
        SendClientMessage(playerid, COLOR_CYAN, "|- Admins Online -|");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if (IsPlayerConnected(i))
            {
                if(PlayerInfo[i][Level] >= 1)
                {
                    new nameee[128], GetName[MAX_PLAYER_NAME];
                    GetPlayerName(i, GetName, MAX_PLAYER_NAME);
                    GetPlayerName(i, nameee, 16);
                    format(string, 128, "Admin %s[%i] Level: %d ",GetName,i,PlayerInfo[i][Level],i);
                    SendClientMessage(playerid, red, string);
                    count++;
                }
              }
            }
            if (count == 0)
            {
                SendClientMessage(playerid, COLOR_CYAN, "|- No admins online -|");
            }
    }
    return 1;
}
This does not show anything. nor SERVER: Unknown command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)