Makeadmin Command (zcmd)
#1

I need some help with making a CMD:makeadmin
command with zcmd,I am using y_ini and my setup for the enum is like this

pAdmin
pScore
pCash
pVipLevel
pOwner
etc
and its PlayerInfo not pInfo or what ever :P
I need someone to direct me to a tutorial that makes this command that only works with if your pAdmin level = #
I dont use rcon so I dont want it for if you login with it
Reply
#2

This might not be the best explained command but hey ho.
pawn Код:
CMD:makeadmin(playerid, params[]) // /makeadmin command
{
    if(PlayerInfo[playerid][pAdmin] >= 5) // Checking if their admin level is equal to or above 5.
    {
        new id, string[128], level; // defines.
        if(sscanf(params, "dd", id, level)) return SendClientMessage(playerid, COLOR_RED, "(INFO): /makeadmin [id] [level]"); // if they type '/makeadmin' it'll show the correct parameters.
        format(string, sizeof(string), "You've been promoted to a level %d Administrator.", level); // Confirming they've given their chosen ID the admin level they wanted to give.
        SendClientMessage(id, COLOR_LIGHTBLUE, string); // Sends the message to the one being promoted.
        PlayerInfo[id][pAdmin] = level; // Sets their Admin level.
    }
    else return SendClientMessage(playerid, COLOR_RED, "You don't have access to this command."); // If they're not equal to or above 5, tell them they can't use the command.
    return 1;
}
Reply
#3

i guess that this will run
pawn Код:
COMMAND:setadmin(playerid, params[])
{

        if(PlayerInfo[playerid][Adminlevel] <= 5) return SendClientMessage(playerid, -1, "AdmCmd: You don't have the privilege to use this command.");
        new
            string[1000],playerid,level;
        if(sscanf(params, "ui", playerid,level)) return SendClientMessage(playerid, -1, "Info: /Setadmin (Playerid) (Adminlevel)");
        if(playerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Error: Wrong Playerid.");
        if(level >= 8 || level <= 0) return SendClientMessage(playerid,-1,"Error: Max admin level is ( 7 ).");
        format(string,sizeof(string),"AdmCmd: Administrator \"%s (%d)\" has set your admin level to ( Level: %d ).",GetName(playerid),playerid,level);
        SendClientMessage(playerid,-1,string);
        format(string,sizeof(string),"AdmCmd: You have set player \"%s (%d)\" admin level to ( Level: %d ).",GetName(playerid),playerid,level);
        SendClientMessage(playerid,-1,string);
        PlayerInfo[playerid][Adminlevel] = level;
        return 1;
}
also you may define
pawn Код:
#define SCM  SendClientMessage
thats if you don't want to write SendClientMessage
Reply
#4

Thank you very much man,been trying to figure this out for a while XD I am fairly new at scripting,but I am making a pretty cool unique gamemode, ^_^ need this stuff,hey man,do you know if I can use a admin filterscript that uses dini,even though I use y_ini in my gm script?
Reply
#5

Quote:
Originally Posted by NinjahZ
Посмотреть сообщение
I need someone to direct me to a tutorial that makes this command
Quote:
Originally Posted by Rafael_Zambrano
Посмотреть сообщение
i guess that this will run
pawn Код:
COMMAND:setadmin(playerid, params[])
{

        if(PlayerInfo[playerid][Adminlevel] <= 5) return SendClientMessage(playerid, -1, "AdmCmd: You don't have the privilege to use this command.");
        new
            string[1000],playerid,level;
        if(sscanf(params, "ui", playerid,level)) return SendClientMessage(playerid, -1, "Info: /Setadmin (Playerid) (Adminlevel)");
        if(playerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Error: Wrong Playerid.");
        if(level >= 8 || level <= 0) return SendClientMessage(playerid,-1,"Error: Max admin level is ( 7 ).");
        format(string,sizeof(string),"AdmCmd: Administrator \"%s (%d)\" has set your admin level to ( Level: %d ).",GetName(playerid),playerid,level);
        SendClientMessage(playerid,-1,string);
        format(string,sizeof(string),"AdmCmd: You have set player \"%s (%d)\" admin level to ( Level: %d ).",GetName(playerid),playerid,level);
        SendClientMessage(playerid,-1,string);
        PlayerInfo[playerid][Adminlevel] = level;
        return 1;
}
also you may define
pawn Код:
#define SCM  SendClientMessage
thats if you don't want to write SendClientMessage
I know you're trying to help an' all, but he asked for a tutorial, not a command you've ripped out of a script. Binx was correct by adding comments to let the beginner know what was happening.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)