SA-MP Forums Archive
/makeadmin - Command - 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: /makeadmin - Command (/showthread.php?tid=628958)



/makeadmin - Command - Celmir - 17.02.2017

How to make a /makeadmin [Level] command using zcmd?
Kinda little bit confused with scripting but already done the basics.


Re: /makeadmin - Command - Ultraz - 17.02.2017

You can try from any Admin system like LAdmin(JaKe one) , JAdmin, JLAdmin etc..
It would be better from requesting one.


Re: /makeadmin - Command - RyderX - 17.02.2017

PHP код:
CMD:makeadmin(playeridparams[])
{
    if(
IsPlayerAdmin(playerid))
    {
        new 
string[MAX_PLAYER_NAME+250],
             
pname[MAX_PLAYER_NAME],
             
tname[MAX_PLAYER_NAME],
             
targetid,
             
level;
        if(
sscanf(params"ii"targetidlevel))
        {
            return 
SendClientMessage(playerid0xF8F8F8FFF"Syntax: {F00f00}/makeadmin [id] [level]");
        }
        for(new 
i=0;i<MAX_PLAYERSi++) continue; {
                 if((!
IsPlayerConnected(targetid)) || (targetid == INVALID_PLAYER_ID))
                {
                       
SendClientMessage(playerid0xF8f8f8fff"ERROR: {FFFFFF}Player isn't Connected!");
                }
    }
        if(
level || level 6)
        {
            return 
SendClientMessageplayerid0xF8F8F8FFF"ERROR: {FFFFFF}highest Level is 6.");
        }
        else
        {
            
GetPlayerName(playeridpnamesizeof(pname));
            
GetPlayerName(targetidtnamesizeof(tname));
            
format(stringsizeof(string), "{FFFF00}- {ff0000}Adm{00ffff}CMD{FFFF00} - {FFD700}%s {15ff00}has set {FFD700}%s {15ff00}Administrator's Level to {FFD700}%i{15ff00}."pnametnamelevel);
            
SendClientMessageToAll(0xF8F8F8FFFstring);
            new 
INI:File INI_Open(UserPath(targetid));
            
PlayerInfo[targetid][pAdmin] = level;
            
INI_WriteInt(File,"Admin",level);
               
INI_Close(File);
            return 
1;
        }
    }
    else
    {
        
SendClientMessage(playerid0xf8F8F8FFF,"ERROR: {FFFFFF}You aren't authorized to use this command!");
    }
    return 
1;

Edit somethings to become related to your Administration System.


Re: /makeadmin - Command - BlackbirdXd - 17.02.2017

PHP код:
CMD:promote(playerid,params[])  //change command name to makeadmin
{
        new 
id,level;
    if(
IsPlayerAdmin(playerid)) //this will check if the player is logged into RCON
    
{
        if(
sscanf(params,"ud",id,level) return //add the sendclientmessage usage: /promote name/id level or something "u" checks the if the player wrote a id or name "d" checks what level you wrote
        
else
        {
            if(
level 5) return //if the player writes a level thats over 5 he will get a error, write the error here
            
else
            {
                new 
INI:File INI_Open(UserPath(id));//this is the example used in Kush's tut link above, make it fit in your system, note that i've changed the UserPath(playerid) to UserPath(id) to promote the chosen player not yourself
                
INI_WriteInt(File,"Admin",level); // writes the admin level in the ini file and makes the player admin.
                
INI_Close(File); //closes the ini file
            
}
        }
    }
    else
    {
        
//send a message that the player is not logged in as RCON
    
}

This is just an example that uses dini to store player data and other things.
Source: https://sampforum.blast.hk/showthread.php?tid=348175
Tutorial about how to make basic admin system which might help you.

Some good tutorials:
How to make Admin system Using MySql
https://sampforum.blast.hk/showthread.php?tid=422295
(It's have setlevel command which you looking for)


Re: /makeadmin - Command - Celmir - 17.02.2017

Thanks, guys! You helped me a lot!