Cant use admin commands -
xir - 05.01.2011
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;
}
Re: Cant use admin commands -
veyron - 05.01.2011
show the part where level[] gets loaded
Re: Cant use admin commands -
iggy1 - 05.01.2011
Post the code where you asign a value to "level[playerid]".
EDIT: Too late
Re: Cant use admin commands -
xir - 05.01.2011
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[]);
Re: Cant use admin commands -
iggy1 - 05.01.2011
Post your /makeadmin (or whatever you have named it) command. You need to give those variables a value ie,
Re: Cant use admin commands -
xir - 05.01.2011
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
Re: Cant use admin commands -
veyron - 05.01.2011
show the part where Level[] gets loaded from file
like
Level[playerid] = dUserINT(PlayerName(playerid)).("adminlevel");
Re: Cant use admin commands -
iggy1 - 05.01.2011
Ok then, you might be better showing the login code. Do you actually give the "level" variable a value?
Re: Cant use admin commands -
xir - 05.01.2011
http://pawn.pastebin.com/adtTputP
Re: Cant use admin commands -
veyron - 05.01.2011
replace Level[] with PlayerInfo[playerid][pAdminLevel] in your admin commands