2014-08-04 12:12:15 +00:00
|
|
|
// vim: set ts=4 sw=4 tw=99 noet:
|
|
|
|
//
|
|
|
|
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
|
|
|
|
// Copyright (C) The AMX Mod X Development Team.
|
|
|
|
//
|
|
|
|
// This software is licensed under the GNU General Public License, version 3 or higher.
|
|
|
|
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
|
|
|
// https://alliedmods.net/amxmodx-license
|
|
|
|
|
|
|
|
//
|
|
|
|
// Stats Logging Plugin
|
|
|
|
//
|
2004-01-31 20:56:22 +00:00
|
|
|
|
2004-03-05 19:35:38 +00:00
|
|
|
#include <amxmodx>
|
2004-10-05 07:41:14 +00:00
|
|
|
#include <csx>
|
2004-01-31 20:56:22 +00:00
|
|
|
|
2014-07-20 10:27:02 +00:00
|
|
|
new g_pingSum[MAX_PLAYERS]
|
|
|
|
new g_pingCount[MAX_PLAYERS]
|
|
|
|
new g_inGame[MAX_PLAYERS]
|
2004-01-31 20:56:22 +00:00
|
|
|
|
2005-09-18 03:19:34 +00:00
|
|
|
public plugin_init()
|
|
|
|
{
|
|
|
|
register_plugin("CS Stats Logging", AMXX_VERSION_STR, "AMXX Dev Team")
|
2004-08-03 20:36:33 +00:00
|
|
|
}
|
2004-01-31 20:56:22 +00:00
|
|
|
|
2005-09-18 03:19:34 +00:00
|
|
|
public client_disconnect(id)
|
|
|
|
{
|
2005-11-12 18:55:37 +00:00
|
|
|
if (!g_inGame[id])
|
|
|
|
return
|
|
|
|
|
|
|
|
g_inGame[id] = 0
|
|
|
|
|
2005-09-18 03:19:34 +00:00
|
|
|
if (is_user_bot(id))
|
|
|
|
{
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
remove_task(id)
|
|
|
|
|
2014-07-20 10:27:02 +00:00
|
|
|
new szTeam[16], szName[MAX_NAME_LENGTH], szAuthid[32], iStats[8], iHits[8], szWeapon[24]
|
2005-09-18 03:19:34 +00:00
|
|
|
new iUserid = get_user_userid(id)
|
2006-07-18 09:20:57 +00:00
|
|
|
new _max = xmod_get_maxweapons()
|
2005-09-18 03:19:34 +00:00
|
|
|
|
|
|
|
get_user_team(id, szTeam, 15)
|
|
|
|
get_user_name(id, szName, 31)
|
|
|
|
get_user_authid(id, szAuthid, 31)
|
|
|
|
|
2006-07-18 09:20:57 +00:00
|
|
|
for (new i = 1 ; i < _max ; ++i)
|
2005-09-18 03:19:34 +00:00
|
|
|
{
|
|
|
|
if (get_user_wstats(id, i, iStats, iHits))
|
|
|
|
{
|
|
|
|
xmod_get_wpnname(i, szWeapon, 23)
|
|
|
|
|
|
|
|
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)))
|
2004-01-31 20:56:22 +00:00
|
|
|
}
|
|
|
|
|
2005-11-12 18:55:37 +00:00
|
|
|
public client_connect(id)
|
|
|
|
{
|
|
|
|
g_inGame[id] = 0
|
|
|
|
}
|
|
|
|
|
2005-09-18 03:19:34 +00:00
|
|
|
public client_putinserver(id)
|
|
|
|
{
|
2005-11-12 18:55:37 +00:00
|
|
|
g_inGame[id] = 1
|
2005-09-18 03:19:34 +00:00
|
|
|
if (!is_user_bot(id))
|
|
|
|
{
|
|
|
|
g_pingSum[id] = g_pingCount[id] = 0
|
2005-11-12 18:55:37 +00:00
|
|
|
if (task_exists(id))
|
|
|
|
remove_task(id)
|
2005-09-18 03:19:34 +00:00
|
|
|
set_task(19.5, "getPing", id, "", 0, "b")
|
|
|
|
}
|
2004-01-31 20:56:22 +00:00
|
|
|
}
|
|
|
|
|
2005-09-18 03:19:34 +00:00
|
|
|
public getPing(id)
|
|
|
|
{
|
|
|
|
new iPing, iLoss
|
|
|
|
|
|
|
|
get_user_ping(id, iPing, iLoss)
|
|
|
|
g_pingSum[id] += iPing
|
|
|
|
++g_pingCount[id]
|
2004-09-10 05:18:57 +00:00
|
|
|
}
|