/setadmin command help
#1

I need help with my /setadmin command. So it's working with this code:

pawn Код:
CMD:setadmin(playerid, params[])
{
    new id, adminlevel;
    if(PlayerInfo[playerid][pAdmin] <= 4) return SendClientMessage(playerid, COLOR_SILVER, "You must be atleast a Community Owner to use this command!");
    else if(sscanf(params, "ud", id, adminlevel)) return SendClientMessage(playerid, COLOR_SILVER, "Syntax: /setadmin [PlayerID][Admin Level]");
    else if(adminlevel < 0 || adminlevel > 5) return SendClientMessage(playerid, COLOR_SILVER, "Error: Must be level 1-5!");
    else
    {
        if(PlayerInfo[id][pAdmin] == adminlevel) return SendClientMessage(playerid, COLOR_SILVER, "Error: This player is already that level!");
        else
        {
            PlayerInfo[id][pAdmin] = adminlevel;
        }
    }
    return 1;
}
Ok, so I want it to say:

"[AdmCmd] %s %s(ID:%d) had made %s(ID:%d) a %s"

I want the %s's and the %d's to be:

Rank of person who typed the command
Person who typed the command's name
Person who typed the command's ID.
Person who's ID was typed's name
Person who's ID was typed's ID
Rank they have become.

So, for example:
"[AdmCmd] Community Owner Joe_Maclesfield(ID:0) has made Alfie_Lester(ID:1) a Moderator!"

Ok, so I would not have a problem apart from the fact that a level 1 administrator is a moderator, so it would say:
"[AdmCmd] 5 Joe_Maclesfield(ID:%d) has made Alfie_Lester(ID:%d) a 1!"
instead of:
"[AdmCmd] Community Owner Joe_Maclesfield(ID:%d) has made Alfie_Lester(ID:%d) a Moderator!"


Sorry, I know that this question is incorrectly worded. I'm having trouble explaining it.

So, how would I define:
1 as Moderator
2 as Trial Administrator
3 as Administrator
4 as Lead Administrator
5 as Community Owner.

to make it say Community Owner instead of 5 in this one command.

If you cannot understand what I mean or need me to reword it all, just ask please.

Thanks a lot,
anjh.
Reply
#2

Untested but tell me if this works:

pawn Код:
CMD:setadmin(playerid, params[])
{
    new id, adminlevel,MyRank[32],HisRank[32],MyName[32],HisName[32];
    if(PlayerInfo[playerid][pAdmin] <= 4) return SendClientMessage(playerid, COLOR_SILVER, "You must be atleast a Community Owner to use this command!");
    else if(sscanf(params, "ud", id, adminlevel)) return SendClientMessage(playerid, COLOR_SILVER, "Syntax: /setadmin [PlayerID][Admin Level]");
    else if(adminlevel < 0 || adminlevel > 5) return SendClientMessage(playerid, COLOR_SILVER, "Error: Must be level 1-5!");
    else
    {
        if(PlayerInfo[id][pAdmin] == adminlevel) return SendClientMessage(playerid, COLOR_SILVER, "Error: This player is already that level!");
        else
        {
            GetPlayerName(playerid,MyName,32);
            GetPlayerName(id,HisName,32);
            PlayerInfo[id][pAdmin] = adminlevel;
            if(PlayerInfo[playerid][pAdmin] == 1){MyRank = "Moderator";}
            if(PlayerInfo[playerid][pAdmin] == 2){MyRank = "Trial Administrator";}
            if(PlayerInfo[playerid][pAdmin] == 3){MyRank = "Administrator";}
            if(PlayerInfo[playerid][pAdmin] == 4){MyRank = "Lead Administrator";}
            if(PlayerInfo[playerid][pAdmin] == 5){MyRank = "Community Owner";}

            if(PlayerInfo[id][pAdmin] == 1){HisRank = "Moderator";}
            if(PlayerInfo[id][pAdmin] == 2){HisRank = "Trial Administrator";}
            if(PlayerInfo[id][pAdmin] == 3){HisRank = "Administrator";}
            if(PlayerInfo[id][pAdmin] == 4){HisRank = "Lead Administrator";}
            if(PlayerInfo[id][pAdmin] == 5){HisRank = "Community Owner";}

            new string[128];
            format(string, sizeof(string), "[AdmCmd] %s %s(ID:%d) had made %s(ID:%d) a %s",MyRank,MyName,playerid,HisName,id,HisRank);
            SendClientMessageToAll(COLOR_YELLOW,string);

        }
    }
    return 1;
}
This is one way of making it, you could have a way using a function.
Reply
#3

Quote:
Originally Posted by Shockey HD
Посмотреть сообщение
Untested but tell me if this works:

