Raised This Month: $ Target: $400
 0% 

[help script] show my name in 2 access


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Snitch
Veteran Member
Join Date: Sep 2013
Location: Kazakhstan
Old 04-24-2016 , 17:46   [help script] show my name in 2 access
Reply With Quote #1


Code:
#include <amxmodx>
#include <amxmisc>

// De aici poti incepe sa modifici ce vrea muschiu tau

#define VIP_FLAG ADMIN_KICK

new const TAG[] = "[amxx]"
new const SERVERNAME[] = "amxx"
new const MESSAGE[] = "No online:"

new const rank_names[][] =
{
	"Administrator",
	"Moderator",
	"VIP"
}

new const rank_flags[][] =
{
	"abcdefghijklmnopqrstu",
	"bcdefghijklmnopqr",
	"cehij"
}

// Pana aici boss

new vip_rank = sizeof rank_names - 1;
new flags_rank[sizeof rank_flags], g_maxplayers, g_msg_saytext;

public plugin_init()
{
	register_plugin("New Who Menu", "1.1", "GoogleStrik");
	
	register_clcmd("say /admins", "cmd_who");
	register_clcmd("say /admin", "cmd_who");
	
	g_maxplayers = get_maxplayers();
	g_msg_saytext = get_user_msgid("SayText");
	
	for(new i = 0; i < sizeof rank_flags; i++)
		flags_rank[i] = read_flags(rank_flags[i]);
}

public cmd_who(id)
{
	new menu, menu_item[80], tasta[2];
	formatex(menu_item, charsmax(menu_item), "\r[%s] \dAdmin List Online", SERVERNAME);
	menu = menu_create(menu_item, "handler_who");
	for(new i = 0; i < sizeof rank_names; i++)
	{
		formatex(menu_item, charsmax(menu_item), "\y%s\r[\w%d\r]", rank_names[i], get_rang_players(i));
		tasta[0] = i;
		tasta[1] = 0;
		menu_additem(menu, menu_item, tasta);
	}
	menu_display(id, menu, 0);
	return PLUGIN_HANDLED;
}

public handler_who(id, menu, item)
{
	if(item == MENU_EXIT)
	{
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}
	
	menu_destroy(menu);
	show_players_rang(id, item);
	return PLUGIN_HANDLED;
}

public show_players_rang(id, item)
{
	if(!get_rang_players(item))
	{
		color(id, ".v%s.g %s.e %s.g!", TAG, MESSAGE, rank_names[item]);
		return PLUGIN_HANDLED;
	}
	new menu_item[80], tasta[2], menu;
	formatex(menu_item, charsmax(menu_item), "\rAdmin List Level\y %s\r.^nMany Member Online:\y %d^n", rank_names[item], get_rang_players(item))
	menu = menu_create(menu_item, "handler_players_rang");
	new i, xul;
	xul = 0;

	if(item == vip_rank)
	{
		for(i = 1; i <= g_maxplayers; i++)
		{
			if(!is_user_connected(i))
				continue;
				
			if(get_user_flags(i) & VIP_FLAG)
			{
				formatex(menu_item, charsmax(menu_item), "\y%s", get_name(i));
				tasta[0] = xul;
				tasta[1] = 0;
				xul++;
				menu_additem(menu, menu_item, tasta);
			}
		}
	}
	else
	{
		for(i = 1; i <= g_maxplayers; i++)
		{
			if(!is_user_connected(i))
				continue;
				
			if(get_user_flags(i) == flags_rank[item] || get_user_flags(i) == (flags_rank[item] | VIP_FLAG))
			{
				formatex(menu_item, charsmax(menu_item), "\y%s", get_name(i));
				tasta[0] = xul;
				tasta[1] = 0;
				xul++;
				menu_additem(menu, menu_item, tasta);
			}
		}	
	}
	
	menu_display(id, menu, 0);
	return PLUGIN_HANDLED;
}

public handler_players_rang(id, menu)
{
	menu_destroy(menu);
	return PLUGIN_HANDLED;
}
	
public get_rang_players(rank)
{
	new i, players;
	players = 0;
	if(rank == vip_rank)
	{
		for(i = 1; i <= g_maxplayers; i++)
		{
			if(!is_user_connected(i) || !(get_user_flags(i) & VIP_FLAG))
				continue;
				
			players++;
		}
	}
	else
	{
		for(i = 1; i <= g_maxplayers; i++)
		{
			if(!is_user_connected(i))
				continue;
			
			if(get_user_flags(i) == flags_rank[rank] || get_user_flags(i) == (flags_rank[rank] | VIP_FLAG))
				players++;
		}
	}
	return players;
}

