/makeadmin cmd
#1

I need help with a makeadmin command, here are my enums
pawn Код:
enum PlayerInfo
{
    Pass[129],
    pAdmin,
    pVip,
    pTrusted,
    Money,
    Scores,
    Kills,
    Deaths
}
new pInfo[MAX_PLAYERS][PlayerInfo];
Reply
#2

-Delete-
Reply
#3

use mine server makeadmin--
Код:
CMD:makeadmin(playerid,parmas[])
{
if(IsPlayerAdmin(playerid))
{
new targetid,lvl,dis[150];
if(sscanf(parmas,"ui",targetid,lvl))return SendClientMessage(playerid,-1,"{ff0000}Wrong Usagge | Correct Usage /makeadmin playerid adminLevel");
pInfo[targetid][pAdmin]=lvl;
if(lvl>=1)
{format(dis,sizeof(dis),"~g~Congratulations you have now~n~~r~been made admin level %i",lvl);
 GameTextForPlayer(targetid,dis,9000,6);
 PlayerPlaySound(targetid, 4201 , 0.0, 0.0, 0.0);
}
if(lvl==0)
{
format(dis,sizeof(dis),"~r~You have been demoted form the post of admin~n~~g~Thnaks for the service");
GameTextForPlayer(targetid,dis,9000,6);}}
else SendClientMessage(playerid, -1,"{ff0000}You are not authorized to use this command.");

return 1;}
Reply
#4

pawn Код:
CMD:setlevel(playerid,params[])
{
    new ID, level;
   
    if(pInfo[playerid][pAdmin] < 3) // change 3 to owner level
    {
        SendClientMessage(playerid,COLOR_WHITE,"{B30000}[ERROR] {FFFFFF}You don't have access to this command.");
        return 1;
    }
   
    if(sscanf(params,"ii", ID, level))
    {
        SendClientMessage(playerid,COLOR_WHITE,"{B30000}[ERROR] {FFFFFF}USAGE: /setlevel [playerid] [Level]");
        return 1;
    }

    pInfo[ID][pAdmin] = level;

    return 1;
}
just finish it off with whatever you want to add in
Reply
#5

Thanks man!
Reply
#6

pawn Код:
CMD:setlevel(playerid,params[])
{
    new ID, level;
    if(pInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid,COLOR_WHITE,"{B30000}[ERROR] {FFFFFF}You don't have access to this command.");
    if(sscanf(params,"ui", ID, level))
    {
        SendClientMessage(playerid,COLOR_WHITE,"{B30000}[ERROR] {FFFFFF}USAGE: /setlevel [playerid] [Level]");
        return 1;
    }
    pInfo[ID][pAdmin] = level;
    return 1;
}
Correction for the post above.
Reply
#7

Quote:
Originally Posted by Xsyiaris
Посмотреть сообщение
pawn Код:
CMD:setlevel(playerid,params[])
{
    new ID, level;
    if(pInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid,COLOR_WHITE,"{B30000}[ERROR] {FFFFFF}You don't have access to this command.");
    if(sscanf(params,"ui", ID, level))
    {
        SendClientMessage(playerid,COLOR_WHITE,"{B30000}[ERROR] {FFFFFF}USAGE: /setlevel [playerid] [Level]");
        return 1;
    }
    pInfo[ID][pAdmin] = level;
    return 1;
}
Correction for the post above.
I don't see any issue - "i" works perfect as I use it..
"u" just means the username/ID, but it's optional.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)