pawn Код:
CMD:setadmin(playerid, params[])
{
    new id, adminlevel,MyRank[32],HisRank[32],MyName[32],HisName[32];
    if(PlayerInfo[playerid][pAdmin] <= 4) return SendClientMessage(playerid, COLOR_SILVER, "You must be atleast a Community Owner to use this command!");
    else if(sscanf(params, "ud", id, adminlevel)) return SendClientMessage(playerid, COLOR_SILVER, "Syntax: /setadmin [PlayerID][Admin Level]");
    else if(adminlevel < 0 || adminlevel > 5) return SendClientMessage(playerid, COLOR_SILVER, "Error: Must be level 1-5!");
    else
    {
        if(PlayerInfo[id][pAdmin] == adminlevel) return SendClientMessage(playerid, COLOR_SILVER, "Error: This player is already that level!");
        else
        {
            GetPlayerName(playerid,MyName,32);
            GetPlayerName(id,HisName,32);
            PlayerInfo[id][pAdmin] = adminlevel;
            if(PlayerInfo[playerid][pAdmin] == 1){MyRank = "Moderator";}
            if(PlayerInfo[playerid][pAdmin] == 2){MyRank = "Trial Administrator";}
            if(PlayerInfo[playerid][pAdmin] == 3){MyRank = "Administrator";}
            if(PlayerInfo[playerid][pAdmin] == 4){MyRank = "Lead Administrator";}
            if(PlayerInfo[playerid][pAdmin] == 5){MyRank = "Community Owner";}

            if(PlayerInfo[id][pAdmin] == 1){HisRank = "Moderator";}
            if(PlayerInfo[id][pAdmin] == 2){HisRank = "Trial Administrator";}
            if(PlayerInfo[id][pAdmin] == 3){HisRank = "Administrator";}
            if(PlayerInfo[id][pAdmin] == 4){HisRank = "Lead Administrator";}
            if(PlayerInfo[id][pAdmin] == 5){HisRank = "Community Owner";}

            new string[128];
            format(string, sizeof(string), "[AdmCmd] %s %s(ID:%d) had made %s(ID:%d) a %s",MyRank,MyName,playerid,HisName,id,HisRank);
            SendClientMessageToAll(COLOR_YELLOW,string);

        }
    }
    return 1;
}
This is one way of making it, you could have a way using a function.

Initially I went about making it in a similar way and I had errors, so I asked the question.
It's nice to see that this works perfectly, thank you very much.

One quick question though. Is there any chance when you do:
Код:
/setadmin 0 3
as in make somebody a level 3 administrator (Called Administrator) for it to do this@
Код:
"Community Owner Joe_Maclesfield(ID:0) has made Alfie Lester(ID:1) an Administrator!"
instead of:
Код:
"Community Owner Joe_Maclesfield(ID:0) has made Alfie Lester(ID:1) a Administrator!"
Thanks,
anjh
Reply
#4

You mean to make it say "an adminstrator" not "a adminstrator" ?
Reply
#5

I'm having troubles of understanding your question..


Can you re-word it for me?

If you are trying to make it say 'an' instead of 'a' then it will be this:

Код:
CMD:setadmin(playerid, params[])
{
    new id, adminlevel,MyRank[32],HisRank[32],MyName[32],HisName[32];
    if(PlayerInfo[playerid][pAdmin] <= 4) return SendClientMessage(playerid, COLOR_SILVER, "You must be atleast a Community Owner to use this command!");
    else if(sscanf(params, "ud", id, adminlevel)) return SendClientMessage(playerid, COLOR_SILVER, "Syntax: /setadmin [PlayerID][Admin Level]");
    else if(adminlevel < 0 || adminlevel > 5) return SendClientMessage(playerid, COLOR_SILVER, "Error: Must be level 1-5!");
    else
    {
        if(PlayerInfo[id][pAdmin] == adminlevel) return SendClientMessage(playerid, COLOR_SILVER, "Error: This player is already that level!");
        else
        {
            GetPlayerName(playerid,MyName,32);
            GetPlayerName(id,HisName,32);
            PlayerInfo[id][pAdmin] = adminlevel;
            if(PlayerInfo[playerid][pAdmin] == 1){MyRank = "Moderator";}
            if(PlayerInfo[playerid][pAdmin] == 2){MyRank = "Trial Administrator";}
            if(PlayerInfo[playerid][pAdmin] == 3){MyRank = "Administrator";}
            if(PlayerInfo[playerid][pAdmin] == 4){MyRank = "Lead Administrator";}
            if(PlayerInfo[playerid][pAdmin] == 5){MyRank = "Community Owner";}

            if(PlayerInfo[id][pAdmin] == 1){HisRank = "Moderator";}
            if(PlayerInfo[id][pAdmin] == 2){HisRank = "Trial Administrator";}
            if(PlayerInfo[id][pAdmin] == 3){HisRank = "Administrator";}
            if(PlayerInfo[id][pAdmin] == 4){HisRank = "Lead Administrator";}
            if(PlayerInfo[id][pAdmin] == 5){HisRank = "Community Owner";}

            new string[128];
            format(string, sizeof(string), "[AdmCmd] %s %s(ID:%d) had made %s(ID:%d) an %s",MyRank,MyName,playerid,HisName,id,HisRank);
            SendClientMessageToAll(COLOR_YELLOW,string);

        }
    }
    return 1;
}
Reply
#6

