setlevel
#9

Код:
CMD:setlevel(playerid, params[])
{
    new lookupid, str[128], level;
    if(pData[playerid][Admin] >= 9 || IsPlayerAdmin(playerid))
    {
        if(sscanf(params,"ud",lookupid,level)) return SendClientMessage(playerid, COLOR_YELLOW, "Usage: /setlevel (UserID | UserName) (level)");
        if(pData[lookupid][Admin] > pData[playerid][Admin]) return SendClientMessage(playerid, -1, "Sorry you cant setlevel becoz his level is higher then you");
        if(level == 2 || level > 10 || level < 1 || level == 0) return SendClientMessage(playerid, red, "ERROR: Invalid Level [Levels 3 to 10 or 1]"); // you can change this to any level you want
        if(!IsPlayerConnected(lookupid)) return SendClientMessage(playerid,0xFF0000FF, "Sorry this player isnt connected ");
        if(level < pData[lookupid][Admin])
        {
            new irc[130];
            format(irc,sizeof(str),"8,3* Admin %s (ID: %d) Demoted %s (ID: %d) to level %d",GetName(playerid), playerid,GetName(lookupid),lookupid,level);
            IRC_GroupSay(groupID, IRC_CHANNEL, irc);
            format(str, sizeof(str), "Admin %s (ID:%d) has demoted you to level %d",GetName(playerid), playerid, level);
            SendClientMessage(lookupid, 0xFF0000FF, str);
            format(str, sizeof(str),"You have demoted %s (ID:%d) to level %d",GetName(lookupid),lookupid,level);
            SendClientMessage(playerid, -1, str);
        }
        if(level > pData[lookupid][Admin])
        {
            new irc[130];
            format(irc,sizeof(str),"8,3* Admin %s (ID: %d) granted level %d to %s (ID: %d)",GetName(playerid), playerid, level,GetName(lookupid),lookupid);
            IRC_GroupSay(groupID, IRC_CHANNEL, irc);
            format(str, sizeof(str), "Admin %s (ID:%d) has granted level %d to you",GetName(playerid), playerid, level);
            SendClientMessage(lookupid, COLOR_YELLOW, str);
            format(str, sizeof(str),"You have setted %s (ID:%d) to level %d",GetName(lookupid),lookupid,level);
            SendClientMessage(playerid, COLOR_YELLOW, str);
        }
        pData[lookupid][Admin] = level;
        printf("Setted level %d",level);
        SavePlayerData(playerid);
    }
    else return SendClientMessage(playerid, COLOR_YELLOW, "Only +level 9 can use this command");
    return 1;
}
Reply


Messages In This Thread
setlevel - by Loinal - 13.04.2017, 09:59
Re: setlevel - by NealPeteros - 13.04.2017, 10:15
Re: setlevel - by Loinal - 13.04.2017, 10:19
Re: setlevel - by StrikerZ - 13.04.2017, 10:27
Re: setlevel - by GangstaSunny. - 13.04.2017, 10:28
Re: setlevel - by Loinal - 13.04.2017, 10:34
Re: setlevel - by Banditul18 - 13.04.2017, 10:41
Re: setlevel - by Loinal - 13.04.2017, 10:46
Re: setlevel - by StrikerZ - 13.04.2017, 10:49
Re: setlevel - by Loinal - 13.04.2017, 10:53

Forum Jump:


Users browsing this thread: 1 Guest(s)