/*
Players' Info Motd v0.2
Copyleft by Johnny got his gun
By request of AGE

PLAYERS' INFO MOTD
==================
amx_playersinfo displays data for all players in a MOTD window in this order:
name (will tell if bot) - ip - wonid - userid - playingtime (in seconds) - ping - loss - country

Note that there is no fixed width feature in MOTD. But at least the data won't get
"spammed" upwards as it would be, viewing it from console.

INSTALLATION
============
Because this displays the country for each player, you will need to install the GeoIP module first.
Get it here: http://amxmod.net/forums/viewtopic.php?t=9403

USAGE
=====
amx_playersinfo

TO DO
=====

VERSIONS
========
0.1         First version
0.2			Country added, therefor needs the GeoIP module.
			Get it here: http://amxmod.net/forums/viewtopic.php?t=9403

*/

#include <amxmodx>
#include <geoip>

public info(id) {
	new players[32], playersFound
	get_players(players,playersFound)

	new pos, message[2048]
	new name[40], ip[30], bot[2][] = {""," (BOT)"}, botState, steamid[32], userid, playingtime, ping, loss, country[45]

	for (new i = 0;i < playersFound;i++) {
		get_user_name(players[i],name,39)
		botState = is_user_bot(players[i])
		get_user_ip(players[i],ip,29,1)
		get_user_authid(players[i], steamid, 31)
		userid = get_user_userid(players[i])
		playingtime = get_user_time(players[i])
		get_user_ping(players[i],ping,loss)
		geoip_country(ip,country)

		pos += format(message[pos],2048 - pos,"%s%s IP:%s STEAMID:%s USERID:%d TIME:%d PING:%d LOSS:%d COUNTRY:%s^n",name,bot[botState],ip,steamid,userid,playingtime,ping,loss,country)
	}

	show_motd(id,message,"JGHG's Players' Info MOTD")
	return PLUGIN_HANDLED
}

public plugin_init() {
	register_plugin("Players Info Motd","0.2","jghg")

	register_clcmd("amx_playersinfo","info",0,": displays info on players in a MOTD window")

}

