hlstatsx/sourcemod/scripting/superlogs-neotokyo.sp
Chris Lynch 1c6d91b818 Pushing the new version of the in game plug-in that has the CS:GO Protobuf changes.
Thanks to Popoklopsi for making the change and sharing it with the community.

https://forums.alliedmods.net/showpost.php?p=1879655&postcount=10

Also adding the source for all the super logs plugins so it is all in one place.

The complied version in the scripting folder are built with sourcemod 1.5.3 on windows.Pushing the new version of the in game plug-in that has the CS:GO Protobuf changes.

Thanks to Popoklopsi for making the change and sharing it with the community.

https://forums.alliedmods.net/showpost.php?p=1879655&postcount=10

Also adding the source for all the super logs plugins so it is all in one place.

The complied version in the scripting folder are built with sourcemod 1.5.3 on windows.init push
2014-06-29 07:05:54 -04:00

123 lines
3.6 KiB
SourcePawn

/**
* HLstatsX Community Edition - SourceMod plugin to generate advanced weapon logging
* http://www.hlxcommunity.com
* Copyright (C) 2009 Nicholas Hastings (psychonic)
* Copyright (C) 2007-2008 TTS Oetzel & Goerz GmbH
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#define NAME "SuperLogs: NeoTokyo"
#define VERSION "1.0.2"
new Handle:g_cvar_headshots = INVALID_HANDLE;
new Handle:g_cvar_locations = INVALID_HANDLE;
new bool:g_logheadshots = true;
new bool:g_loglocations = true;
#include <loghelper>
public Plugin:myinfo = {
name = NAME,
author = "psychonic",
description = "Advanced logging for NeoTokyo. Generates auxilary logging for use with log parsers such as HLstatsX and Psychostats",
version = VERSION,
url = "http://www.hlxcommunity.com"
};
public OnPluginStart()
{
g_cvar_headshots = CreateConVar("superlogs_headshots", "1", "Enable logging of headshot player action (default off)", 0, true, 0.0, true, 1.0);
g_cvar_locations = CreateConVar("superlogs_locations", "1", "Enable logging of location on player death (default on)", 0, true, 0.0, true, 1.0);
HookConVarChange(g_cvar_headshots, OnCvarHeadshotsChange);
HookConVarChange(g_cvar_locations, OnCvarLocationsChange);
CreateConVar("superlogs_nts_version", VERSION, NAME, FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
HookEvent("player_death", Event_PlayerDeathPre, EventHookMode_Pre);
CreateTimer(1.0, LogMap);
}
public Action:Event_PlayerDeathPre(Handle:event, const String:name[], bool:dontBroadcast)
{
new attacker = GetEventInt(event, "attacker");
if (attacker > 0)
{
if (g_loglocations)
{
LogKillLoc(GetClientOfUserId(attacker), GetClientOfUserId(GetEventInt(event, "userid")));
}
if (g_logheadshots && GetEventInt(event, "icon") == 2)
{
LogPlayerEvent(GetClientOfUserId(attacker), "triggered", "headshot");
}
}
return Plugin_Continue;
}
public OnCvarHeadshotsChange(Handle:cvar, const String:oldVal[], const String:newVal[])
{
new bool:old_value = g_logheadshots;
g_logheadshots = GetConVarBool(g_cvar_headshots);
if (old_value != g_logheadshots)
{
if (g_logheadshots && !g_loglocations)
{
HookEvent("player_death", Event_PlayerDeathPre, EventHookMode_Pre);
}
else if (!g_loglocations)
{
UnhookEvent("player_death", Event_PlayerDeathPre, EventHookMode_Pre);
}
}
}
public OnCvarLocationsChange(Handle:cvar, const String:oldVal[], const String:newVal[])
{
new bool:old_value = g_loglocations;
g_loglocations = GetConVarBool(g_cvar_locations);
if (old_value != g_loglocations)
{
if (g_loglocations && !g_logheadshots)
{
HookEvent("player_death", Event_PlayerDeathPre, EventHookMode_Pre);
}
else if (!g_logheadshots)
{
UnhookEvent("player_death", Event_PlayerDeathPre, EventHookMode_Pre);
}
}
}
public Action:LogMap(Handle:timer)
{
// Called 1 second after OnPluginStart since srcds does not log the first map loaded. Idea from Stormtrooper's "mapfix.sp" for psychostats
LogMapLoad();
}