stock get_name(id)
{
	new name[32];
	get_user_name(id, name, charsmax(name));
	return name;
}

stock color(const id, const input[], any:...)
{
	new count = 1, players[32];
	new msg[191];
	vformat(msg, 190, input, 3);
	
	replace_all(msg, 190, ".v", "^4");
	replace_all(msg, 190, ".g", "^1");
	replace_all(msg, 190, ".e", "^3");
	
	if(id) players[0] = id; else get_players(players, count, "ch")
	{
		for(new i = 0; i < count; i++)
		{
			if(is_user_connected(players[i]))
			{
				message_begin(MSG_ONE_UNRELIABLE, g_msg_saytext, _, players[i])
				write_byte(players[i]);
				write_string(msg);
				message_end();
			}
		}
	}
}
why its show me that im Administrator and vip ???
__________________
Қазақстан Республикасы

Last edited by Snitch; 04-24-2016 at 17:47.
Snitch is offline
Send a message via Skype™ to Snitch
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-24-2016 , 18:30   Re: [help script] show my name in 2 access
Reply With Quote #2

Because the VIP flag is part of the definition of "Administrator".

P.S. You should be using get_players() for all your player loops. Don't loop through max players checking is_user_connected().
__________________

Last edited by fysiks; 04-24-2016 at 18:31.
fysiks is offline
Snitch
Veteran Member
Join Date: Sep 2013
Location: Kazakhstan
Old 04-24-2016 , 20:36   Re: [help script] show my name in 2 access
Reply With Quote #3

so how can i fix this part, im sorry dont understand PAWN

sorry for bad eng
__________________
Қазақстан Республикасы
Snitch is offline
Send a message via Skype™ to Snitch
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-24-2016 , 22:57   Re: [help script] show my name in 2 access
Reply With Quote #4

It depends on how you want it to work. Note that you have "VIP" defined twice but in two different ways which makes it really confusing as to what you are trying to do with your code.
__________________
fysiks is offline
Snitch
Veteran Member
Join Date: Sep 2013
Location: Kazakhstan
Old 04-25-2016 , 05:07   Re: [help script] show my name in 2 access
Reply With Quote #5

simple
Quote:
abcdefghijklmnopqrstu
this my access and Everyone and his approach They would not see me in the VIP cuz its not my access.. So take the vip flag? i dont know how just fix this code
__________________
Қазақстан Республикасы
Snitch is offline
Send a message via Skype™ to Snitch
Snitch
Veteran Member
Join Date: Sep 2013
Location: Kazakhstan
Old 06-05-2016 , 08:28   Re: [help script] show my name in 2 access
Reply With Quote #6

bump
__________________
Қазақстан Республикасы
Snitch is offline
Send a message via Skype™ to Snitch
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 06-05-2016 , 08:50   Re: [help script] show my name in 2 access
Reply With Quote #7

Stop bumping your topics and start searching! This has been asked and answered a few days ago so SEARCH.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 06-05-2016 , 15:24   Re: [help script] show my name in 2 access
Reply With Quote #8

PHP Code:
#include <amxmodx>
#include <amxmisc>

#define VIP_FLAG ADMIN_KICK

new const TAG[] = "[amxx]"
new const SERVERNAME[] = "amxx"
new const MESSAGE[] = "No online:"

new const rank_names[][] =
{
    
"Administrator",
    
"Moderator",
    
"VIP"
}

new const 
rank_flags[][] =
{
    
"abcdefghijklmnopqrstu",
    
"bcdefghijklmnopqr",
    
"cehij"
}

new 
vip_rank sizeof rank_names 1;
new 
flags_rank[sizeof rank_flags], g_maxplayersg_msg_saytext;

public 
plugin_init()
{
    
register_plugin("New Who Menu""1.1""GoogleStrik");
    
    
register_clcmd("say /admins""cmd_who");
    
register_clcmd("say /admin""cmd_who");
    
    
g_maxplayers get_maxplayers();
    
g_msg_saytext get_user_msgid("SayText");
    
    for(new 
0sizeof rank_flagsi++)
        
flags_rank[i] = read_flags(rank_flags[i]);
}

public 
cmd_who(id)
{
    new 
menumenu_item[80], tasta[2];
    
formatex(menu_itemcharsmax(menu_item), "\r[%s] \dAdmin List Online"SERVERNAME);
    
menu menu_create(menu_item"handler_who");
    for(new 
0sizeof rank_namesi++)
    {
        
formatex(menu_itemcharsmax(menu_item), "\y%s\r[\w%d\r]"rank_names[i], get_rang_players(i));
        
tasta[0] = i;
        
tasta[1] = 0;
        
menu_additem(menumenu_itemtasta);
    }
    
menu_display(idmenu0);
    return 
PLUGIN_HANDLED;
}

