Raised This Month: $ Target: $400
 0% 

Preventing the names from repeating


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
EpicKiller
Senior Member
Join Date: Jun 2014
Location: Constanta, Romania
Old 05-21-2016 , 18:17   Preventing the names from repeating
Reply With Quote #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 
0MAX_GROUPSi++)
        
g_groupFlagsValue[i] = read_flags(g_groupFlags[i]);
}

public 
cmdWho(id)
{
    new 
players[32], inumplayername[32];
    
    
get_players(playersinum);
    
    
console_print(id"~~~~~ www..ro ~~~~~");
    
    for(new 
0MAX_GROUPSi++)
    {
        
console_print(id"-----[%d]%s-----"i+1g_groupNames[i]);
        
        for(new 
0inum; ++a)
        {
            
player players[a];
            
            
get_user_name(playername31);
            
            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(sMsg190input3);
    
    
replace_all(sMsg190"!g""^4");
    
replace_all(sMsg190"!n""^1");
    
replace_all(sMsg190"!t""^3");
    
    if(
id)
        
iPlayers[0] = id;
    
    else
        
get_players(iPlayersiCount"ch");
    
    for(new 
0iCounti++)
        if(
is_user_connected(iPlayers[i]))
        {
            
message_begin(MSG_ONE_UNRELIABLEget_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.
EpicKiller is offline
Send a message via Yahoo to EpicKiller Send a message via Skype™ to EpicKiller
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:33.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode