Thanks you rly help me because i need to fix that and in other plugin
PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <geoip>
#include <csstats>
#define PLUGIN "Hud Stats"
#define VERSION "1.0"
#define AUTHOR "GmTx"
new nextmap[32]
new name[32]
new ip[32]
new steam[32]
new country[46]
new Currenttime[9]
new CurrentDay[16]
new bool:hud_enabled[33]
static temp[8]
static rank[8]
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /hudstats", "cmdStats")
set_task(5.0,"cmdShowHudStats")
}
public client_connect(id)
{
hud_enabled[id] = false
set_task(10.0, "show_info", id)
}
public show_info(id)
{
if(!is_user_connected(id) || hud_enabled[id])
return PLUGIN_CONTINUE
client_print(id, print_chat, "[HudStats] Say '/hudstats' to show or hide the HuD StatS.")
return PLUGIN_CONTINUE
}
public cmdStats(id)
{
if(!is_user_connected(id))
return PLUGIN_HANDLED
if(hud_enabled[id])
{
hud_enabled[id] = false
client_print(id, print_chat, "[HudStats] Hud Stats Disabled.")
return PLUGIN_HANDLED
}
client_print(id, print_chat, "[HudStats] Hud Stats Enable.")
hud_enabled[id] = true
cmdHudStats(id)
return PLUGIN_HANDLED
}
public cmdHudStats(id)
{
if(!is_user_connected(id))
return PLUGIN_CONTINUE
if(!hud_enabled[id])
return PLUGIN_CONTINUE
get_time("%H:%M:%S",Currenttime,8)
get_time("%d/%m/%Y",CurrentDay,15)
new timeleft = get_timeleft()
get_cvar_string("amx_nextmap",nextmap,31)
get_user_name(id, name, 31);
get_user_ip(id, ip, 31);
get_user_authid(id, steam, 31);
geoip_country(ip, country)
new position = get_user_stats(id, temp, temp)
num_to_str(position, rank, 7)
set_hudmessage(0, 255, 0, -1.0, -1.0, 0, 1.0, 10000.0)
show_hudmessage(id, "[ Time: %s ]^n[ Date: %s]^n[ Time Left: %d:%02d ]^n[ Next Map: %s ]^n[ Your Name: %s ]^n[ Your IP: %s ]^n[ Your ID: %s ]^n[ You are from: %s ]^n[ Rank in Top15: %s ]", Currenttime, CurrentDay, timeleft / 60, timeleft % 60, nextmap, name, ip, steam, country, rank)
set_task(0.9,"cmdHudStats")
return PLUGIN_CONTINUE
}
public get_user_country( index )
{
static ip[32], country[46];
get_user_ip(index, ip, 31);
geoip_country(ip, country);
// By GHW_Chronic
if( equal(country, "error") ) {
if( !contain(ip, "192.168.") || !contain(ip, "10. ") || !contain(ip, "172.") || equal(ip, "127.0.0.1") )
country = "LAN";
else if( equal(ip, "loopback") )
country = "ListenServer User";
else
country = "ERROR";
}
return country;
}