SendClientMessage IF Exceeding
#1

i have only /sethelper 5 levels so i want to know how to stop some one if some one tries to exceed limit? and send him msg?

pawn Код:
CMD:sethelper(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] >= 9)
        {
            new
                giveplayerid,
                level;
            if(!sscanf(params, "ui", giveplayerid,level))
            {
                if(giveplayerid != INVALID_PLAYER_ID)
                {
                    new
                        sendername[MAX_PLAYER_NAME],
                        giveplayername[MAX_PLAYER_NAME],
                        string[128];
                    GetPlayerName(playerid, sendername, MAX_PLAYER_NAME);
                    GetPlayerName(giveplayerid, giveplayername, MAX_PLAYER_NAME);

                    format(string, sizeof(string), "The admin %s has made you a level  %d Helper",sendername,level);
                    SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
                    format(string, sizeof(string), "You have made %s a level %d Helper",giveplayername,level);
                    SendClientMessage(playerid, COLOR_TOMATO, string);
                    PlayerInfo[giveplayerid][pHelper] = level;
                }
            }
            else SendClientMessage(playerid, 0xAFAFAFAA, "SYNTAX:/sethelper [playerid] [level]");
        }
        else SendClientMessage(playerid, 0xAFAFAFAA, "You are not a Community Staff Member! Or Your Level is too low!");
    }
    return 1;
}
Reply
#2

pawn Код:
if(level < 0 || level > 5) return SendClientMessage(playerid, 0xFF0000, "Levels are between 0 and 5!");
Put that under
pawn Код:
if(giveplayerid != INVALIE_PLAYER_ID)
Reply
#3

thanks its working
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)