/oremovedmin (Offline kicking admins)
#1

I wanted to make this Command but i didn't know how can anyone help me please

pawn Код:
if(strcmp(cmd, "/makeadmin", true) == 0)
    {
        if(PlayerInfo[playerid][pAdmin] >= 99999)
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /makeadmin [playerid/PartOfName] [level]");
                return 1;
            }
            new para1;
            new level;
            para1 = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /makeadmin [playerid/PartOfName] [level]");
                return 1;
            }
            level = strvalEx(tmp);
            if(level > 99999 || level < 0) { SendClientMessage(playerid, COLOR_GREY, "   Don't go below number 0, or above number 99999 (1/2/3/4/1337/99999) !"); return 1; }
            if(IsPlayerConnected(para1))
            {
                if(para1 != INVALID_PLAYER_ID)
                {
                    strmid(giveplayer, PlayerRPName(para1), 0, MAX_PLAYER_NAME);
                    strmid(sendername, PlayerRPName(playerid), 0, MAX_PLAYER_NAME);
                    if(level < 2) PlayerInfo[para1][pTag] = NTAG_PLAYER;
                    else PlayerInfo[para1][pTag] = NTAG_ADMIN;

                    if(PlayerInfo[para1][pAdmin] > PlayerInfo[playerid][pAdmin])
                    {
                        SendClientMessage(playerid, COLOR_GREY,  "That admin has a higher rank than you.");
                        return 1;
                    }
                    if(level > PlayerInfo[para1][pAdmin])
                    {
                        format(string, sizeof(string), "   You have been promoted to a level %d admin by %s.", level, sendername);
                        SendClientMessage(para1, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "   You have promoted %s to a level %d admin.", giveplayer,level);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                    }
                    else
                    {
                        format(string, sizeof(string), "   You have been demoted to a level %d admin by %s.", level, sendername);
                        SendClientMessage(para1, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "   You have demoted %s to a level %d admin.", giveplayer,level);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                    }

                    PlayerInfo[para1][pAdmin] = level;
                   
                    }
                }
            }
        }
Reply
#2

Explain more.
Reply
#3

Topic name says "/oremoveadmin (offline kick)" and the pawn code says /makeadmin.
What do you want us to do? Explain and show us the code where you have a problem.
Reply
#4

Dear bro, u mentioned the topic as /oremoveadmin and in the topic u ask us how to create that command?!
come 2 the point plz

EDIT:BIKER112 ur fast :C
Reply
#5

I need to make /oremoveadmin CMD but i don't know how guys , can anyone help me please
Reply
#6

pawn Код:
#include <zcmd> //Add it on top

cmd:oremoveadmin(playerid,params[])
{
     new targetid;
     if(sscanf(params,"u",targetid))
    {
        SendClientMessage(playerid,COLOR_WHITE,"{FF0000}[ERROR]: {FFFFFF}USAGE: /oremoveadmin (Player Name/ID)");
        return 1;
    }
    PlayerInfo[targetid][pAdmin] = 0;
    return 1;
}
Reply
#7

Quote:
Originally Posted by superrobot48
Посмотреть сообщение
[pawn]
#include <zcmd> //Add it on top

cmdremoveadmin(playerid,params[])
{
new targetid;
if(sscanf(params,"ui",targetid,cmdreason))
{
SendClientMessage(playerid,COLOR_WHITE,"{FF0000}[ERROR]: {FFFFFF}USAGE: /oremoveadmin (Player Name/ID)");
return 1;
}
PlayerInfo[targetid][pAdminLevel] = cmdreason;
return 1;
}
thats playerid.how can you get an offline playerid??it needs to be by name i think..
Reply
#8

ty man
Reply
#9

Oh For creating offline things we need to know where you are saving the files.
like scriptfiles/users/

well its something like this
pawn Код:
CMD:oremoveadmin(playerid, params[])
{
    new targetname[24], filestring[79];
    if(sscanf(params, "s[24]", targetname)) return SendClientMessage(playerid, -1, "Correct Usage: /oremoveadmin [Player's Name]");
    format(filestring, sizeof(filestring), "/Users/%s.ini", targetname);
    if(!fexist(filestring)) return SendClientMessage(playerid, -1, "Error: The player name you have chosen was not found in our system.");
    else
    {
        new INI:File = INI_Open(filestring);
        INI_SetTag(File, "data");
        INI_WriteInt(File, "Admin", 0);
        INI_Close(File);
        new done[128];
        format(done, sizeof(done), "You have removed admin level of %s", targetname);
        SendClientMessage(playerid,-1 , done);
    }
    return 1;
}
Reply
#10

only on scriptfiles not on users
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)