setlevel
#1

I got this:

pawn Код:
CMD:setlevel(playerid, params[])
{
    new levels,Nam[MAX_PLAYER_NAME],pname[MAX_PLAYER_NAME],str[128],ID;
    if(!IsPlayerAdmin(playerid))return 0;
    if(sscanf(params,"ui",ID,levels)) return SendClientMessage(playerid, RED, "USAGE: /setlevel <ID> <Level 1-5>");
    if(levels > 5) return SendClientMessage(playerid, RED,"ERROR: Levels Available 1-5");
    if(!IsPlayerConnected(ID))return SendClientMessage(playerid, RED,"ERROR: Player is not connected.");
    if(PlayerData[ID][AdminLevel] == levels) return SendClientMessage(playerid, RED, "ERROR: Player is already this admin level.");
    GetPlayerName(playerid,Nam, MAX_PLAYER_NAME);
    GetPlayerName(ID,pname,MAX_PLAYER_NAME);
    if(levels == 0)
    {
        format(str, sizeof(str),"%s has set your Admin level to %d.",Nam,levels);
        GameTextForPlayer(playerid, "~g~PROMOTED", 3000, 4);
        SendClientMessage(ID,GREEN,str);
        format(str, sizeof(str),"You had set %s Admin level to %d.",pname,levels);
        SendClientMessage(playerid,ORANGE,str);
        PlayerData[ID][AdminLevel] = levels;
        return 1;
    }
    format(str, sizeof(str),"%s has set your Admin level to %d.",Nam,levels);
    GameTextForPlayer(playerid, "~y~DEMOTED", 3000, 4);
    SendClientMessage(ID,YELLOW,str);
    format(str, sizeof(str),"You had set %s Admin level to %d",pname,levels);
    SendClientMessage(playerid,ORANGE,str);
    PlayerData[ID][AdminLevel] = levels;
    return 1;
}
the problem is that when i do /setlevel ID LEVEL, it always appears "DEMOTED" it does never appears promoted, pls help me !!
Reply
#2

Replace

pawn Код:
if(levels == 0)
with

pawn Код:
if(levels < PlayerData[ID][AdminLevel]) // Their new level is LESS THAN their CURRENT level (= demoted)
I'd also add this toward the top:

pawn Код:
if(PlayerData[ID][AdminLevel] == levels) return SendClientMessage(playerid, RED, "ERROR: Player is already that level.");
Reply
#3

what u mean with last code?
Reply
#4

If they're level 2 and someone sets their level to 2, it will tell them that they are already that level.
Reply
#5

NOT fixed :S

+

whjen i do /setlevel id level to other player they dont see promoted or demtoed, and demoted appears only to me.
Reply
#6

You're showing the message to 'playerid' - that's the player that types the command. Change it to 'ID'.
Reply
#7

thnx, but it stills appear DEMOTED maybe cauz i have the } that open and close: like:

pawn Код:
{
        format(str, sizeof(str),"%s has set your Admin level to %d.",Nam,levels);
        GameTextForPlayer(playerid, "~g~PROMOTED", 3000, 4);
        SendClientMessage(ID,GREEN,str);
        format(str, sizeof(str),"You had set %s Admin level to %d.",pname,levels);
        SendClientMessage(playerid,ORANGE,str);
        PlayerData[ID][AdminLevel] = levels;
        return 1;
    }
maybe cauz of that, it doesn't appears?
Reply
#8

It's still playerid.
Reply
#9

no..
Reply
#10

Look again.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)