Page 1 of 1

Say /country, Show Players Countries

Posted: 17 Apr 2021, 17:09
by Null
HI guys i want when i say /country show me all players countries
with same color see the photo when i say /country what show me

Re: Say /country, Show Players Countries

Posted: 19 Apr 2021, 04:30
by Supremache
Untested :

Code: Select all

#include <amxmodx>
#include <geoip>

#define PLUGIN "Show Online Players Country"
#define VERSION "1.0"
#define AUTHOR "Supremache"

new szPlayerName[33][32]
new szCountry[45][32]
new szIP[33][32]

new const szCommands[][] =
{
	"say /c",
	"say /country",
	"say_team /c",
	"say_team /country"
}

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	for (new i = 0; i < charsmax(szCommands); i++)
		register_clcmd(szCommands[i], "_Country")
}

public client_putinserver(id)
{
	get_user_name(id, szPlayerName[id], charsmax(szPlayerName[]));
	get_user_ip(id, szIP[id], charsmax(szIP[]));
	geoip_country(szIP[id], szCountry[id], charsmax(szCountry[]));
}

public _Country(id) 
{
	if (!is_user_connected(id))	return PLUGIN_HANDLED;
	
	static TitleMenu[256],
		iPlayers[32],
		iNum;
		
	formatex(TitleMenu,charsmax(TitleMenu),"\yPlayers Country:");
	new iMenu = menu_create(TitleMenu,"_Hundler");
		
	get_players(iPlayers, iNum, "ch");
		
	for(new iPlayer, i = 0; i < iNum; i++) 
	{
		iPlayer = iPlayers[i]
		
		formatex(TitleMenu, charsmax(TitleMenu), "\w%s		\y%s", szPlayerName[iPlayer], szCountry[iPlayer]);
		menu_additem(iMenu, TitleMenu);
	}
	
	menu_setprop(iMenu, MPROP_EXIT, MEXIT_ALL);
	menu_display(id, iMenu, 0);
	
	return PLUGIN_CONTINUE;
}

public _Hundler(id, iMenu,iItem) 
{
	menu_destroy(iMenu);
	return PLUGIN_CONTINUE;
}