#include <amxmodx>
#include <amxmisc>

#define PLUGIN "ShowIps"
#define VERSION "1.1"
#define AUTHOR "R3X"

#define TASK_INFO 777

new gcvarIpInfo;


public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR);
	register_clcmd("say /ip", "cmd_ShowIpList");
	
	gcvarIpInfo=register_cvar("amx_ip_info", "60.0",0,60.0);
	
}
//Info
public plugin_cfg(){
	new Float:fInter=get_pcvar_float(gcvarIpInfo);
	if(fInter>0.0)
		set_task(fInter , "cbIpInfoMessage", TASK_INFO, _, _,"b");
}
public cbIpInfoMessage()
	client_print(0, print_chat, "[AMXX] Aby zobaczyc ip graczy uzyj /ip");

//Komenda
public cmd_ShowIpList(id){
	/*
	if(!access(id, ADMIN_BAN))
		return PLUGIN_CONTINUE;
	*/
	console_print(id, "ID | UserID | Nick | IP");
	new Players[32], playerCount;
	new id2, szName[32], szIP[32];
	get_players(Players, playerCount);
	for (new i=0; i<playerCount; i++){
		id2 = Players[i];
		if(is_user_bot(id2))
			continue;
		get_user_name(id2, szName, 31);
		get_user_ip(id2, szIP, 31);
		console_print(id, "%d | #%d | %s | %s", id2, get_user_userid(id2), szName, szIP);
	}
	client_print(id, print_chat, "[AMXX] Lista IP zostala wydrukowana w konsoli");
	return PLUGIN_CONTINUE;
}
