Alguem poderia me ajudar a criar comando de /daradmin - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Alguem poderia me ajudar a criar comando de /daradmin (
/showthread.php?tid=647458)
Alguem poderia me ajudar a criar comando de /daradmin -
ShuCk - 05.01.2018
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].
Re: Alguem poderia me ajudar a criar comando de /daradmin -
jasperschellekens - 05.01.2018
This is completely different to your gamemode.
And btw, this is ENGLISH only as far as i know.
but you can do it like this.
PHP код:
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;
}
You can also add some sort of /setlevel ID LEVEL
PHP код:
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;
}