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