How to put Limit in this?
#19

Quote:
Originally Posted by Harry_Sandhu
View Post
pawn Code:
CMD:makeadmin(playerid, params[])
{
                                                  //24 is max player  name
    new playerid2,level,aName[24],pName2[24],string[128];
    if(level > 6 || level < 0) return SendClientMessage(playerid, ERROR,"Usage: /makeadmin [Playerid/PartOfName][Level(0-6)]");
    if(PlayerInfo[playerid][pAdmin] < PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, ERROR,"You cannot promote/demote a Higher rank admin than you.");
    if(level > 6 || level < 0) return SendClientMessage(playerid, COLOR_RED,"System: Valid Admin Levels: 0-6!");
    if(PlayerInfo[playerid][pAdmin] > 4 || IsPlayerAdmin(playerid)) {
        if(sscanf(params,"ud",playerid2,level)) return SendClientMessage(playerid, ERROR,"Usage: /makeadmin [Playerid/PartOfName][Level(0-6)]");
        if(!IsPlayerConnected(playerid2)) return SendClientMessage(playerid,ERROR,"Invalid Player.");

        GetPlayerName(playerid, aName,24);
        GetPlayerName(playerid2, pName2,24);

        format(string,sizeof(string), "Admin %s gave you Admin level %d",aName,level);
        SendClientMessage(playerid2, COLOR_YELLOW, string);

        format(string,sizeof(string), "You gave Admin level %d to %s",level,pName2);
        SendClientMessage(playerid, ADMIN, string);

        format(string, sizeof(string),"Admin %s gave admin level %d to %s",aName,level,pName2);
        SendAdminMessage(COLOR_RED, string);

        PlayerInfo[playerid2][pAdmin] = level;
        return 1;
    }
    SendClientMessage(playerid, ERROR, "You are not authorized to use that command.");
    return 1;
}
haha fail, forgot we were already working on this.

The problem isnt my code i dont think.

Try my code.

pawn Code:
CMD:setadmin(playerid, params[])
{
    new victimname[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], admlvl, id;
    if(IsPlayerAdmin(playerid))
    {
        if (sscanf(params, "ui", id, admlvl)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setadmin [id] [adminlevel]");
        if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "System: Invalid ID");
        if (admlvl > 10 || admlvl < 0) return SendClientMessage(playerid, COLOR_RED,"System: Valid Admin Levels: 1-10!");
        PlayerInfo[id][pAdminLevel] = admlvl;
        GetPlayerName(id, victimname, sizeof(victimname));
        GetPlayerName(playerid, adminname, sizeof(adminname));
        new str[128];
        format(str,128,"System: %s [ID %d] has set %s [ID %d] admin level to %i",adminname, playerid, victimname, id, admlvl);
        SendClientMessage(playerid,COLOR_GREEN,str);
        return 1;
    }
    else return SendClientMessage(playerid,COLOR_RED,"  You are not allowed to use this command!");
}
Reply


Messages In This Thread
How to put Limit in this? - by Harry_Sandhu - 31.07.2011, 04:28
Re: How to put Limit in this? - by Shockey HD - 31.07.2011, 04:30
Re: How to put Limit in this? - by Harry_Sandhu - 31.07.2011, 04:36
Re: How to put Limit in this? - by Shockey HD - 31.07.2011, 04:39
Re: How to put Limit in this? - by Harry_Sandhu - 31.07.2011, 04:41
Re: How to put Limit in this? - by Shockey HD - 31.07.2011, 04:43
Re: How to put Limit in this? - by Harry_Sandhu - 31.07.2011, 04:45
Re: How to put Limit in this? - by Shockey HD - 31.07.2011, 04:46
Re: How to put Limit in this? - by Harry_Sandhu - 31.07.2011, 04:47
Re: How to put Limit in this? - by Harry_Sandhu - 31.07.2011, 04:51
Re: How to put Limit in this? - by Shockey HD - 31.07.2011, 04:55
Re: How to put Limit in this? - by Harry_Sandhu - 31.07.2011, 05:02
Re: How to put Limit in this? - by Shockey HD - 31.07.2011, 05:06
Re: How to put Limit in this? - by Harry_Sandhu - 31.07.2011, 05:07
Re: How to put Limit in this? - by Shockey HD - 31.07.2011, 05:09
Re: How to put Limit in this? - by Harry_Sandhu - 31.07.2011, 05:09
Re: How to put Limit in this? - by Shockey HD - 31.07.2011, 05:15
Re: How to put Limit in this? - by Harry_Sandhu - 31.07.2011, 05:15
Re: How to put Limit in this? - by Shockey HD - 31.07.2011, 05:23
Re: How to put Limit in this? - by Harry_Sandhu - 31.07.2011, 07:32
Re: How to put Limit in this? - by Harry_Sandhu - 31.07.2011, 07:39
Re: How to put Limit in this? - by Nenad - 31.07.2011, 07:55
Re: How to put Limit in this? - by iggy1 - 31.07.2011, 08:04

Forum Jump:


Users browsing this thread: 4 Guest(s)