05.01.2018, 14:01
Gente estou criando um servidor de RPG do 0 mais sу estou com dъvida de como poderia criar um comando para dar admin no meu servidor, vocкs podem criar? pode ser de 1 level sу. Exemplo:/DarLider [id] [level].
new AdminLevel[MAX_PLAYERS];
//==============================================================================
CMD:makemeadmin(playerid, params[])
{
if(!IsAdmin(playerid, 1)) return SendClientMessage(playerid, COLOR_RED, "You are not admin!"); // must be loggedin on rcon.
AdminLevel[playerid] = 6;
return 1;
}
CMD:adminexamplecommand(playerid,params[])
{
if(AdminLevel[playerid] >=1) //Now to add a restriction in commands you can do this
{
// do something
}else return SendClientMessage(playerid,GREY,"You are not an admin");
return 1;
}
CMD:setlevel(playerid,params[])
{
new levels,str[128],ID,mode[128];
if(AdminLevel[playerid] >=6 || IsPlayerAdmin(playerid)) // = level 6 or higher / or logged into rcon
{
if(sscanf(params,"ui",ID,levels)) return SendClientMessage(playerid,GREY,"USAGE: /setlevel [playerid] [Level 1-6]");
if(levels > 6) return SendClientMessage(playerid,GREY,"LEVELS AVAILABLE 1-4");
if(!IsPlayerConnectedEx(ID))return SendClientMessage(playerid,GREY,"Invalid player ID");
if(AdminLevel[ID]==levels) return SendClientMessage(playerid,GREY,"That player is already this Administrator level");
if(levels==0)
{mode="{FFFFFF}Regular Player";}
if(levels==1)
{mode="{00CC00}Helper";}
if(levels==2)
{mode="{FF0000}Moderator";}
if(levels==3)
{mode="{FF0000}Administrator";}
if(levels==4)
{mode="{FF0000}Senior Administrator";}
if(levels==5)
{mode="{FF0000}Manager Administrator";}
if(levels==6)
{mode="{FF0000}Leader Administrator";}
format(str,sizeof(str),"An Administrator has set your level to %s",mode);
SendClientMessage(ID,YELLOW,str);
format(str,sizeof(str),"You have set %s's level to %s",PlayerName(ID),mode);
SendClientMessage(playerid,YELLOW,str);
AdminLevel[ID]=levels;
}else return 0;
return 1;
}