/setlevel demote message -
Markus1337 - 14.01.2015
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.
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;
}
Re: /setlevel demote message -
Schneider - 14.01.2015
You've been messing up the
"playerid" (the admin who uses the command) and
"iD" (the target-player). Take a good look at the code again.
Re: /setlevel demote message -
Markus1337 - 14.01.2015
Ah now I see, haha thanks
Re: /setlevel demote message -
Schneider - 14.01.2015
Don't know if you found them already, but I found 2 of these mistakes:
- You should send the "You have been kicked off the..."-message to 'iD' instead of 'playerid'
- And if(Player[playerid][AdminLevel] > 0) should be if(Player[iD][AdminLevel] > 0)
Re: /setlevel demote message -
Markus1337 - 14.01.2015
Yeah I found 'em, thanks for you help