Cant use admin commands
#1

I can't use my admin commands, ive set my level to 5 in the .ini file.. Still nothing works

What can cause it, and tell me which code i need to post.. I can post one of my admin commands and maybe you guys can see the problem

pawn Код:
dcmd_kick(playerid, params[])
{
    new pid;
    if(sscanf(params, "us", pid, params[2])) return SendClientMessage(playerid, Yellow, "Usage: /kick <playerid> <reason>");
    if(level[playerid] >= 1)
    {
        if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, Red, "Player is not connected");
        new adminname[MAX_PLAYER_NAME], paramname[MAX_PLAYER_NAME], string[180];
        GetPlayerName(pid, paramname, sizeof(paramname));
        GetPlayerName(playerid, adminname, sizeof(adminname));
        format(string, sizeof(string), "%s has been kicked by %s for: %s", paramname, adminname, params[2]);
        SendClientMessageToAll(AdminColor, string);
        format(string, sizeof(string), "You have been kicked by %s for: %s", adminname, params[2]);
        SendClientMessage(pid, AdminColor, string);
    } else return 0;
    return 1;
}
Reply
#2

show the part where level[] gets loaded
Reply
#3

Post the code where you asign a value to "level[playerid]".

EDIT: Too late
Reply
#4

hmm, my english isnt very good but i think you mean this:

pawn Код:
new level[MAX_PLAYERS];
new muted[MAX_PLAYERS];

forward MessageToAdmins(color, const string[]);
Reply
#5

Post your /makeadmin (or whatever you have named it) command. You need to give those variables a value ie,
pawn Код:
level[playerid] = 5;
Reply
#6

pawn Код:
dcmd_makeadmin(playerid, params[])
{
    new pid, towhat;
    if(sscanf(params, "ud", pid, towhat)) return SendClientMessage(playerid, Yellow, "Usage: /makeadmin <playerid> <level>");
    if(level[playerid] >= 5)
    {
        if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, Red, "This player is not connected");
        new adminname[MAX_PLAYER_NAME], paramname[MAX_PLAYER_NAME], string[180];
        GetPlayerName(pid, paramname, sizeof(paramname));
        GetPlayerName(playerid, adminname, sizeof(adminname));
        format(string, sizeof(string), "%s has given admin level %s to %d.", adminname, paramname, towhat);
        MessageToAdmins(AdminColor, string);
        level[pid] = towhat;
        new name[MAX_PLAYER_NAME], file[256];
        GetPlayerName(pid, name, sizeof(name));
        format(file, sizeof(file), SERVER_USER_FILE, name);
        dini_IntSet(file, "AdminLevel", towhat);
    } else return 0;
    return 1;
}
here is makeadmin
Reply
#7

show the part where Level[] gets loaded from file
like
Level[playerid] = dUserINT(PlayerName(playerid)).("adminlevel");
Reply
#8

Ok then, you might be better showing the login code. Do you actually give the "level" variable a value?
Reply
#9

http://pawn.pastebin.com/adtTputP
Reply
#10

replace Level[] with PlayerInfo[playerid][pAdminLevel] in your admin commands
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)