setlevel -
MiGu3X - 11.02.2013
I got this:
pawn Код:
CMD:setlevel(playerid, params[])
{
new levels,Nam[MAX_PLAYER_NAME],pname[MAX_PLAYER_NAME],str[128],ID;
if(!IsPlayerAdmin(playerid))return 0;
if(sscanf(params,"ui",ID,levels)) return SendClientMessage(playerid, RED, "USAGE: /setlevel <ID> <Level 1-5>");
if(levels > 5) return SendClientMessage(playerid, RED,"ERROR: Levels Available 1-5");
if(!IsPlayerConnected(ID))return SendClientMessage(playerid, RED,"ERROR: Player is not connected.");
if(PlayerData[ID][AdminLevel] == levels) return SendClientMessage(playerid, RED, "ERROR: Player is already this admin level.");
GetPlayerName(playerid,Nam, MAX_PLAYER_NAME);
GetPlayerName(ID,pname,MAX_PLAYER_NAME);
if(levels == 0)
{
format(str, sizeof(str),"%s has set your Admin level to %d.",Nam,levels);
GameTextForPlayer(playerid, "~g~PROMOTED", 3000, 4);
SendClientMessage(ID,GREEN,str);
format(str, sizeof(str),"You had set %s Admin level to %d.",pname,levels);
SendClientMessage(playerid,ORANGE,str);
PlayerData[ID][AdminLevel] = levels;
return 1;
}
format(str, sizeof(str),"%s has set your Admin level to %d.",Nam,levels);
GameTextForPlayer(playerid, "~y~DEMOTED", 3000, 4);
SendClientMessage(ID,YELLOW,str);
format(str, sizeof(str),"You had set %s Admin level to %d",pname,levels);
SendClientMessage(playerid,ORANGE,str);
PlayerData[ID][AdminLevel] = levels;
return 1;
}
the problem is that when i do /setlevel ID LEVEL, it always appears "DEMOTED" it does never appears promoted, pls help me !!
Re: setlevel -
MP2 - 11.02.2013
Replace
with
pawn Код:
if(levels < PlayerData[ID][AdminLevel]) // Their new level is LESS THAN their CURRENT level (= demoted)
I'd also add this toward the top:
pawn Код:
if(PlayerData[ID][AdminLevel] == levels) return SendClientMessage(playerid, RED, "ERROR: Player is already that level.");
Respuesta: setlevel -
MiGu3X - 12.02.2013
what u mean with last code?
Re: setlevel -
MP2 - 12.02.2013
If they're level 2 and someone sets their level to 2, it will tell them that they are already that level.
Respuesta: setlevel -
MiGu3X - 12.02.2013
NOT fixed :S
+
whjen i do /setlevel id level to other player they dont see promoted or demtoed, and demoted appears only to me.
Re: setlevel -
MP2 - 12.02.2013
You're showing the message to 'playerid' - that's the player that types the command. Change it to 'ID'.
Respuesta: setlevel -
MiGu3X - 12.02.2013
thnx, but it stills appear DEMOTED maybe cauz i have the } that open and close: like:
pawn Код:
{
format(str, sizeof(str),"%s has set your Admin level to %d.",Nam,levels);
GameTextForPlayer(playerid, "~g~PROMOTED", 3000, 4);
SendClientMessage(ID,GREEN,str);
format(str, sizeof(str),"You had set %s Admin level to %d.",pname,levels);
SendClientMessage(playerid,ORANGE,str);
PlayerData[ID][AdminLevel] = levels;
return 1;
}
maybe cauz of that, it doesn't appears?
Re: setlevel -
MP2 - 12.02.2013
It's still playerid.
Respuesta: setlevel -
MiGu3X - 12.02.2013
no..
Re: setlevel -
MP2 - 12.02.2013
Look again.