IsPlayerConnected Issue
#5

pawn Код:
CMD:setlevel(playerid,params[])
{
    if(!IsPlayerAdmin(playerid)) return 0;
    new pID,level;
    if(sscanf(params,"dd",pID,level)) SendClientMessage(playerid,COLOR_WHITE,"USAGE: /setlevel [playerid] [level]");
    else if(!IsPlayerConnected(pID)) SendClientMessage(playerid,COLOR_GREY,"Player is not connected.");
    else if(pInfo[pID][AdminLevel] > pInfo[playerid][AdminLevel]) SendClientMessage(playerid,COLOR_WHITE,"You can't use this command on your colleauge");
    else if(!(0 < level < 6)) SendClientMessage(playerid,COLOR_WHITE,"invalid level 1-5");
    else{
        new rank[35];
        switch(level)
        {
            case 1:     rank = "{FF8800}Server Moderator {FFFFFF}";
            case 2:     rank = "{0000FF}Global Moderator {FFFFFF}";
            case 3:     rank = "{FF0000}Admin {40FF00}";
            case 4:     rank = "{40FF00}Super Admin {FFFFFF}";
            default:    rank = "{40FF00}Head Admin {FFFFFF}";
        }
        if(pInfo[pID][AdminLevel] > level)
            format(string,sizeof(string),"%s has been demoted to %s by "SERVER_NAME" management.",pID,rank);
        else
            format(string,sizeof(string),"%s has been promoted to %s by "SERVER_NAME" management.",pID,rank);

        SendClientMessageToAll(COLOR_WHITE,string);
        pInfo[pID][AdminLevel] = level;
    }
    return 1;
}
you need to get player name in format pID,rank); // GetName(pID)
Reply


Messages In This Thread
IsPlayerConnected Issue - by Tayab - 28.11.2013, 05:01
Re: IsPlayerConnected Issue - by Lozzy - 28.11.2013, 07:08
Re: IsPlayerConnected Issue - by Konstantinos - 28.11.2013, 10:34
Re: IsPlayerConnected Issue - by Tayab - 28.11.2013, 22:10
Re: IsPlayerConnected Issue - by Jefff - 28.11.2013, 22:32
Re: IsPlayerConnected Issue - by Tayab - 29.11.2013, 06:17

Forum Jump:


Users browsing this thread: 2 Guest(s)