Raised This Month: $ Target: $400
 0% 

[help script] show my name in 2 access


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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