31.12.2012, 15:46
When the player goes on admin duty, I want their name to change to something temporary.
I've added AdminName and NormalName variables into the user file. I've got the admin duty command but the server crashes when it tries to change the players name.
Here's my code:
I've added AdminName and NormalName variables into the user file. I've got the admin duty command but the server crashes when it tries to change the players name.
Here's my code:
Код:
CMD:aduty(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, -1, "This is an admin only command!"); if(PlayerInfo[playerid][pAdminDuty] == 0) { SendClientMessageEx(playerid, COLOR_YELLOW, "You are now on administrative duty! Remember to check /reports!"); if(strlen(PlayerInfo[playerid][pAdminName]) > 0) { SetPlayerName(playerid, PlayerInfo[playerid][pAdminName]); } PlayerInfo[playerid][pAdminDuty] = 1; SetPlayerHealth(playerid, 1000); SetPlayerArmour(playerid, 1000); //SetPlayerSkin(playerid, 294); new string[128]; format(string, sizeof(string), "Administrator %s is now on Admin Duty! (/report for assistance)", GetPlayerNameEx(playerid)); SendClientMessageToAllEx(COLOR_YELLOW, string); } else { SendClientMessageEx(playerid, COLOR_RED, "You are now off admin duty!"); SetPlayerName(playerid, PlayerInfo[playerid][pNormalName]); SetPlayerHealth(playerid, 100); SetPlayerArmour(playerid, 100); //SetPlayerSkin(playerid, 299); PlayerInfo[playerid][pAdminDuty] = 0; } return 1; }