04.04.2014, 06:36
Quote:
Hints :-
-Make an Enum in the player file -On /setadminname store the name in the file -Loads the name (if there is any) on getting admin onduty -Unload it and set it back to original name. |
I have this admin duty cmd and the setadminnname
Код:
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!"); //SetPlayerName(playerid, PlayerInfo[playerid][pAdminName]); PlayerInfo[playerid][pAdminDuty] = 1; SetPlayerHealth(playerid, 100000); SetPlayerArmour(playerid, 100000); SetPlayerColor(playerid, COLOR_TWORANGE); //SetPlayerSkin(playerid, 294); - Commented by Voltage 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, 0); SetPlayerToTeamColor(playerid); //SetPlayerSkin(playerid, 299); - Commented by Voltage PlayerInfo[playerid][pAdminDuty] = 0; new string[128]; format(string, sizeof(string), "Administrator %s is now Off Admin Duty! ( Leave the Admin to Roleplay )", GetPlayerNameEx(playerid)); SendClientMessageToAllEx(COLOR_YELLOW, string); } return 1; }
Код:
CMD:setadminname(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] >= 5) { /*if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 6) { SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty."); return 1; }*/ new giveplayerid, name[32]; if(sscanf(params, "us[32]", giveplayerid, name)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setadminname [playerid/partofname] [name]"); return 1; } if(PlayerInfo[giveplayerid][pAdmin] < 1) { SendClientMessage(playerid, COLOR_WHITE, "The player is not an admin."); return 1; } if(AdminDuty[giveplayerid] != 0) { SendClientMessage(playerid, COLOR_WHITE, "That admin is currently on-duty. They must go off-duty in order for you to set their admin name."); return 1; } new length = strlen(name); if(length < 3 || length > 20) { SendClientMessage(playerid, COLOR_WHITE, "The name can't less than 3 characters or more than 20 characters."); return 1; } if(strfind(name, "_", true) != -1) { SendClientMessage(playerid, COLOR_WHITE, "The admin name must be one name. There can't be an underscore in the name."); return 1; } if(strcmp(name, "Zhao", true) == 0 && PlayerInfo[playerid][pAdmin] < 6) { SendClientMessage(playerid, COLOR_WHITE, "stop ! im zao ! you're not zao !"); return 1; } new string[128]; format(string, sizeof(string), "AdmCmd: %s has set %s's admin name to '%s'.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), name); ABroadCast(COLOR_LIGHTRED, string, 1); format(PlayerInfo[giveplayerid][pAdminName], 32, name); } else SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!"); return 1; }