setlevel command :S
#6

Код:
// Abajo de los Colores

enum pData
{
    AdminLevel
};
new PlayerData[MAX_PLAYERS][pData];
new levels,Nam[MAX_PLAYER_NAME],pname[MAX_PLAYER_NAME],_str[128],ID;

// =========================================================================================================

CMD:setadmin(playerid, params[])
{
    if(!IsPlayerAdmin(playerid))return 0;
    if(sscanf(params,"ui",ID,levels)) return SendClientMessage(playerid,0xFF9900AA, "USAGE: /setadmin <id> <level 1-5>");
    if(levels > 5) return SendClientMessage(playerid,0xFF0000FF,"ERROR: Available levels 1-5!");
    if(!IsPlayerConnected(ID))return SendClientMessage(playerid, RED,"ERROR: That player is not connected.");
    if(PlayerData[ID][AdminLevel] == levels) return SendClientMessage(playerid, RED, "ERROR: That 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 had set your Admin level to %d on the server.", Nam, levels);
        SendClientMessage(ID, ORANGE, _str);
        format(_str, sizeof(_str),"You had set %s Admin level to %d",pname,levels);
        SendClientMessage(playerid, ORANGE, _str);
        PlayerData[ID][AdminLevel] = levels;//this sets the player level
    }
    return 1;
}
Tell me if it works.

EDIT: An other point is that you only actually change the level when the level is 0. I may be wrong but I guess you want to change it when its between 0 and 5..
Reply


Messages In This Thread
setlevel command :S - by MiGu3X - 10.02.2013, 21:22
Re: setlevel command :S - by |Xenon|Mapper| - 10.02.2013, 21:24
Respuesta: setlevel command :S - by MiGu3X - 10.02.2013, 21:27
Re: setlevel command :S - by LeBoyce - 10.02.2013, 21:30
Respuesta: setlevel command :S - by MiGu3X - 10.02.2013, 21:33
Re: setlevel command :S - by LeBoyce - 10.02.2013, 21:36
Respuesta: setlevel command :S - by MiGu3X - 10.02.2013, 21:40
Re: setlevel command :S - by LeBoyce - 10.02.2013, 21:49
Re: setlevel command :S - by blackdragon1 - 10.02.2013, 22:00
Respuesta: setlevel command :S - by MiGu3X - 10.02.2013, 22:19

Forum Jump:


Users browsing this thread: 2 Guest(s)