2020 */
2121
2222#pragma semicolon 1
23+ #pragma newdecls required
2324
2425#include <sourcemod>
2526#include <sdktools>
2627
2728#define NAME " SuperLogs: CSS"
28- #define VERSION " 1.2.4 "
29+ #define VERSION " 1.2.5 "
2930
3031#define MAX_LOG_WEAPONS 28
3132#define IGNORE_SHOTS_START 25
3233#define MAX_WEAPON_LEN 13
3334
3435
35- new g_weapon_stats [MAXPLAYERS +1 ][MAX_LOG_WEAPONS ][15 ];
36- new const String : g_weapon_list [MAX_LOG_WEAPONS ][MAX_WEAPON_LEN ] = {
36+ int g_weapon_stats [MAXPLAYERS +1 ][MAX_LOG_WEAPONS ][15 ];
37+ char g_weapon_list [MAX_LOG_WEAPONS ][MAX_WEAPON_LEN ] = {
3738 " ak47" ,
3839 " m4a1" ,
3940 " awp" ,
@@ -64,62 +65,51 @@ new const String:g_weapon_list[MAX_LOG_WEAPONS][MAX_WEAPON_LEN] = {
6465 " flashbang"
6566 };
6667
67- new Handle : g_cvar_wstats = INVALID_HANDLE ;
68- new Handle : g_cvar_headshots = INVALID_HANDLE ;
69- new Handle : g_cvar_actions = INVALID_HANDLE ;
70- new Handle : g_cvar_locations = INVALID_HANDLE ;
71- new Handle : g_cvar_ktraj = INVALID_HANDLE ;
72- new Handle : g_cvar_version = INVALID_HANDLE ;
68+ Handle g_cvar_wstats = INVALID_HANDLE ;
69+ Handle g_cvar_headshots = INVALID_HANDLE ;
70+ Handle g_cvar_actions = INVALID_HANDLE ;
71+ Handle g_cvar_locations = INVALID_HANDLE ;
72+ Handle g_cvar_ktraj = INVALID_HANDLE ;
73+ Handle g_cvar_version = INVALID_HANDLE ;
7374
74- new bool : g_logwstats = true ;
75- new bool : g_logheadshots = true ;
76- new bool : g_logactions = true ;
77- new bool : g_loglocations = true ;
78- new bool : g_logktraj = false ;
75+ bool g_logwstats = true ;
76+ bool g_logheadshots = true ;
77+ bool g_logactions = true ;
78+ bool g_loglocations = true ;
79+ bool g_logktraj = false ;
7980
8081#include <loghelper>
8182#include <wstatshelper>
8283
8384
84- public Plugin : myinfo = {
85+ public Plugin myinfo = {
8586 name = NAME ,
8687 author = " psychonic" ,
8788 description = " Advanced logging for CSS. Generates auxilary logging for use with log parsers such as HLstatsX and Psychostats" ,
8889 version = VERSION ,
8990 url = " http://www.hlxcommunity.com"
9091};
9192
92- #if SOURCEMOD_V_MAJOR >= 1 && SOURCEMOD_V_MINOR >= 3
93- public APLRes :AskPluginLoad2 (Handle :myself , bool :late , String :error [], err_max )
94- #else
95- public bool :AskPluginLoad (Handle :myself , bool :late , String :error [], err_max )
96- #endif
93+ public APLRes AskPluginLoad2 (Handle myself , bool late , char [] error , int err_max )
9794{
98- decl String : game_description [64 ];
95+ char game_description [64 ];
9996 GetGameDescription (game_description , sizeof (game_description ), true );
10097 if (StrContains (game_description , " Counter-Strike" , false ) == - 1 )
10198 {
102- decl String : game_folder [64 ];
99+ char game_folder [64 ];
103100 GetGameFolderName (game_folder , sizeof (game_folder ));
104101 if (StrContains (game_folder , " cstrike" , false ) == - 1 )
105102 {
106103 strcopy (error , err_max , " This plugin is only supported on CS:S" );
107- #if SOURCEMOD_V_MAJOR >= 1 && SOURCEMOD_V_MINOR >= 3
108- return APLRes_Failure ;
109- #else
110- return false ;
111- #endif
104+ return APLRes_Failure ;
112105 }
113106 }
114- #if SOURCEMOD_V_MAJOR >= 1 && SOURCEMOD_V_MINOR >= 3
107+
115108 return APLRes_Success ;
116- #else
117- return true ;
118- #endif
119109}
120110
121111
122- public OnPluginStart ()
112+ public void OnPluginStart ()
123113{
124114 CreatePopulateWeaponTrie ();
125115
@@ -155,19 +145,19 @@ public OnPluginStart()
155145}
156146
157147
158- public OnMapStart ()
148+ public void OnMapStart ()
159149{
160150 GetTeams ();
161151}
162152
163- public OnConfigsExecuted ()
153+ public void OnConfigsExecuted ()
164154{
165- decl String : version [255 ];
155+ char version [255 ];
166156 GetConVarString (g_cvar_version , version , sizeof (version ));
167157 SetConVarString (g_cvar_version , version );
168158}
169159
170- hook_wstats ()
160+ stock void hook_wstats ()
171161{
172162 HookEvent (" weapon_fire" , Event_PlayerShoot );
173163 HookEvent (" player_hurt" , Event_PlayerHurt );
@@ -176,7 +166,7 @@ hook_wstats()
176166 HookEvent (" player_disconnect" , Event_PlayerDisconnect , EventHookMode_Pre );
177167}
178168
179- unhook_wstats ()
169+ stock void unhook_wstats ()
180170{
181171 UnhookEvent (" weapon_fire" , Event_PlayerShoot );
182172 UnhookEvent (" player_hurt" , Event_PlayerHurt );
@@ -185,33 +175,33 @@ unhook_wstats()
185175 UnhookEvent (" player_disconnect" , Event_PlayerDisconnect , EventHookMode_Pre );
186176}
187177
188- hook_actions ()
178+ stock void hook_actions ()
189179{
190180 HookEvent (" round_mvp" , Event_RoundMVP );
191181}
192182
193- unhook_actions ()
183+ stock void unhook_actions ()
194184{
195185 UnhookEvent (" round_mvp" , Event_RoundMVP );
196186}
197187
198- public OnClientPutInServer (client )
188+ public void OnClientPutInServer (int client )
199189{
200190 reset_player_stats (client );
201191}
202192
203193
204- public Event_PlayerShoot (Handle : event , const String : name [] , bool : dontBroadcast )
194+ public void Event_PlayerShoot (Handle event , const char [] name , bool dontBroadcast )
205195{
206196 // "userid" "short"
207197 // "weapon" "string" // weapon name used
208198
209- new attacker = GetClientOfUserId (GetEventInt (event , " userid" ));
199+ int attacker = GetClientOfUserId (GetEventInt (event , " userid" ));
210200 if (attacker > 0 )
211201 {
212- decl String : weapon [MAX_WEAPON_LEN ];
202+ char weapon [MAX_WEAPON_LEN ];
213203 GetEventString (event , " weapon" , weapon , sizeof (weapon ));
214- new weapon_index = get_weapon_index (weapon );
204+ int weapon_index = get_weapon_index (weapon );
215205 if (weapon_index > - 1 && weapon_index < IGNORE_SHOTS_START )
216206 {
217207 g_weapon_stats [attacker ][weapon_index ][LOG_HIT_SHOTS ]++ ;
@@ -220,7 +210,7 @@ public Event_PlayerShoot(Handle:event, const String:name[], bool:dontBroadcast)
220210}
221211
222212
223- public Event_PlayerHurt (Handle : event , const String : name [] , bool : dontBroadcast )
213+ public void Event_PlayerHurt (Handle event , const char [] name , bool dontBroadcast )
224214{
225215 // "userid" "short" // player index who was hurt
226216 // "attacker" "short" // player index who attacked
@@ -231,17 +221,17 @@ public Event_PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast)
231221 // "dmg_armor" "byte" // damage done to armor
232222 // "hitgroup" "byte" // hitgroup that was damaged
233223
234- new attacker = GetClientOfUserId (GetEventInt (event , " attacker" ));
224+ int attacker = GetClientOfUserId (GetEventInt (event , " attacker" ));
235225
236226 if (attacker > 0 ) {
237- decl String : weapon [MAX_WEAPON_LEN ];
227+ char weapon [MAX_WEAPON_LEN ];
238228 GetEventString (event , " weapon" , weapon , sizeof (weapon ));
239- new weapon_index = get_weapon_index (weapon );
229+ int weapon_index = get_weapon_index (weapon );
240230 if (weapon_index > - 1 )
241231 {
242232 g_weapon_stats [attacker ][weapon_index ][LOG_HIT_HITS ]++ ;
243233 g_weapon_stats [attacker ][weapon_index ][LOG_HIT_DAMAGE ] += GetEventInt (event , " dmg_health" );
244- new hitgroup = GetEventInt (event , " hitgroup" );
234+ int hitgroup = GetEventInt (event , " hitgroup" );
245235 if (hitgroup < 8 )
246236 {
247237 g_weapon_stats [attacker ][weapon_index ][hitgroup + LOG_HIT_OFFSET ]++ ;
@@ -251,14 +241,14 @@ public Event_PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast)
251241}
252242
253243
254- public Action : Event_PlayerDeathPre (Handle : event , const String : name [] , bool : dontBroadcast )
244+ public Action Event_PlayerDeathPre (Handle event , const char [] name , bool dontBroadcast )
255245{
256246 // "userid" "short" // user ID who died
257247 // "attacker" "short" // user ID who killed
258248 // "weapon" "string" // weapon name killer used
259249 // "headshot" "bool" // signals a headshot
260250
261- new attacker = GetEventInt (event , " attacker" );
251+ int attacker = GetEventInt (event , " attacker" );
262252 if (g_loglocations )
263253 {
264254 LogKillLoc (GetClientOfUserId (attacker ), GetClientOfUserId (GetEventInt (event , " userid" )));
@@ -272,7 +262,7 @@ public Action:Event_PlayerDeathPre(Handle:event, const String:name[], bool:dontB
272262 return Plugin_Continue ;
273263}
274264
275- public Event_PlayerDeath (Handle : event , const String : name [] , bool : dontBroadcast )
265+ public void Event_PlayerDeath (Handle event , const char [] name , bool dontBroadcast )
276266{
277267 // this extents the original player_death by a new fields
278268 // "userid" "short" // user ID who died
@@ -282,9 +272,9 @@ public Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
282272 // "dominated" "short" // did killer dominate victim with this kill
283273 // "revenge" "short" // did killer get revenge on victim with this kill
284274
285- new victim = GetClientOfUserId (GetEventInt (event , " userid" ));
286- new attacker = GetClientOfUserId (GetEventInt (event , " attacker" ));
287- decl String : weapon [MAX_WEAPON_LEN ];
275+ int victim = GetClientOfUserId (GetEventInt (event , " userid" ));
276+ int attacker = GetClientOfUserId (GetEventInt (event , " attacker" ));
277+ char weapon [MAX_WEAPON_LEN ];
288278 GetEventString (event , " weapon" , weapon , sizeof (weapon ));
289279
290280 if (attacker <= 0 || victim <= 0 )
@@ -294,7 +284,7 @@ public Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
294284
295285 if (g_logwstats )
296286 {
297- new weapon_index = get_weapon_index (weapon );
287+ int weapon_index = get_weapon_index (weapon );
298288 if (weapon_index > - 1 )
299289 {
300290 g_weapon_stats [attacker ][weapon_index ][LOG_HIT_KILLS ]++ ;
@@ -328,45 +318,46 @@ public Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
328318 }
329319}
330320
331- public Event_PlayerSpawn (Handle : event , const String : name [] , bool : dontBroadcast )
321+ public void Event_PlayerSpawn (Handle event , const char [] name , bool dontBroadcast )
332322{
333323 // "userid" "short" // user ID on server
334324
335- new client = GetClientOfUserId (GetEventInt (event , " userid" ));
325+ int client = GetClientOfUserId (GetEventInt (event , " userid" ));
336326 if (client > 0 )
337327 {
338328 reset_player_stats (client );
339329 }
340330}
341331
342- public Event_RoundEnd (Handle : event , const String : name [] , bool : dontBroadcast )
332+ public void Event_RoundEnd (Handle event , const char [] name , bool dontBroadcast )
343333{
344334 WstatsDumpAll ();
345335}
346336
347- public Event_RoundMVP (Handle : event , const String : name [] , bool : dontBroadcast )
337+ public void Event_RoundMVP (Handle event , const char [] name , bool dontBroadcast )
348338{
349339 LogPlayerEvent (GetClientOfUserId (GetEventInt (event , " userid" )), " triggered" , " round_mvp" );
350340}
351341
352- public Action : Event_PlayerDisconnect (Handle : event , const String : name [] , bool : dontBroadcast )
342+ public Action Event_PlayerDisconnect (Handle event , const char [] name , bool dontBroadcast )
353343{
354- new client = GetClientOfUserId (GetEventInt (event , " userid" ));
344+ int client = GetClientOfUserId (GetEventInt (event , " userid" ));
355345 OnPlayerDisconnect (client );
356346 return Plugin_Continue ;
357347}
358348
359349
360- public Action : LogMap (Handle : timer )
350+ public Action LogMap (Handle timer )
361351{
362352 // Called 1 second after OnPluginStart since srcds does not log the first map loaded. Idea from Stormtrooper's "mapfix.sp" for psychostats
363353 LogMapLoad ();
354+ return Plugin_Stop ;
364355}
365356
366357
367- public OnCvarWstatsChange (Handle : cvar , const String : oldVal [] , const String : newVal [] )
358+ public void OnCvarWstatsChange (Handle cvar , const char [] oldVal , const char [] newVal )
368359{
369- new bool : old_value = g_logwstats ;
360+ bool old_value = g_logwstats ;
370361 g_logwstats = GetConVarBool (g_cvar_wstats );
371362
372363 if (old_value != g_logwstats )
@@ -390,9 +381,9 @@ public OnCvarWstatsChange(Handle:cvar, const String:oldVal[], const String:newVa
390381 }
391382}
392383
393- public OnCvarActionsChange (Handle : cvar , const String : oldVal [] , const String : newVal [] )
384+ public void OnCvarActionsChange (Handle cvar , const char [] oldVal , const char [] newVal )
394385{
395- new bool : old_value = g_logactions ;
386+ bool old_value = g_logactions ;
396387 g_logactions = GetConVarBool (g_cvar_actions );
397388
398389 if (old_value != g_logactions )
@@ -416,9 +407,9 @@ public OnCvarActionsChange(Handle:cvar, const String:oldVal[], const String:newV
416407 }
417408}
418409
419- public OnCvarHeadshotsChange (Handle : cvar , const String : oldVal [] , const String : newVal [] )
410+ public void OnCvarHeadshotsChange (Handle cvar , const char [] oldVal , const char [] newVal )
420411{
421- new bool : old_value = g_logheadshots ;
412+ bool old_value = g_logheadshots ;
422413 g_logheadshots = GetConVarBool (g_cvar_headshots );
423414
424415 if (old_value != g_logheadshots )
@@ -434,9 +425,9 @@ public OnCvarHeadshotsChange(Handle:cvar, const String:oldVal[], const String:ne
434425 }
435426}
436427
437- public OnCvarLocationsChange (Handle : cvar , const String : oldVal [] , const String : newVal [] )
428+ public void OnCvarLocationsChange (Handle cvar , const char [] oldVal , const char [] newVal )
438429{
439- new bool : old_value = g_loglocations ;
430+ bool old_value = g_loglocations ;
440431 g_loglocations = GetConVarBool (g_cvar_locations );
441432
442433 if (old_value != g_loglocations )
@@ -452,9 +443,9 @@ public OnCvarLocationsChange(Handle:cvar, const String:oldVal[], const String:ne
452443 }
453444}
454445
455- public OnCvarKtrajChange (Handle : cvar , const String : oldVal [] , const String : newVal [] )
446+ public void OnCvarKtrajChange (Handle cvar , const char [] oldVal , const char [] newVal )
456447{
457- new bool : old_value = g_logktraj ;
448+ bool old_value = g_logktraj ;
458449 g_logktraj = GetConVarBool (g_cvar_ktraj );
459450
460451 if (old_value != g_logktraj )
@@ -468,4 +459,4 @@ public OnCvarKtrajChange(Handle:cvar, const String:oldVal[], const String:newVal
468459 UnhookEvent (" player_death" , Event_PlayerDeath );
469460 }
470461 }
471- }
462+ }
0 commit comments