public 
handler_who(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    
menu_destroy(menu);
    
show_players_rang(iditem);
    return 
PLUGIN_HANDLED;
}

public 
show_players_rang(iditem)
{
    if(!
get_rang_players(item))
    {
        
color(id".v%s.g %s.e %s.g!"TAGMESSAGErank_names[item]);
        return 
PLUGIN_HANDLED;
    }
    new 
menu_item[80], tasta[2], menu;
    
formatex(menu_itemcharsmax(menu_item), "\rAdmin List Level\y %s\r.^nMany Member Online:\y %d^n"rank_names[item], get_rang_players(item))
    
menu menu_create(menu_item"handler_players_rang");
    new 
ixul;
    
xul 0;

    if(
item == vip_rank)
    {
        for(
1<= g_maxplayersi++)
        {
            if(!
is_user_connected(i))
                continue;
                
            if(
get_user_flags(i) & VIP_FLAG)
            {
                
formatex(menu_itemcharsmax(menu_item), "\y%s"get_name(i));
                
tasta[0] = xul;
                
tasta[1] = 0;
                
xul++;
                
menu_additem(menumenu_itemtasta);
            }
        }
    }
    else
    {
        for(
1<= g_maxplayersi++)
        {
            if(!
is_user_connected(i))
                continue;
                
            if(
get_user_flags(i) == flags_rank[item] || get_user_flags(i) == (flags_rank[item] | VIP_FLAG))
            {
                
formatex(menu_itemcharsmax(menu_item), "\y%s"get_name(i));
                
tasta[0] = xul;
                
tasta[1] = 0;
                
xul++;
                
menu_additem(menumenu_itemtasta);
            }
        }    
    }
    
    
menu_display(idmenu0);
    return 
PLUGIN_HANDLED;
}

public 
handler_players_rang(idmenu)
{
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
}
    
public 
get_rang_players(rank)
{
    new 
iplayers;
    
    if(
rank == vip_rank)
    {
        new 
tmp;
        for(
1<= g_maxplayersi++)
        {
            
tmp get_user_flags(i);
            if(
is_user_connected(i) && (tmp VIP_FLAG) && !(tmp ADMIN_BAN))    
               
players++;
        }
    }
    else
    {
        for(
1<= g_maxplayersi++)
        {
            if(
is_user_connected(i) && get_user_flags(i) == flags_rank[rank] || get_user_flags(i) == (flags_rank[rank] | VIP_FLAG))
                
players++;
        }
    }
    return 
players;
}

stock get_name(id)
{
    new 
name[32];
    
get_user_name(idnamecharsmax(name));
    return 
name;
}

