14.01.2015, 21:44
It's working, I just want the message to be properly shown when player is demoted to level 0.
At the moment adminlevel 0's can use the command and get the 'kicked off message' which is not what I wanted.
At the moment adminlevel 0's can use the command and get the 'kicked off message' which is not what I wanted.
pawn Код:
COMMAND:setlevel(playerid, params[])
{
new iD, Level, pName[24], gMessage[250], gVictim[24];
if(IsPlayerAdmin(playerid) == 1)
{
if(sscanf(params, "ui", iD, Level)) return SendClientMessage(playerid, -1, "{008040}[USAGE] {FFFFFF}/setlevel <playerid> <level>");
else if(!IsPlayerConnected(iD)) return SendClientMessage(playerid, -1, "{BA1F1F}[ERROR]{FFFFFF} Player is not connected to the server.");
else
{
GetPlayerName(playerid, pName, sizeof(pName));
GetPlayerName(iD, gVictim, sizeof(gVictim));
format(gMessage, sizeof(gMessage), "{800040}[ADMIN]{FFFFFF} You have set {FFFF80}%s{FFFFFF} adminlevel to %i.", gVictim, Level);
SendClientMessage(playerid, 0xFFFFFFFF, gMessage);
format(gMessage, sizeof(gMessage), "{800040}[ADMIN]{FFFFFF} Your adminlevel has been changed to %i", Level);
SendClientMessage(playerid, 0xFFFFFFFF, gMessage);
Player[iD][AdminLevel] = Level;
}
}
if(Player[playerid][AdminLevel] > 0)
{
format(gMessage, sizeof(gMessage), "{800040}[ADMIN]{FFFFFF} Welcome to the {FF8080}Administrator Team{FFFFFF}, make sure to read {FFFF80}/ahelp {FFFFFF}and {FFFF80}/acmds.");
SendClientMessage(playerid, 0xFFFFFFFF, gMessage);
}
if(Player[iD][AdminLevel] == 0)
{
format(gMessage, sizeof(gMessage), "{800040}[ADMIN]{FFFFFF} You have been kicked off the {FF8080}Administrator Team{FFFFFF}, you obviously weren't cut out to be an {FFFF80}Admin.");
SendClientMessage(playerid, 0xFFFFFFFF, gMessage);
}
if(IsPlayerAdmin(playerid) == 0)
{
SendClientMessage(playerid, -1, "SERVER: Unknown command.");
}
return 1;
}