05.07.2015, 09:05
Quote:
|
Yes, your one is more readable, and the following line is used when the player is not an admin, and not logged in, but I still receive this even I'm an admin, and logged in.
Код:
else return SendClientMessage(playerid,red, "[ ERROR: You have entered an invalid command, please type /cmds to know the server's commands. ]"); I returned 1 below SetPlayerAmour(i,100.0); but still the same. |
I would replace 'else return SendClientMessage(playerid,red, "[ ERROR: You have entered an invalid command, please type /cmds to know the server's commands. ]");' with removing the if/else and checking at the beginning if they're admin at the beginning, and returning a permission denied, or returning 0 if you want it to return the unknown command error. Then, at the end, simply return 1. The logged in check isn't really needed, since I'd assume admin levels can only be set to those players which are logged in.
Example:
Код:
if(strcmp(cmd, "/armourevent", true) == 0)
{
if(AccInfo[playerid][Level] >=2)
return SendClientMessage(playerid, -1, "You do not have the permissions needed for this command!");
if(Event == 0)
return SendClientMessage(playerid,red, "[ ERROR: There is no event hosted at the moment to armour event participants. ]");
new PlayerName[MAX_PLAYER_NAME], string[256];
GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
SendClientMessage(playerid, BlueMsg, "[ NOTIFICATION: You have refilled armour of event participants. ]");
SendCommandToAdmins(playerid,"AmourEvent");
format(string,sizeof(string),"[ ADMIN: %s (Id: %d) has refilled the armour of every the event participants. ]",PlayerName,playerid);
SendClientMessageToAll(COLOR_PINK,string);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(GetPlayerVirtualWorld(i) == 9999)
{
SetPlayerArmour(i, 100.0);
}
}
return 1;
}


