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
#2

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;//<<<<<<<<<<<<<<<<<<<<Just put this line at the end of the function
            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 );
                //<<<<<<<<<<<<<<<<<<<<<<here
        }
        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;
}
Reply
#3

Didn't work, same result.
Reply
#4

This is what i ment:
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." );
            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 );
            PlayerInfo[TargetID][pAdmin] = tLevel;
        }
        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;
PS: is it vip or admin level?
Reply
#5

Yes, I did that..same result.


PS: Admin. I just copied over the same system because I wanted to test another level system..


EDIT: Ugh, I got a brain fart..I see what you meant at first, but I didn't realize and forgot to remove the Level Variable uptop.

Thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)