Quote:

You mean to make it say "an adminstrator" not "a adminstrator" ?

Yeah, that's what I meant. Sorry about that.

Quote:
Originally Posted by Shockey HD
Посмотреть сообщение
I'm having troubles of understanding your question..


Can you re-word it for me?

If you are trying to make it say 'an' instead of 'a' then it will be this:

Код:
CMD:setadmin(playerid, params[])
{
    new id, adminlevel,MyRank[32],HisRank[32],MyName[32],HisName[32];
    if(PlayerInfo[playerid][pAdmin] <= 4) return SendClientMessage(playerid, COLOR_SILVER, "You must be atleast a Community Owner to use this command!");
    else if(sscanf(params, "ud", id, adminlevel)) return SendClientMessage(playerid, COLOR_SILVER, "Syntax: /setadmin [PlayerID][Admin Level]");
    else if(adminlevel < 0 || adminlevel > 5) return SendClientMessage(playerid, COLOR_SILVER, "Error: Must be level 1-5!");
    else
    {
        if(PlayerInfo[id][pAdmin] == adminlevel) return SendClientMessage(playerid, COLOR_SILVER, "Error: This player is already that level!");
        else
        {
            GetPlayerName(playerid,MyName,32);
            GetPlayerName(id,HisName,32);
            PlayerInfo[id][pAdmin] = adminlevel;
            if(PlayerInfo[playerid][pAdmin] == 1){MyRank = "Moderator";}
            if(PlayerInfo[playerid][pAdmin] == 2){MyRank = "Trial Administrator";}
            if(PlayerInfo[playerid][pAdmin] == 3){MyRank = "Administrator";}
            if(PlayerInfo[playerid][pAdmin] == 4){MyRank = "Lead Administrator";}
            if(PlayerInfo[playerid][pAdmin] == 5){MyRank = "Community Owner";}

            if(PlayerInfo[id][pAdmin] == 1){HisRank = "Moderator";}
            if(PlayerInfo[id][pAdmin] == 2){HisRank = "Trial Administrator";}
            if(PlayerInfo[id][pAdmin] == 3){HisRank = "Administrator";}
            if(PlayerInfo[id][pAdmin] == 4){HisRank = "Lead Administrator";}
            if(PlayerInfo[id][pAdmin] == 5){HisRank = "Community Owner";}

            new string[128];
            format(string, sizeof(string), "[AdmCmd] %s %s(ID:%d) had made %s(ID:%d) an %s",MyRank,MyName,playerid,HisName,id,HisRank);
            SendClientMessageToAll(COLOR_YELLOW,string);

        }
    }
    return 1;
}
Yeah, that's what I meant.

but, it is possible to do it only when the person becomes an Administrator?
Reply
#7

Not tested.
edit: I think you might actually be able to do this:
pawn Код:
CMD:setadmin(playerid, params[])
{
    new id, adminlevel,MyRank[32],HisRank[32],MyName[32],HisName[32];
    if(PlayerInfo[playerid][pAdmin] <= 4) return SendClientMessage(playerid, COLOR_SILVER, "You must be atleast a Community Owner to use this command!");
    else if(sscanf(params, "ud", id, adminlevel)) return SendClientMessage(playerid, COLOR_SILVER, "Syntax: /setadmin [PlayerID][Admin Level]");
    else if(adminlevel < 0 || adminlevel > 5) return SendClientMessage(playerid, COLOR_SILVER, "Error: Must be level 1-5!");
    else
    {
        if(PlayerInfo[id][pAdmin] == adminlevel) return SendClientMessage(playerid, COLOR_SILVER, "Error: This player is already that level!");
        else
        {
            GetPlayerName(playerid,MyName,32);
            GetPlayerName(id,HisName,32);
            PlayerInfo[id][pAdmin] = adminlevel;
            if(PlayerInfo[playerid][pAdmin] == 1){MyRank = "Moderator";}
            if(PlayerInfo[playerid][pAdmin] == 2){MyRank = "Trial Administrator";}
            if(PlayerInfo[playerid][pAdmin] == 3){MyRank = "Administrator";}
            if(PlayerInfo[playerid][pAdmin] == 4){MyRank = "Lead Administrator";}
            if(PlayerInfo[playerid][pAdmin] == 5){MyRank = "Community Owner";}
            if(adminlevel == 3)
           {  
                  new string[128];
                  format(string, sizeof(string), "[AdmCmd] %s %s(ID:%d) had made %s(ID:%d) an                                 Administrator",MyRank,MyName,playerid,HisName,id);
                   SendClientMessageToAll(COLOR_YELLOW,string);
          }

        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)