Modifying My /makeadmin command
#1

Hello i create makeadmin command now i need to modify it
just like LuxAdmin Here is i want to copy just like LuxAdmin
i try it many times but it still give me bug ingame.

Order List Needed:
You cant Set The Level of The Admin that already in that level
GameText "Promote" when promote to 1 to 10
GameText "Demote" When demote to (example your level 7) became level 6

Here is my makeadmin command:

pawn Code:
CMD:makeadmin(playerid, params[])
{
    new victimname[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], admlvl, id;
    if(PlayerInfo[playerid][pAdmin] >= 10 || IsPlayerAdmin(playerid))
    {
        if (sscanf(params, "ui", id, admlvl)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setadmin <playerid/name> <level>");
        if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "ERROR: Invalid ID");
        if (admlvl > 10 || admlvl < 0) return SendClientMessage(playerid, COLOR_RED,"ERROR: Available Admin Levels: 1-10!");
        PlayerInfo[id][pAdmin] = admlvl;
        GetPlayerName(id, victimname, sizeof(victimname));
        GetPlayerName(playerid, adminname, sizeof(adminname));
        new str[128];
        format(str,128,"Administrator %s has set %s Admin Level to %i",adminname,victimname,admlvl);
        SendClientMessage(playerid,COLOR_GREEN,str);
        format(str, sizeof(str), "Administrator %s has made %s to Admin Level %i",adminname,victimname,admlvl);
        SendToAdmins(COLOR_GREY,str);
        format(str, sizeof(str), "Administrator %s has made %s to Admin Level %i",adminname,victimname,admlvl);
        printf(str);
    }
    else return SendClientMessage(playerid,COLOR_RED,"ERROR: You");
    return 1;
}
heres my other problem that post yesterday

https://sampforum.blast.hk/showthread.php?tid=291291

Please Help me guys
Reply
#2

pawn Code:
if(admlvl == PlayerInfo[id][pAdmin]) return SendClientMessage(playerid, COLOR_RED,"You cant Set The Level of The Admin that already in that level");



if(admlvl > PlayerInfo[id][pAdmin])
{
    GameTextForPlayer(id,"Promoted",3000,3);
}
else if(admlvl < PlayerInfo[id][pAdmin])
{
    GameTextForPlayer(id,"Demoted",3000,3);
}
just try
Reply
#3

pawn Code:
GetPlayerName(id, victimname, sizeof(victimname));
Where the id come from?
Reply
#4

from here
pawn Code:
if (sscanf(params, "ui", id, admlvl))
/command id level
Reply
#5

pawn Code:
new victimname[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], admlvl, id;
here
Reply
#6

Oh okay
Reply
#7

Jumbo didnt work
Reply
#8

pawn Code:
CMD:setlevel(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,GREY,"You are not an RCON admin!");//if the player is not rcon admin
    new level, target;
    if(sscanf(params, "ud", target, level)) return SendClientMessage(playerid, COLOR_RED, "ERROR: Usage '/setlevel <playerid/name> <level>'");
    if(!IsPlayerConnected(target)) return SendClientMessage(playerid,GREY,"You have entered an incorrect ID"); //if the id is not connected

    format(file,sizeof(file),"MyAdmin/Users/%s.txt", pName(target));
    PInfo[target][pAdminLevel] = level;
    dini_IntSet(file, "Level", level);

    new str[90];
    format(str,sizeof(str),"You have set %s's level to %d", pName(target), level);
    SendClientMessage(playerid,LIGHTBLUE,str);
    return 1;
}
Just change some settings in the code okay?
Reply
#9

pawn Code:
CMD:makeadmin(playerid, params[])
{
    new victimname[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], admlvl, id;
    if(PlayerInfo[playerid][pAdmin] >= 10 || IsPlayerAdmin(playerid))
    {
        if (sscanf(params, "ui", id, admlvl)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setadmin <playerid/name> <level>");
        if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "ERROR: Invalid ID");
        if (admlvl > 10 || admlvl < 0) return SendClientMessage(playerid, COLOR_RED,"ERROR: Available Admin Levels: 1-10!");
        if(PlayerInfo[id][pAdmin] == admlvl) return SendClientMessage(playerid,COLOR_RED,"ERROR: This player is already this level!");
        if(PlayerInfo[id][pAdmin] > admlvl) return GameTextForPlayer(id,"~g~~h~Promoted!",4000,3);
        if(PlayerInfo[id][pAdmin] < admlvl) return GameTextForPlayer(id,"~r~~h~Demoted!",4000,3);
        PlayerInfo[id][pAdmin] = admlvl;
        GetPlayerName(id, victimname, sizeof(victimname));
        GetPlayerName(playerid, adminname, sizeof(adminname));
        new str[128];
        format(str,128,"Administrator %s has set %s Admin Level to %i",adminname,victimname,admlvl);
        SendClientMessage(playerid,COLOR_GREEN,str);
        format(str, sizeof(str), "Administrator %s has made %s to Admin Level %i",adminname,victimname,admlvl);
        SendToAdmins(COLOR_GREY,str);
        format(str, sizeof(str), "Administrator %s has made %s to Admin Level %i",adminname,victimname,admlvl);
        printf(str);
    }
    else return SendClientMessage(playerid,COLOR_RED,"ERROR: You");
    return 1;
}
Reply
#10

pawn Code:
CMD:makeadmin(playerid, params[])
{
    new victimname[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], admlvl, id;
    if(PlayerInfo[playerid][pAdmin] >= 10 || IsPlayerAdmin(playerid))
    {
        //check part
        if (sscanf(params, "ui", id, admlvl)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setadmin <playerid/name> <level>");
        if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "ERROR: Invalid ID");
        if (admlvl > 10 || admlvl < 0) return SendClientMessage(playerid, COLOR_RED,"ERROR: Available Admin Levels: 1-10!");
        if(admlvl == PlayerInfo[id][pAdmin]) return SendClientMessage(playerid, COLOR_RED,"You cant Set The Level of The Admin that already in that level");
        //if all check part are ok ..
        if(admlvl > PlayerInfo[id][pAdmin])
        {
            GameTextForPlayer(id,"Promoted",3000,3);
        }
        else if(admlvl < PlayerInfo[id][pAdmin])
        {
            GameTextForPlayer(id,"Demoted",3000,3);
        }
        PlayerInfo[id][pAdmin] = admlvl;
        GetPlayerName(id, victimname, sizeof(victimname));
        GetPlayerName(playerid, adminname, sizeof(adminname));
        new str[128];
        format(str,128,"Administrator %s has set %s Admin Level to %i",adminname,victimname,admlvl);
        SendClientMessage(playerid,COLOR_GREEN,str);
        format(str, sizeof(str), "Administrator %s has made %s to Admin Level %i",adminname,victimname,admlvl);
        SendToAdmins(COLOR_GREY,str);
        format(str, sizeof(str), "Administrator %s has made %s to Admin Level %i",adminname,victimname,admlvl);
        printf(str);
    }
    else return SendClientMessage(playerid,COLOR_RED,"ERROR: You");
    return 1;
}
you try like this?


edit : [MWR]Blood beat me in time <.<
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)