Set admin
#1

Hey guys, so I am having a problem.So I made a set admin command for rcon admins
pawn Код:
CMD:rmakeadmin(playerid, params[]) // CMD for making someone an admin...
{
    new pid;
    new alevel;
    new str[128];
    if(sscanf(params,"ui", pid, alevel)) return SendClientMessage(playerid, -1, "USAGE: /rmakeadmin [playerid] [admin level]");
    if (IsPlayerAdmin(playerid))
    {
        if((alevel<=5)&&(alevel>=1))
        {
            if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player specified !");
            format(str, sizeof(str), "* You have promoted player %s to a level %i admin.", GetName(pid), alevel);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
            format(str, sizeof(str), "* You have been promoted to a level %i admin by a Administrator.", alevel);
            SendClientMessage(pid, COLOR_LIGHTBLUE, str);
            PlayerInfo[pid][pAdmin] = alevel;
        }
        else SendClientMessage(playerid, COLOR_GREY, "  Invalid admin level specified (Admin Level 1-5)");
    }
    else SendClientMessage(playerid, COLOR_GREY, "  You are not authorized to use this command !");
    return 1;
}
So about this, when I /rmakeadmin while logged in RCON. I type /rmakeadmin [then my id here] 5
Also the highest level admin is 5.But then when I type in the command, It says like the player is not connected.I'm the only player connected which is ID 0, isn't this code correct?
I really need help.
Reply
#2

pawn Код:
CMD:rmakeadmin(playerid, params[]) // CMD for making someone an admin...
{
    new pid;
    new alevel;
    new str[128];
    if(sscanf(params,"ui", pid, alevel)) return SendClientMessage(playerid, -1, "USAGE: /rmakeadmin [playerid] [admin level]");
    if (IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "  You are not authorized to use this command !");
    if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player specified !");
    if((alevel<=5)&&(alevel>=1)) return SendClientMessage(playerid, COLOR_GREY, "  Invalid admin level specified (Admin Level 1-5)");
    {
        format(str, sizeof(str), "* You have promoted player %s to a level %i admin.", GetName(pid), alevel);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
        format(str, sizeof(str), "* You have been promoted to a level %i admin by a Administrator.", alevel);
        SendClientMessage(pid, COLOR_LIGHTBLUE, str);
        PlayerInfo[pid][pAdmin] = alevel;
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by rVar
Посмотреть сообщение
pawn Код:
CMD:rmakeadmin(playerid, params[]) // CMD for making someone an admin...
{
    new pid;
    new alevel;
    new str[128];
    if(sscanf(params,"ui", pid, alevel)) return SendClientMessage(playerid, -1, "USAGE: /rmakeadmin [playerid] [admin level]");
    if (IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "  You are not authorized to use this command !");
    if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player specified !");
    if((alevel<=5)&&(alevel>=1)) return SendClientMessage(playerid, COLOR_GREY, "  Invalid admin level specified (Admin Level 1-5)");
    {
        format(str, sizeof(str), "* You have promoted player %s to a level %i admin.", GetName(pid), alevel);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
        format(str, sizeof(str), "* You have been promoted to a level %i admin by a Administrator.", alevel);
        SendClientMessage(pid, COLOR_LIGHTBLUE, str);
        PlayerInfo[pid][pAdmin] = alevel;
    }
    return 1;
}
I'll try that.

EDIT: Not working, still says player not connected.
Reply
#4

Not working, still says player not connected.
Reply
#5

try this:

Код:
CMD:rmakeadmin(playerid, params[]) // CMD for making someone an admin...
{
    new pid;
    new alevel;
    new str[128];
    if(sscanf(params,"dd", pid, alevel)) return SendClientMessage(playerid, -1, "USAGE: /rmakeadmin [playerid] [admin level]");
    if (IsPlayerAdmin(playerid))
    {
        if((alevel<=5)&&(alevel>=1))
        {
            if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player specified !");
            format(str, sizeof(str), "* You have promoted player %s to a level %i admin.", GetName(pid), alevel);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
            format(str, sizeof(str), "* You have been promoted to a level %i admin by a Administrator.", alevel);
            SendClientMessage(pid, COLOR_LIGHTBLUE, str);
            PlayerInfo[pid][pAdmin] = alevel;
        }
        else SendClientMessage(playerid, COLOR_GREY, "  Invalid admin level specified (Admin Level 1-5)");
    }
    else SendClientMessage(playerid, COLOR_GREY, "  You are not authorized to use this command !");
    return 1;
}
Reply
#6

Quote:
Originally Posted by Marlon_Lorran
Посмотреть сообщение
try this:

Код:
CMD:rmakeadmin(playerid, params[]) // CMD for making someone an admin...
{
    new pid;
    new alevel;
    new str[128];
    if(sscanf(params,"dd", pid, alevel)) return SendClientMessage(playerid, -1, "USAGE: /rmakeadmin [playerid] [admin level]");
    if (IsPlayerAdmin(playerid))
    {
        if((alevel<=5)&&(alevel>=1))
        {
            if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player specified !");
            format(str, sizeof(str), "* You have promoted player %s to a level %i admin.", GetName(pid), alevel);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
            format(str, sizeof(str), "* You have been promoted to a level %i admin by a Administrator.", alevel);
            SendClientMessage(pid, COLOR_LIGHTBLUE, str);
            PlayerInfo[pid][pAdmin] = alevel;
        }
        else SendClientMessage(playerid, COLOR_GREY, "  Invalid admin level specified (Admin Level 1-5)");
    }
    else SendClientMessage(playerid, COLOR_GREY, "  You are not authorized to use this command !");
    return 1;
}
Sure, I'll edit my post if it works or not.

EDIT: Thanks man, IT ACUTALLY WORKED REP+
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)