stock color(const id, const input[], any:...)
{
    new 
count 1players[32];
    new 
msg[191];
    
vformat(msg190input3);
    
    
replace_all(msg190".v""^4");
    
replace_all(msg190".g""^1");
    
replace_all(msg190".e""^3");
    
    if(
idplayers[0] = id; else get_players(playerscount"ch")
    {
        for(new 
0counti++)
        {
            if(
is_user_connected(players[i]))
            {
                
message_begin(MSG_ONE_UNRELIABLEg_msg_saytext_players[i])
                
write_byte(players[i]);
                
write_string(msg);
                
message_end();
            }
        }
    }

siriusmd99 is offline
Snitch
Veteran Member
Join Date: Sep 2013
Location: Kazakhstan
Old 07-12-2016 , 16:37   Re: [help script] show my name in 2 access
Reply With Quote #9

Quote:
Originally Posted by siriusmd99 View Post
PHP Code:
#include <amxmodx>
#include <amxmisc>

#define VIP_FLAG ADMIN_KICK

new const TAG[] = "[amxx]"
new const SERVERNAME[] = "amxx"
new const MESSAGE[] = "No online:"

new const rank_names[][] =
{
    
"Administrator",
    
"Moderator",
    
"VIP"
}

new const 
rank_flags[][] =
{
    
"abcdefghijklmnopqrstu",
    
"bcdefghijklmnopqr",
    
"cehij"
}

new 
vip_rank sizeof rank_names 1;
new 
flags_rank[sizeof rank_flags], g_maxplayersg_msg_saytext;

public 
plugin_init()
{
    
register_plugin("New Who Menu""1.1""GoogleStrik");
    
    
register_clcmd("say /admins""cmd_who");
    
register_clcmd("say /admin""cmd_who");
    
    
g_maxplayers get_maxplayers();
    
g_msg_saytext get_user_msgid("SayText");
    
    for(new 
0sizeof rank_flagsi++)
        
flags_rank[i] = read_flags(rank_flags[i]);
}

public 
cmd_who(id)
{
    new 
menumenu_item[80], tasta[2];
    
formatex(menu_itemcharsmax(menu_item), "\r[%s] \dAdmin List Online"SERVERNAME);
    
menu menu_create(menu_item"handler_who");
    for(new 
0sizeof rank_namesi++)
    {
        
formatex(menu_itemcharsmax(menu_item), "\y%s\r[\w%d\r]"rank_names[i], get_rang_players(i));
        
tasta[0] = i;
        
tasta[1] = 0;
        
menu_additem(menumenu_itemtasta);
    }
    
menu_display(idmenu0);
    return 
PLUGIN_HANDLED;
}

public 
handler_who(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    
menu_destroy(menu);
    
show_players_rang(iditem);
    return 
PLUGIN_HANDLED;
}

public 
show_players_rang(iditem)
{
    if(!
get_rang_players(item))
    {
        
color(id".v%s.g %s.e %s.g!"TAGMESSAGErank_names[item]);
        return 
PLUGIN_HANDLED;
    }
    new 
menu_item[80], tasta[2], menu;
    
formatex(menu_itemcharsmax(menu_item), "\rAdmin List Level\y %s\r.^nMany Member Online:\y %d^n"rank_names[item], get_rang_players(item))
    
menu menu_create(menu_item"handler_players_rang");
    new 
ixul;
    
xul 0;

    if(
item == vip_rank)
    {
        for(
1<= g_maxplayersi++)
        {
            if(!
is_user_connected(i))
                continue;
                
            if(
get_user_flags(i) & VIP_FLAG)
            {
                
formatex(menu_itemcharsmax(menu_item), "\y%s"get_name(i));
                
tasta[0] = xul;
                
tasta[1] = 0;
                
xul++;
                
menu_additem(menumenu_itemtasta);
            }
        }
    }
    else
    {
        for(
1<= g_maxplayersi++)
        {
            if(!
is_user_connected(i))
                continue;
                
            if(
get_user_flags(i) == flags_rank[item] || get_user_flags(i) == (flags_rank[item] | VIP_FLAG))
            {
                
formatex(menu_itemcharsmax(menu_item), "\y%s"get_name(i));
                
tasta[0] = xul;
                
tasta[1] = 0;
                
xul++;
                
menu_additem(menumenu_itemtasta);
            }
        }    
    }
    
    
menu_display(idmenu0);
    return 
PLUGIN_HANDLED;
}

public 
handler_players_rang(idmenu)
{
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
}
    
public 
get_rang_players(rank)
{
    new 
iplayers;
    
    if(
rank == vip_rank)
    {
        new 
tmp;
        for(
1<= g_maxplayersi++)
        {
            
tmp get_user_flags(i);
            if(
is_user_connected(i) && (tmp VIP_FLAG) && !(tmp ADMIN_BAN))    
               
players++;
        }
    }
    else
    {
        for(
1<= g_maxplayersi++)
        {
            if(
is_user_connected(i) && get_user_flags(i) == flags_rank[rank] || get_user_flags(i) == (flags_rank[rank] | VIP_FLAG))
                
players++;
        }
    }
    return 
players;
}

stock get_name(id)
{
    new 
name[32];
    
get_user_name(idnamecharsmax(name));
    return 
name;
}

stock color(const id, const input[], any:...)
{
    new 
count 1players[32];
    new 
msg[191];
    
vformat(msg190input3);
    
    
replace_all(msg190".v""^4");
    
replace_all(msg190".g""^1");
    
replace_all(msg190".e""^3");
    
    if(
idplayers[0] = id; else get_players(playerscount"ch")
    {
        for(new 
0counti++)
        {
            if(
is_user_connected(players[i]))
            {
                
message_begin(MSG_ONE_UNRELIABLEg_msg_saytext_players[i])
                
write_byte(players[i]);
                
write_string(msg);
                
message_end();
            }
        }
    }

its work but found more problem.

when VIP user flag (1) its show me also [2]:
i clicked on it and show my name in list

and how can i add return on name when i press the name.
__________________
Қазақстан Республикасы

Last edited by Snitch; 08-23-2016 at 14:21.
Snitch is offline
Send a message via Skype™ to Snitch
Snitch
Veteran Member
Join Date: Sep 2013
Location: Kazakhstan
Old 08-23-2016 , 14:21   Re: [help script] show my name in 2 access
Reply With Quote #10

bump?
__________________
Қазақстан Республикасы
Snitch is offline
Send a message via Skype™ to Snitch
Reply


Thread Tools
Display Modes

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:34.


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