Add constants for stats functions (#509)
* Add constants for stats functions * Changed STATS_ to STATSX_ and added 2 more defines * Added constants for all games * Add csstats_const.inc and add _MAX_ constats to enum * Change bodyhits
This commit is contained in:
parent
197db8c82b
commit
8aeefc3fca
|
@ -160,6 +160,7 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\..\plugins\include\csstats.inc" />
|
||||
<None Include="..\..\..\plugins\include\csstats_const.inc" />
|
||||
<None Include="..\..\..\plugins\include\csx.inc" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
|
|
|
@ -60,6 +60,9 @@
|
|||
<None Include="..\..\..\plugins\include\csstats.inc">
|
||||
<Filter>Pawn Includes</Filter>
|
||||
</None>
|
||||
<None Include="..\..\..\plugins\include\csstats_const.inc">
|
||||
<Filter>Pawn Includes</Filter>
|
||||
</None>
|
||||
<None Include="..\..\..\plugins\include\csx.inc">
|
||||
<Filter>Pawn Includes</Filter>
|
||||
</None>
|
||||
|
|
|
@ -151,6 +151,7 @@ public stock const Float:NULL_VECTOR[3];
|
|||
#define HIT_LEFTLEG 6
|
||||
#define HIT_RIGHTLEG 7
|
||||
#define HIT_SHIELD 8 // CS only
|
||||
#define MAX_BODYHITS 8
|
||||
|
||||
/**
|
||||
* @section emit_sound() constants
|
||||
|
@ -516,4 +517,20 @@ enum FindPlayerFlags (<<= 1)
|
|||
FindPlayer_IncludeConnecting // Include connecting clients
|
||||
}
|
||||
|
||||
/**
|
||||
* Constants for client statistics
|
||||
*/
|
||||
enum
|
||||
{
|
||||
STATSX_KILLS = 0,
|
||||
STATSX_DEATHS,
|
||||
STATSX_HEADSHOTS,
|
||||
STATSX_TEAMKILLS,
|
||||
STATSX_SHOTS,
|
||||
STATSX_HITS,
|
||||
STATSX_DAMAGE,
|
||||
STATSX_RANK,
|
||||
STATSX_MAX_STATS
|
||||
}
|
||||
|
||||
#include <cstrike_const> // To keep backward compatibility
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
#endif
|
||||
#define _csstats_included
|
||||
|
||||
#include <csstats_const>
|
||||
|
||||
/**
|
||||
* Retrieves the client's current weapon statistics.
|
||||
*
|
||||
|
@ -19,6 +21,8 @@
|
|||
* amxconst.inc, this function also works on custom weapons.
|
||||
* @note For a list of possible body hitplaces see the HIT_* constants in
|
||||
* amxconst.inc
|
||||
* @note For a list of possible stat constants see the STATSX_* constants in
|
||||
* amxconst.inc
|
||||
* @note The fields in the statistics are:
|
||||
* 0 - Kills
|
||||
* 1 - Deaths
|
||||
|
@ -39,7 +43,7 @@
|
|||
* @error If an invalid client index or weapon id is provided, an
|
||||
* error will be thrown.
|
||||
*/
|
||||
native get_user_wstats(index, wpnindex, stats[8], bodyhits[8]);
|
||||
native get_user_wstats(index, wpnindex, stats[STATSX_MAX_STATS], bodyhits[MAX_BODYHITS]);
|
||||
|
||||
/**
|
||||
* Retrieves the client's weapon statistics from the current round.
|
||||
|
@ -48,6 +52,8 @@ native get_user_wstats(index, wpnindex, stats[8], bodyhits[8]);
|
|||
* amxconst.inc, this function also works on custom weapons.
|
||||
* @note For a list of possible body hitplaces see the HIT_* constants in
|
||||
* amxconst.inc
|
||||
* @note For a list of possible stat constants see the STATSX_* constants in
|
||||
* amxconst.inc
|
||||
* @note The fields in the statistics are:
|
||||
* 0 - Kills
|
||||
* 1 - Deaths
|
||||
|
@ -68,7 +74,7 @@ native get_user_wstats(index, wpnindex, stats[8], bodyhits[8]);
|
|||
* @error If an invalid client index or weapon id is provided, an
|
||||
* error will be thrown.
|
||||
*/
|
||||
native get_user_wrstats(index, wpnindex, stats[8], bodyhits[8]);
|
||||
native get_user_wrstats(index, wpnindex, stats[STATSX_MAX_STATS], bodyhits[MAX_BODYHITS]);
|
||||
|
||||
/**
|
||||
* Retrieves the client's weapon statistics from the permanent storage on the
|
||||
|
@ -80,6 +86,8 @@ native get_user_wrstats(index, wpnindex, stats[8], bodyhits[8]);
|
|||
* deaths/teamkills.
|
||||
* @note For a list of possible body hitplaces see the HIT_* constants in
|
||||
* amxconst.inc
|
||||
* @note For a list of possible stat constants see the STATSX_* constants in
|
||||
* amxconst.inc
|
||||
* @note The fields in the statistics are:
|
||||
* 0 - Kills
|
||||
* 1 - Deaths
|
||||
|
@ -99,13 +107,15 @@ native get_user_wrstats(index, wpnindex, stats[8], bodyhits[8]);
|
|||
* @error If an invalid client index is provided, an error will be
|
||||
* thrown.
|
||||
*/
|
||||
native get_user_stats(index, stats[8], bodyhits[8]);
|
||||
native get_user_stats(index, stats[STATSX_MAX_STATS], bodyhits[MAX_BODYHITS]);
|
||||
|
||||
/**
|
||||
* Retrieves the client's statistics from the current round.
|
||||
*
|
||||
* @note For a list of possible body hitplaces see the HIT_* constants in
|
||||
* amxconst.inc
|
||||
* @note For a list of possible stat constants see the STATSX_* constants in
|
||||
* amxconst.inc
|
||||
* @note The fields in the statistics are:
|
||||
* 0 - Kills
|
||||
* 1 - Deaths
|
||||
|
@ -123,7 +133,7 @@ native get_user_stats(index, stats[8], bodyhits[8]);
|
|||
* @error If an invalid client index is provided, an error will be
|
||||
* thrown.
|
||||
*/
|
||||
native get_user_rstats(index, stats[8], bodyhits[8]);
|
||||
native get_user_rstats(index, stats[STATSX_MAX_STATS], bodyhits[MAX_BODYHITS]);
|
||||
|
||||
/**
|
||||
* Retrieves the client's statistics inflicted upon another client from the
|
||||
|
@ -131,6 +141,8 @@ native get_user_rstats(index, stats[8], bodyhits[8]);
|
|||
*
|
||||
* @note For a list of possible body hitplaces see the HIT_* constants in
|
||||
* amxconst.inc
|
||||
* @note For a list of possible stat constants see the STATSX_* constants in
|
||||
* amxconst.inc
|
||||
* @note The fields in the statistics are:
|
||||
* 0 - Kills
|
||||
* 1 - Deaths
|
||||
|
@ -153,7 +165,7 @@ native get_user_rstats(index, stats[8], bodyhits[8]);
|
|||
* @error If an invalid client index is provided, an error will be
|
||||
* thrown.
|
||||
*/
|
||||
native get_user_vstats(index, victim, stats[8], bodyhits[8], wpnname[] = "", len = 0);
|
||||
native get_user_vstats(index, victim, stats[STATSX_MAX_STATS], bodyhits[MAX_BODYHITS], wpnname[] = "", len = 0);
|
||||
|
||||
/**
|
||||
* Retrieves the client's statistics received from another client from the
|
||||
|
@ -161,6 +173,8 @@ native get_user_vstats(index, victim, stats[8], bodyhits[8], wpnname[] = "", len
|
|||
*
|
||||
* @note For a list of possible body hitplaces see the HIT_* constants in
|
||||
* amxconst.inc
|
||||
* @note For a list of possible stat constants see the STATSX_* constants in
|
||||
* amxconst.inc
|
||||
* @note The fields in the statistics are:
|
||||
* 0 - Kills
|
||||
* 1 - Deaths
|
||||
|
@ -183,7 +197,7 @@ native get_user_vstats(index, victim, stats[8], bodyhits[8], wpnname[] = "", len
|
|||
* @error If an invalid client index is provided, an error will be
|
||||
* thrown.
|
||||
*/
|
||||
native get_user_astats(index, wpnindex, stats[8], bodyhits[8], wpnname[] = "", len = 0);
|
||||
native get_user_astats(index, wpnindex, stats[STATSX_MAX_STATS], bodyhits[MAX_BODYHITS], wpnname[] = "", len = 0);
|
||||
|
||||
/**
|
||||
* Resets the current round weapon, attacker and victim statistics.
|
||||
|
@ -206,6 +220,8 @@ native reset_user_wstats(index);
|
|||
* deaths/teamkills.
|
||||
* @note For a list of possible body hitplaces see the HIT_* constants in
|
||||
* amxconst.inc
|
||||
* @note For a list of possible stat constants see the STATSX_* constants in
|
||||
* amxconst.inc
|
||||
* @note The fields in the statistics are:
|
||||
* 0 - Kills
|
||||
* 1 - Deaths
|
||||
|
@ -227,7 +243,7 @@ native reset_user_wstats(index);
|
|||
* @return Next rank index (> 0 and > index), or 0 if no more
|
||||
* statistics exist
|
||||
*/
|
||||
native get_stats(index, stats[8], bodyhits[8], name[], len, authid[] = "", authidlen = 0);
|
||||
native get_stats(index, stats[STATSX_MAX_STATS], bodyhits[MAX_BODYHITS], name[], len, authid[] = "", authidlen = 0);
|
||||
|
||||
/**
|
||||
* Returns the number of all entries in the permanent statistics storage.
|
||||
|
@ -240,6 +256,8 @@ native get_statsnum();
|
|||
* Retrieves the client's objective statistics from the permanent storage.
|
||||
*
|
||||
* @note The permanent storage is updated on every respawn or client disconnect.
|
||||
* @note For a list of possible stat constants see the STATSX_* constants in
|
||||
* amxconst.inc
|
||||
* @note The fields in the statistics are:
|
||||
* 0 - total defusions
|
||||
* 1 - bomb defused
|
||||
|
@ -254,13 +272,15 @@ native get_statsnum();
|
|||
* @error If an invalid client index is provided, an error will be
|
||||
* thrown.
|
||||
*/
|
||||
native get_user_stats2(index, stats[4]);
|
||||
native get_user_stats2(index, stats[STATSX_MAX_OBJECTIVE]);
|
||||
|
||||
/**
|
||||
* Retrieves objective statistics from the permanent storage on the server via
|
||||
* iterative, incremental access.
|
||||
*
|
||||
* @note The permanent storage is updated on every respawn or client disconnect.
|
||||
* @note For a list of possible stat constants see the STATSX_* constants in
|
||||
* amxconst.inc
|
||||
* @note The fields in the statistics are:
|
||||
* 0 - total defusions
|
||||
* 1 - bomb defused
|
||||
|
@ -275,4 +295,4 @@ native get_user_stats2(index, stats[4]);
|
|||
* @return Next rank index (> 0 and > index), or 0 if no more
|
||||
* statistics exist
|
||||
*/
|
||||
native get_stats2(index, stats[4], authid[] = "", authidlen = 0);
|
||||
native get_stats2(index, stats[STATSX_MAX_OBJECTIVE], authid[] = "", authidlen = 0);
|
||||
|
|
29
plugins/include/csstats_const.inc
Normal file
29
plugins/include/csstats_const.inc
Normal file
|
@ -0,0 +1,29 @@
|
|||
// 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
|
||||
|
||||
//
|
||||
// Counter-Strike Functions
|
||||
//
|
||||
|
||||
#if defined _csstats_const_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _csstats_const_included
|
||||
|
||||
/**
|
||||
* Constants for objective based statistics
|
||||
*/
|
||||
enum
|
||||
{
|
||||
STATSX_TOTAL_DEFUSIONS = 0,
|
||||
STATSX_BOMBS_DEFUSED,
|
||||
STATSX_BOMBS_PLANTED,
|
||||
STATSX_BOMB_EXPLOSIONS,
|
||||
STATSX_MAX_OBJECTIVE
|
||||
}
|
|
@ -136,3 +136,17 @@ enum {
|
|||
DODC_PIAT,
|
||||
//DODC_BRIT_MORTAR,
|
||||
};
|
||||
|
||||
/* DoD stats constants */
|
||||
enum {
|
||||
DODX_KILLS = 0,
|
||||
DODX_DEATHS,
|
||||
DODX_HEADSHOTS,
|
||||
DODX_TEAMKILLS,
|
||||
DODX_SHOTS,
|
||||
DODX_HITS,
|
||||
DODX_DAMAGE,
|
||||
DODX_POINTS,
|
||||
DODX_RANK,
|
||||
DODX_MAX_STATS
|
||||
}
|
||||
|
|
|
@ -28,34 +28,34 @@
|
|||
* 6 - damage
|
||||
* 7 - score
|
||||
* For body hits fields see amxconst.inc. */
|
||||
native get_user_wstats(index,wpnindex,stats[9],bodyhits[8]);
|
||||
native get_user_wstats(index,wpnindex,stats[DODX_MAX_STATS],bodyhits[MAX_BODYHITS]);
|
||||
|
||||
/* Gets round stats from given weapon index.*/
|
||||
native get_user_wrstats(index,wpnindex,stats[9],bodyhits[8]);
|
||||
native get_user_wrstats(index,wpnindex,stats[DODX_MAX_STATS],bodyhits[MAX_BODYHITS]);
|
||||
|
||||
/* Gets life (from spawn to spawn) stats from given weapon index.*/
|
||||
native get_user_wlstats(index,wpnindex,stats[9],bodyhits[8]);
|
||||
native get_user_wlstats(index,wpnindex,stats[DODX_MAX_STATS],bodyhits[MAX_BODYHITS]);
|
||||
|
||||
/* Gets overall stats which are stored in file on server
|
||||
* and updated on every respawn or user disconnect.
|
||||
* Function returns the position in stats by diff. kills to deaths. */
|
||||
native get_user_stats(index,stats[9],bodyhits[8]);
|
||||
native get_user_stats(index,stats[DODX_MAX_STATS],bodyhits[MAX_BODYHITS]);
|
||||
|
||||
/* Gets round stats of player. */
|
||||
native get_user_rstats(index,stats[9],bodyhits[8]);
|
||||
native get_user_rstats(index,stats[DODX_MAX_STATS],bodyhits[MAX_BODYHITS]);
|
||||
|
||||
/* Gets life (from spawn to spawn) stats of player. */
|
||||
native get_user_lstats(index,stats[9],bodyhits[8]);
|
||||
native get_user_lstats(index,stats[DODX_MAX_STATS],bodyhits[MAX_BODYHITS]);
|
||||
|
||||
/* Gets stats with which user have killed/hurt his victim. If victim is 0
|
||||
* then stats are from all victims. If victim has not been hurt, function
|
||||
* returns 0 in other case 1. User stats are reset on his respawn. */
|
||||
native get_user_vstats(index,victim,stats[9],bodyhits[8],wpnname[]="",len=0);
|
||||
native get_user_vstats(index,victim,stats[DODX_MAX_STATS],bodyhits[MAX_BODYHITS],wpnname[]="",len=0);
|
||||
|
||||
/* Gets stats with which user have been killed/hurt. If killer is 0
|
||||
* then stats are from all attacks. If killer has not hurt user, function
|
||||
* returns 0 in other case 1. User stats are reset on his respawn. */
|
||||
native get_user_astats(index,wpnindex,stats[9],bodyhits[8],wpnname[]="",len=0);
|
||||
native get_user_astats(index,wpnindex,stats[DODX_MAX_STATS],bodyhits[MAX_BODYHITS],wpnname[]="",len=0);
|
||||
|
||||
/* Resets life, weapon, victims and attackers user stats. */
|
||||
native reset_user_wstats(index);
|
||||
|
@ -63,7 +63,7 @@ native reset_user_wstats(index);
|
|||
/* Gets overall stats which stored in stats.dat file in amx folder
|
||||
* and updated on every mapchange or user disconnect.
|
||||
* Function returns next index of stats entry or 0 if no more exists. */
|
||||
native get_stats(index,stats[9],bodyhits[8],name[],len);
|
||||
native get_stats(index,stats[DODX_MAX_STATS],bodyhits[MAX_BODYHITS],name[],len);
|
||||
|
||||
/* Returns number of all entries in stats. */
|
||||
native get_statsnum();
|
||||
|
|
|
@ -27,28 +27,28 @@
|
|||
* 5 - hits
|
||||
* 6 - damage
|
||||
* For body hits fields see amxconst.inc. */
|
||||
native get_user_wstats(index,wpnindex,stats[8],bodyhits[8]);
|
||||
native get_user_wstats(index,wpnindex,stats[STATSX_MAX_STATS],bodyhits[MAX_BODYHITS]);
|
||||
|
||||
/* Gets round stats from given weapon index.*/
|
||||
native get_user_wrstats(index,wpnindex,stats[8],bodyhits[8]);
|
||||
native get_user_wrstats(index,wpnindex,stats[STATSX_MAX_STATS],bodyhits[MAX_BODYHITS]);
|
||||
|
||||
/* Gets overall stats which are stored in file on server
|
||||
* and updated on every respawn or user disconnect.
|
||||
* Function returns the position in stats by diff. kills to deaths. */
|
||||
native get_user_stats(index,stats[8],bodyhits[8]);
|
||||
native get_user_stats(index,stats[STATSX_MAX_STATS],bodyhits[MAX_BODYHITS]);
|
||||
|
||||
/* Gets round stats of player. */
|
||||
native get_user_rstats(index,stats[8],bodyhits[8]);
|
||||
native get_user_rstats(index,stats[STATSX_MAX_STATS],bodyhits[MAX_BODYHITS]);
|
||||
|
||||
/* Gets stats with which user have killed/hurt his victim. If victim is 0
|
||||
* then stats are from all victims. If victim has not been hurt, function
|
||||
* returns 0 in other case 1. User stats are reset on his respawn. */
|
||||
native get_user_vstats(index,victim,stats[8],bodyhits[8],wpnname[]="",len=0);
|
||||
native get_user_vstats(index,victim,stats[STATSX_MAX_STATS],bodyhits[MAX_BODYHITS],wpnname[]="",len=0);
|
||||
|
||||
/* Gets stats with which user have been killed/hurt. If killer is 0
|
||||
* then stats are from all attacks. If killer has not hurt user, function
|
||||
* returns 0 in other case 1. User stats are reset on his respawn. */
|
||||
native get_user_astats(index,wpnindex,stats[8],bodyhits[8],wpnname[]="",len=0);
|
||||
native get_user_astats(index,wpnindex,stats[STATSX_MAX_STATS],bodyhits[MAX_BODYHITS],wpnname[]="",len=0);
|
||||
|
||||
/* Resets life, weapon, victims and attackers user stats. */
|
||||
native reset_user_wstats(index);
|
||||
|
@ -56,7 +56,7 @@ native reset_user_wstats(index);
|
|||
/* Gets overall stats which stored in stats.dat file in amx folder
|
||||
* and updated on every mapchange or user disconnect.
|
||||
* Function returns next index of stats entry or 0 if no more exists. */
|
||||
native get_stats(index,stats[8],bodyhits[8],name[],len);
|
||||
native get_stats(index,stats[STATSX_MAX_STATS],bodyhits[MAX_BODYHITS],name[],len);
|
||||
|
||||
/* Returns number of all entries in stats. */
|
||||
native get_statsnum();
|
||||
|
|
|
@ -27,31 +27,31 @@
|
|||
* 5 - hits
|
||||
* 6 - damage
|
||||
* For body hits fields see amxconst.inc. */
|
||||
native get_user_wstats(index,wpnindex,stats[8],bodyhits[8]);
|
||||
native get_user_wstats(index,wpnindex,stats[STATSX_MAX_STATS],bodyhits[MAX_BODYHITS]);
|
||||
|
||||
/* Gets round stats from given weapon index.*/
|
||||
native get_user_wrstats(index,wpnindex,stats[8],bodyhits[8]);
|
||||
native get_user_wrstats(index,wpnindex,stats[STATSX_MAX_STATS],bodyhits[MAX_BODYHITS]);
|
||||
|
||||
/* Gets life (from spawn to spawn) stats from given weapon index.*/
|
||||
native get_user_wlstats(index,wpnindex,stats[8],bodyhits[8]);
|
||||
native get_user_wlstats(index,wpnindex,stats[STATSX_MAX_STATS],bodyhits[MAX_BODYHITS]);
|
||||
|
||||
/* Gets overall stats which are stored in file on server
|
||||
* and updated on every respawn or user disconnect.
|
||||
* Function returns the position in stats by diff. kills to deaths. */
|
||||
native get_user_stats(index,stats[8],bodyhits[8]);
|
||||
native get_user_stats(index,stats[STATSX_MAX_STATS],bodyhits[MAX_BODYHITS]);
|
||||
|
||||
/* Gets round stats of player. */
|
||||
native get_user_rstats(index,stats[8],bodyhits[8]);
|
||||
native get_user_rstats(index,stats[STATSX_MAX_STATS],bodyhits[MAX_BODYHITS]);
|
||||
|
||||
/* Gets stats with which user have killed/hurt his victim. If victim is 0
|
||||
* then stats are from all victims. If victim has not been hurt, function
|
||||
* returns 0 in other case 1. User stats are reset on his respawn. */
|
||||
native get_user_vstats(index,victim,stats[8],bodyhits[8],wpnname[]="",len=0);
|
||||
native get_user_vstats(index,victim,stats[STATSX_MAX_STATS],bodyhits[MAX_BODYHITS],wpnname[]="",len=0);
|
||||
|
||||
/* Gets stats with which user have been killed/hurt. If killer is 0
|
||||
* then stats are from all attacks. If killer has not hurt user, function
|
||||
* returns 0 in other case 1. User stats are reset on his respawn. */
|
||||
native get_user_astats(index,wpnindex,stats[8],bodyhits[8],wpnname[]="",len=0);
|
||||
native get_user_astats(index,wpnindex,stats[STATSX_MAX_STATS],bodyhits[MAX_BODYHITS],wpnname[]="",len=0);
|
||||
|
||||
/* Resets life, weapon, victims and attackers user stats. */
|
||||
native reset_user_wstats(index);
|
||||
|
@ -59,7 +59,7 @@ native reset_user_wstats(index);
|
|||
/* Gets overall stats which stored in stats.dat file in amx folder
|
||||
* and updated on every mapchange or user disconnect.
|
||||
* Function returns next index of stats entry or 0 if no more exists. */
|
||||
native get_stats(index,stats[8],bodyhits[8],name[],len);
|
||||
native get_stats(index,stats[STATSX_MAX_STATS],bodyhits[MAX_BODYHITS],name[],len);
|
||||
|
||||
/* Returns number of all entries in stats. */
|
||||
native get_statsnum();
|
||||
|
|
|
@ -275,6 +275,7 @@ scripting_files = [
|
|||
'include/amxmodx.inc',
|
||||
'include/core.inc',
|
||||
'include/csstats.inc',
|
||||
'include/csstats_const.inc',
|
||||
'include/cstrike.inc',
|
||||
'include/cstrike_const.inc',
|
||||
'include/csx.inc',
|
||||
|
|
Loading…
Reference in New Issue
Block a user