11.04.2012, 01:59
Well I coded a set admin command into my script but what I'll like is for it to detect whether the player is being promoted or demoted to a lower level. So I tried doing this, it compiles fine, but In-Game the text doesn't show it's just blank lines.
Here's my current code.
Also, slight problem with my admin chat command. It works fine but there's a slight problem.
If use the command, for example:
I'll do /achat testing - It will show [Owner] Nicholas: testing
Now if I do /achat (without typing a text) - It will show [Owner] Nicholas:
Here's my current code.
pawn Код:
CMD:setadmin(playerid, params[])
{
if(IsAdmin(playerid, 4))
{
new target, level, Promoted[128], Demoted[128];
if(sscanf(params, "ri", target, level))
if(level > 5) return SendClientMessage(playerid, COLOR_RED, "[ADMIN] You can not set a Administrator Level higher than level 5.");
if( level > PlayerInfo[target][Administrator] ) { SendAdminMessage(COLOR_RED, Promoted ); }
else if( level < PlayerInfo[target][Administrator] ) { SendAdminMessage(COLOR_RED, Demoted ); }
PlayerInfo[target][Administrator] = level;
new PlayerName[MAX_PLAYER_NAME], TargetName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
GetPlayerName(target, TargetName, sizeof(TargetName));
format(Promoted, sizeof(Promoted), "%s %s has promoted %s to a Level %d Administrator.", GetAdminRank(playerid), PlayerName, TargetName, level);
Logs("Logs/Promotions.txt", Promoted);
format(Demoted, sizeof(Demoted), "%s %s has demoted %s to a Level %d Administrator.", GetAdminRank(playerid), PlayerName, TargetName, level);
Logs("Logs/Demotions.txt", Demoted);
}
else return SendClientMessage(playerid, COLOR_RED, "[CONSOLE] You are not allowed to use this command.");
return 1;
}
If use the command, for example:
I'll do /achat testing - It will show [Owner] Nicholas: testing
Now if I do /achat (without typing a text) - It will show [Owner] Nicholas:
pawn Код:
CMD:achat(playerid, params[])
{
new PlayerName[128], String[128];
if(PlayerInfo[playerid][Administrator] < 1)
if(isnull(params)) { SendClientMessage(playerid, COLOR_RED, "[ADMIN] /achat [Chat]"); }
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(String, sizeof(String),"%s %s: %s", GetAdminRank(playerid), PlayerName, params);
SendAdminMessage(COLOR_RED, String);
return 1;
}