|
Senior Member
Join Date: Jun 2014
Location: Constanta, Romania
|

05-21-2016
, 18:17
Preventing the names from repeating
|
#1
|
I have an admin_who plugin. I changed the check to include the flags, instead of equaling them. Why? Because the VIP flag is ADMIN_LEVEL_H, so if I add the t flag to an admin, he won't be shown in the admin list anymore. This way he would. The problem is that a founder will appear in all admin cathegories, as he fits them all, having full access. How could I add a check to prevent him from repeating? I mean placing him in the highest rank his flags allow him, but no lower.
Here's my code:
PHP Code:
#include < amxmodx > #include < amxmisc >
#pragma semicolon 1
#define MAX_GROUPS 9
new g_groupNames[MAX_GROUPS][] = { "Founder", "Owner", "Co-Owner", "God", "Super-Moderator", "Moderator", "Administrator", "Helper", "Slot" };
new g_groupFlags[MAX_GROUPS][] = { "abcdefghijklmnopqrsuv", // Founder "abcdefghijkmnopqrsu", // Owner "abcdefijmnopqrsu", // Co-Owner "abcdefijmnopqrs", // God "abcdefijmnopqr", // Super-Moderator "abcdefijmnopq", // Moderator "abcdefijmno", // Administrator "abceijmno", // Helper "ab" // Slot };
new g_groupFlagsValue[MAX_GROUPS];
public plugin_init() { register_plugin("admin_who", "1.0", "rock!"); register_concmd("admin_who", "cmdWho", 0); register_clcmd("say who", "cmdSayWho"); register_clcmd("say /who", "cmdSayWho"); register_clcmd("say admin", "cmdSayWho"); register_clcmd("say /admin", "cmdSayWho"); for(new i = 0; i < MAX_GROUPS; i++) g_groupFlagsValue[i] = read_flags(g_groupFlags[i]); }
public cmdWho(id) { new players[32], inum, player, name[32]; get_players(players, inum); console_print(id, "~~~~~ www..ro ~~~~~"); for(new i = 0; i < MAX_GROUPS; i++) { console_print(id, "-----[%d]%s-----", i+1, g_groupNames[i]); for(new a = 0; a < inum; ++a) { player = players[a]; get_user_name(player, name, 31); if((get_user_flags(player) & g_groupFlagsValue[i]) == g_groupFlagsValue[i]) console_print(id, "%s", name); } } console_print(id, "~~~~~ www..ro ~~~~~"); return PLUGIN_HANDLED; }
public cmdSayWho(id) { chat_color(id, "!t[!g!t] !nCheck your console!"); cmdWho(id); }
stock chat_color(const id, const input[], any:...) { new iCount = 1; new iPlayers[32]; static sMsg[191]; vformat(sMsg, 190, input, 3); replace_all(sMsg, 190, "!g", "^4"); replace_all(sMsg, 190, "!n", "^1"); replace_all(sMsg, 190, "!t", "^3"); if(id) iPlayers[0] = id; else get_players(iPlayers, iCount, "ch"); for(new i = 0; i < iCount; i++) if(is_user_connected(iPlayers[i])) { message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, iPlayers[i]); write_byte(iPlayers[i]); write_string(sMsg); message_end(); } }
__________________
~ Swiftly and with style ~
Last edited by EpicKiller; 05-21-2016 at 18:18.
|
|