View difference between Paste ID: 6rBNqVJ2 and 6nRRmrFi
SHOW: | | - or go back to the newest paste.
1
/*
2
* DoD XtraLog
3
* 
4
* Adds messaging and log events for alt weapon position kills so 
5
* stats packages can track and award them. Both psychostats and HLStatsXCE
6
* can track these events and use for awards/bonuses.
7
* 
8
* IE:
9
* Single shot on the support class..
10
* IronSight for the rifles.
11
* "Rambo" for the mg class.
12
* NoScope and Noscope headshots
13
* 
14
* Kudos:
15
* Tsunami for the pm secks. <3
16
* psychonic for being hooker #1 <3
17
* 
18
*/
19
20
#include <sourcemod>
21
#include <sdktools>
22
#define PLUGIN_VERSION "1.5"
23
24
new Handle:g_Cvar_XlogNS
25
new Handle:g_Cvar_XlogHS
26
new Handle:g_Cvar_XlogMG
27
new Handle:g_Cvar_XlogSupport
28
new Handle:g_Cvar_XlogRifle
29
30
public Plugin:myinfo = 
31
{
32
	name = "DoD Xtralog",
33
	author = "Mosalar",
34
	description = "Extra weapon logging info",
35
	version = PLUGIN_VERSION,
36
	url = "http://www.budznetwork.com"
37
}
38
39
public OnPluginStart()
40
{
41
	CreateConVar("sm_dod_xlog_version", PLUGIN_VERSION, "Extra weapon logging info version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY)
42
	g_Cvar_XlogNS = CreateConVar("sm_dod_xlog_ns", "1", "NoSocpe messages", FCVAR_PLUGIN)
43
	g_Cvar_XlogHS = CreateConVar("sm_dod_xlog_hs", "1", "NoSocpe HeadShot messages", FCVAR_PLUGIN)
44
	g_Cvar_XlogMG = CreateConVar("sm_dod_xlog_mg", "1", "MG Messages", FCVAR_PLUGIN)
45
	g_Cvar_XlogSupport = CreateConVar("sm_dod_xlog_support", "1", "Support Messages", FCVAR_PLUGIN)
46
	g_Cvar_XlogRifle = CreateConVar("sm_dod_xlog_rifle", "1", "Ironsight Messages", FCVAR_PLUGIN)
47
48
	
49
	HookEvent("dod_stats_player_damage", PlayerDamageEvent)
50
	
51
	AutoExecConfig()
52
}
53
54
public PlayerDamageEvent(Handle:event, const String:name[], bool:dontBroadcast)
55
{	
56
	new attacker = GetClientOfUserId(GetEventInt(event, "attacker"))
57
	new client = GetClientOfUserId(GetEventInt(event, "victim"))
58
	if (attacker == 0 || !IsClientInGame(attacker) || !IsPlayerAlive(attacker)) {
59
		return
60
	}
61
	new String:auth[33]
62
	new String:attacker_name[65]
63
	new String:tname[33]
64
	new String:wname[65]
65
	new weapon_pos = GetEventInt(event, "weapon")
66
	new hitgroup = GetEventInt(event, "hitgroup")
67
	new userid = GetClientUserId(attacker)
68
	//decl String:color[10]; Format(color, sizeof(color), "%s", GetClientTeam(attacker) == 2 ? "\x074D7942" : "\x07FF4040")
69
	GetClientName(attacker, attacker_name, sizeof(attacker_name))
70
	GetClientAuthString(attacker, auth, sizeof(auth))
71
	GetTeamName(GetClientTeam(attacker), tname, sizeof(tname))
72
	GetClientWeapon(attacker, wname, sizeof(wname))
73
	
74
	if (client != 0) {
75
		
76
		switch (weapon_pos) {
77
			
78
			case 9,10: {
79
				if (GetClientHealth(client) < 1) {
80
					
81
					if (hitgroup == 1) {
82
						if (attacker == 0 || !IsPlayerAlive(attacker)) {
83
							return
84
						}
85
						if (GetConVarInt(g_Cvar_XlogHS) == 1) {
86
							PrintToChatAll("\x01[VvV] \x04%s сделал хэдшот без оптики!", attacker_name)
87
						}
88
					}
89
					else {
90
						if (attacker == 0 || !IsPlayerAlive(attacker)) {
91
							return
92
						}
93
						if (GetConVarInt(g_Cvar_XlogNS) == 1) {
94
							PrintToChatAll("\x01[VvV] \x04%s убил без оптики!", attacker_name)
95
						}
96
					} 
97
					LogToGame("\"%s<%d><%s><%s>\" triggered \"noscope\" with \"%s\"", attacker_name, userid, auth, tname, wname);
98
				}
99
			}	
100
			case 35,36: {
101
				if (GetClientHealth(client) < 1) {
102
					
103
					if (attacker == 0 || !IsPlayerAlive(attacker)) {
104
						return
105
					}
106
					if (GetConVarInt(g_Cvar_XlogMG) == 1) {
107
						PrintToChatAll("\x01[VvV] \x04%s убил с неустановленного пулемёта!", attacker_name)
108
					}
109
					LogToGame("\"%s<%d><%s><%s>\" triggered \"rambo\" with \"%s\"", attacker_name, userid, auth, tname, wname);
110
				}
111
			}
112
			case 31,32: {
113
				if (GetClientHealth(client) < 1) {
114
					
115
					if (attacker == 0 || !IsPlayerAlive(attacker)) {
116
						return
117
					}
118
					if (GetConVarInt(g_Cvar_XlogRifle) == 1) {
119
						PrintToChatAll("\x01[VvV] \x04%s убил прицельно из винтовки!", attacker_name)
120
					}
121
					LogToGame("\"%s<%d><%s><%s>\" triggered \"ironsight\" with \"%s\"", attacker_name, userid, auth, tname, wname);
122
				}
123
			}
124
			case 37,38: {
125
				if (GetClientHealth(client) < 1) {
126
					
127
					if (attacker == 0 || !IsPlayerAlive(attacker)) {
128
						return
129
					}
130
					if (GetConVarInt(g_Cvar_XlogSupport) == 1) {
131
						PrintToChatAll("\x01[VvV] \x04%s убил одиночным выстрелом!", attacker_name)
132
					}
133
					LogToGame("\"%s<%d><%s><%s>\" triggered \"singleshot\" with \"%s\"", attacker_name, userid, auth, tname, wname);
134
				}
135
			}
136
		}
137
	}
138
}