Untested, uncompiled (the web compiler seems to be broken and also missing charsmax).
PHP Code:
#include <amxmodx>
#include <amxmisc>
new gMaxPlayers
new gHeadshots[33]
new gUniqueID[33]
public plugin_init()
{
register_plugin( "Stats MOTD", "1.0", "Hawk552" )
register_event( "HLTV", "EventHLTV", "a", "1=0", "2=0" )
register_event( "DeathMsg", "EventDeathMsg", "a" )
gMaxPlayers = get_maxplayers()
}
public EventHLTV()
for ( new i = 1, len; i <= gMaxPlayers; i++ )
if ( is_user_alive( i ) )
{
static MOTD[4096]
len = formatex( MOTD, charsmax( MOTD ), "Kills: %d<br>", get_user_frags( i ) )
len += formatex( MOTD[len], charsmax( MOTD ) - len, "Deaths: %d<br>", get_user_deaths( i ) )
len += formatex( MOTD[len], charsmax( MOTD ) - len, "Headshots: %d", gHeadshots[i] )
show_motd( i, MOTD, "Stats" )
}
public EventDeathMsg()
{
new attacker = read_data( 1 )
if ( 1 <= attacker <= gMaxPlayers && read_data( 3 ) )
{
new uniqueID = get_user_userid( attacker )
if ( uniqueID != gUniqueID[attacker] )
{
gHeadshots[attacker] = 0
gUniqueID[attacker] = uniqueID
}
gHeadshots[attacker]++
}
}
__________________