10.01.2013, 22:28
Код:
CMD:aduty(playerid, params[]) // Go on/off admin duty { if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, -1, "This is an admin only command!"); new string[128]; if(PlayerInfo[playerid][pAdminDuty] == 0) { SendClientMessageEx(playerid, COLOR_YELLOW, "You are now on administrative duty! Remember to check /reports!"); // Change to admin name new name[MAX_PLAYER_NAME]; format(name, MAX_PLAYER_NAME, PlayerInfo[playerid][pAdminName]); if(strlen(name) > 0) { SetPVarInt(playerid, "TempName", 1); if(!doesAccountExist(name)) { format(string, sizeof(string), "Your name was changed to %s.", name); SendClientMessageEx(playerid, COLOR_YELLOW, string); SetPlayerName(playerid, name); } else { SendClientMessageEx(playerid, COLOR_RED, "This name is already in use. Contact the Executive Director."); } } /////////////////////// PlayerInfo[playerid][pAdminDuty] = 1; SetPlayerHealth(playerid, 10000); SetPlayerArmour(playerid, 10000); //SetPlayerSkin(playerid, 294); //new string[128]; } else { SendClientMessageEx(playerid, COLOR_RED, "You are now off admin duty!"); // Change to admin name if(GetPVarInt(playerid, "TempName") == 1) { new name[MAX_PLAYER_NAME]; format(name, MAX_PLAYER_NAME, PlayerInfo[playerid][pNormalName]); SetPVarInt(playerid, "TempName", 0); if(strlen(name) == 0) { SendClientMessageEx(playerid, COLOR_YELLOW, "Name contained no characters."); } else { format(string, sizeof(string), "Your name was set back to %s.", name); SendClientMessageEx(playerid, COLOR_YELLOW, string); SetPlayerName(playerid, name); } } /////////////////////// SetPlayerHealth(playerid, 100); SetPlayerArmour(playerid, 100); //SetPlayerSkin(playerid, 299); PlayerInfo[playerid][pAdminDuty] = 0; } return 1; }