Promotion and Demotion help
#1

pawn Код:
YCMD:setadmin(playerid, params[])
{
    if( PlayerInfo[playerid][pAdmin] >= 4 )
    {
        new
            TargetID,
            tLevel,
            tReason[50];
        if( !sscanf(params, "uiS(No reason specified)[50]", TargetID, tLevel, tReason) )
        {
            if( tLevel > 6 )                    return SendClientMessage( playerid, -1, ""COL_ORANGE"Maximum level a admin can be: 6" );
            if( strlen( tReason ) > 50 )        return SendClientMessage( playerid, -1, ""COL_ORANGE"Maximum Chars for reason: 50" );
            if( TargetID == INVALID_PLAYER_ID ) return SendClientMessage( playerid, -1, ""COL_ORANGE"No player is has this Identification number. Please try again." );
            PlayerInfo[TargetID][pAdmin] = tLevel;
            new
                MyString[128],
                TargetString[128];
            if( PlayerInfo[TargetID][pAdmin] < tLevel )
            {
                format( MyString, sizeof MyString, ""COL_ORANGE"You promoted %s to vip level %i. Reason: %s", GetName(TargetID), tLevel, tReason );
                format( TargetString, sizeof TargetString, ""COL_ORANGE"You have been promoted by %s to vip level %i. Reason: %s", GetName(playerid), tLevel, tReason );
                SendClientMessage( TargetID, -1, TargetString );
            }
            else
            {
                format( MyString, sizeof MyString, ""COL_ORANGE"You demoted %s to vip level %i. Reason: %s", GetName(TargetID), tLevel, tReason );
                format( TargetString, sizeof TargetString, ""COL_ORANGE"You have been demoted by %s to vip level %i. Reason: %s", GetName(playerid), tLevel, tReason );
                SendClientMessage( TargetID, -1, TargetString );
            }
            SendClientMessage( playerid, -1, MyString );
        }
        else
            return SendClientMessage( playerid, -1, ""COL_ORANGE"Usage: /setvip <TargetID> <Level> <(OPTIONAL)Reason>" );
    }
    else
        return SendClientMessage( playerid, -1, ""COL_ORANGE"You have to be an admin to perform this command!" );
    return 1;
}
So it's pretty basic. However my problem is that whenever I promote someone to let say level 5 when the TargetID is a level 4, it will display, "Player was demoted", Instead it should say "Player was promoted".

Help?
Reply


Messages In This Thread
Promotion and Demotion help - by HydraX - 01.08.2012, 07:21
Re: Promotion and Demotion help - by Roko_foko - 01.08.2012, 07:33
Respuesta: Re: Promotion and Demotion help - by HydraX - 01.08.2012, 07:41
Re: Promotion and Demotion help - by Roko_foko - 01.08.2012, 07:46
Respuesta: Re: Promotion and Demotion help - by HydraX - 01.08.2012, 07:51

Forum Jump:


Users browsing this thread: 2 Guest(s)