amxmodx/plugins/ts/stats_logging.sma

63 lines
2.1 KiB
Plaintext
Raw Normal View History

2004-09-10 11:57:56 +00:00
/* AMX Mod script. (Feb 4th, 2003)
*
* Stats Logging
* by JustinHoMi
* TS changes by SidLuke
*
*/
#include <amxmodx>
#include <tsx>
2005-08-25 07:34:47 +00:00
#include <tsfun>
2004-09-10 11:57:56 +00:00
new g_pingSum[MAX_PLAYERS]
new g_pingCount[MAX_PLAYERS]
2004-09-10 11:57:56 +00:00
public plugin_init()
2004-11-11 07:40:21 +00:00
register_plugin("Stats Logging",AMXX_VERSION_STR,"AMXX Dev Team")
2004-09-10 11:57:56 +00:00
public client_disconnect(id) {
if ( is_user_bot( id ) ) return PLUGIN_CONTINUE
remove_task( id )
new szTeam[16],szName[MAX_NAME_LENGTH],szAuthid[32], iStats[8], iHits[8], szWeapon[16]
2004-09-10 11:57:56 +00:00
new iUserid = get_user_userid( id )
// team
get_user_info(id,"team", szTeam, 15 )
get_user_name(id, szName ,31 )
get_user_authid(id, szAuthid , 31 )
for(new i = 1 ; i < TSMAX_WEAPONS ; ++i ) {
if( get_user_wstats( id , i ,iStats , iHits ) ) {
xmod_get_wpnlogname( i , szWeapon , 15 )
log_message("^"%s<%d><%s><%s>^" triggered ^"weaponstats^" (weapon ^"%s^") (shots ^"%d^") (hits ^"%d^") (kills ^"%d^") (headshots ^"%d^") (tks ^"%d^") (damage ^"%d^") (deaths ^"%d^")",
szName,iUserid,szAuthid,szTeam,szWeapon,iStats[4],iStats[5],iStats[0],
iStats[2],iStats[3],iStats[6],iStats[1])
log_message("^"%s<%d><%s><%s>^" triggered ^"weaponstats2^" (weapon ^"%s^") (head ^"%d^") (chest ^"%d^") (stomach ^"%d^") (leftarm ^"%d^") (rightarm ^"%d^") (leftleg ^"%d^") (rightleg ^"%d^")",
szName,iUserid,szAuthid,szTeam,szWeapon,iHits[1],iHits[2],iHits[3],
iHits[4],iHits[5],iHits[6],iHits[7])
}
}
new iTime = get_user_time( id , 1 )
log_message("^"%s<%d><%s><%s>^" triggered ^"time^" (time ^"%d:%02d^")",
szName,iUserid,szAuthid,szTeam, (iTime / 60), (iTime % 60) )
log_message("^"%s<%d><%s><%s>^" triggered ^"latency^" (ping ^"%d^")",
szName,iUserid,szAuthid,szTeam, (g_pingSum[id] / ( g_pingCount[id] ? g_pingCount[id] : 1 ) ) )
return PLUGIN_CONTINUE
}
public client_putinserver(id) {
if ( !is_user_bot( id ) ){
g_pingSum[ id ] = g_pingCount[ id ] = 0
set_task( 19.5 , "getPing" , id , "" , 0 , "b" )
}
}
public getPing( id ) {
new iPing, iLoss
get_user_ping( id , iPing, iLoss)
g_pingSum[ id ] += iPing
++g_pingCount[ id ]
}