View Single Post
Author Message
souvikdas95
Senior Member
Join Date: Mar 2012
Old 02-25-2014 , 23:40   Module: CSX Extended 2.0.1.0
Reply With Quote #1


CSX Extended 2.0.1.0
- last updated : 9 July 2016



Description :

This is a useful Performance + Bugfix + Native update for those who have been suffering due to not being able to Add/Edit Stats of Players from AmxModX. Note that CSX Module is only for "cstrike"


Features :
  • Complete Pack for Stats Management using AMXModX
  • Multi-threaded Stats Update - High Performance
  • Added Compatibility with Older Versions of CSX
  • Module Side SQL support


New Natives :

PHP Code:
/*
* Fields in Stats[8]:
* 0 - kills
* 1 - deaths
* 2 - headshots
* 3 - teamkilling
* 4 - shots
* 5 - hits
* 6 - damage
* 7 - <null>
*
* Fields in Stats2[4]:
* 0 - total defusions
* 1 - bomb defused
* 2 - bomb plants
* 3 - bomb explosions
*
* Fields in Bodyhits[8]:
* 0 - <null>
* 1 - Head
* 2 - Chest
* 3 - Stomach
* 4 - Left Hand
* 5 - Right Hand
* 6 - Left Leg
* 7 - Right Leg
*
* Important Note : Position = Rank - 1. eg. If index denotes the position of 
* rank 1 player, then index = 0. 
*/

/* 
*  Returns the Rank of Player. --> index = id. 
*  Returns 0 if player is not valid/out of range
*/
native get_user_rank(index);

/*
*  Gets current session score of player --> index = id
*  Returns 0 if player is not valid/out of range else returns 1
*/
native get_user_score(index, &frags, &deaths);

/*
*  Sets overall stats of Player with given parameters. --> index = id. 
*  Returns 0 if player is not valid/out of range
*  Returns new Rank if sync is true else returns -1
*
*  Note - If you don't need to get the new rank immediately, 
*  you can set sync = false, so that the server can asynchronously
*  update the stats without causing any delay.
*/
native set_user_stats(indexstats[8], bodyhits[8], boolsync true);
native set_user_stats2(indexstats2[4], boolsync true);

/*
*  Sets round stats of Player with given parameters. --> index = id. 
*  Returns 0 if player is not valid/out of range else returns 1
*/
native set_user_rstats(indexstats[8], bodyhits[8]);

/*
*  Sets overall stats with given parameters. --> index = position.
*  Returns 0 if index is not found in rank table
*  Returns new Rank if sync is true else returns -1
*
*  Note - If you don't need to get the new rank immediately, 
*  you can set sync = false, so that the server can asynchronously
*  update the stats without causing any delay.
*/
native set_stats(indexstats[8], bodyhits[8], boolsync true);
native set_stats2(indexstats2[4], boolsync true);

/*
*  Sets current session score of player --> index = id
*  Returns 0 if player is not valid/out of range else returns 1
*/
native set_user_score(indexfragsdeaths);

/*
*  Resets overall stats to null --> index = id.
*  Returns 0 if player is not valid/out of range
*  Returns new Rank if sync is true else returns -1
*
*  Note - If you don't need to get the new rank immediately, 
*  you can set sync = false, so that the server can asynchronously
*  update the stats without causing any delay.
*
*  Note - This doesn't differentiate stats or stats2.
*  It simply nulls the entire Stats structure of index.
*/
native reset_user_stats(indexboolsync true)

/*
*  Resets overall stats to null --> index = position.
*  Returns 0 if index is not found in rank table
*  Returns new Rank if sync is true else returns -1
*
*  Note - If you don't need to get the new rank immediately, 
*  you can set sync = false, so that the server can asynchronously
*  update the stats without causing any delay.
*/
native reset_stats(indexboolsync true)

/*
*  Adds/Pushes overall stats with given parameters.
*  Returns 0 if Stats Entry already exists or new one failed to be created
*  Returns new Rank if sync is true else returns -1
*
*  Note - If you don't need to get the new rank immediately, 
*  you can set sync = false, so that the server can asynchronously
*  update the stats without causing any delay.
*
* IMPORTANT : "unique" is based on the value of "csstats_rank" cvar 
* which sets the basis for uniquely defining a rankstats entry:
* 0 - name[]
* 1 - authid[]
* 2 - ip[]
*
* WARNING : Use this function with Caution.
*/
native push_stats(const unique[], const name[], stats[8], bodyhits[8], boolsync true);

/*
* Removes and Deletes the Stats Entry. --> index = position. 
*  Returns -1 if position is not found.
*  Returns 0 if player with the position is connected to server.
*  Returns 1 if successfully removed.
*/
native remove_stats(index);

/* 
*  Reloads all the stats from the file and 
*  refresh rankstats of all the connected 
*  players and also reset current score of player
*  Returns 1
*
*  Note - If the stats are not externally edited
*  then this will restore the stats from previous
*  map change or from start of HLDS as by default,
*  stats file is saved only at these moments.
*
*  If the stats file doesn't exist, the function
*  will not load stats. The stats in-game will remain
*  the same as before.
*
*  default stats file path : amxmodx/data/csstats.dat
*/
native force_load_stats();

/*
*  Manually saves all the stats till previous round
*  before Restart of Map/Server.
*  Returns 1
*
*  default stats file path : amxmodx/data/csstats.dat
*/
native force_save_stats();

/*
*  Resets the Score
*/
stock reset_user_score(id)
{
    return 
set_user_scoreid0);


Modified cVars :
  1. csstats_maxsize : Sets the maximum size of csstats.
    • Default value : 9000
    • value < 0 : Unlimited
    • value = 0 : No Save


Credits :
  • Shooting King.
  • Claudiuhks.

Note: Currently this works with only windows. I still have to go through some of the pThreads api for making it work with linux.
Attached Files
File Type: inc csstats_custom.inc (5.0 KB, 636 views)
File Type: inc cstrike.inc (44.8 KB, 729 views)
File Type: zip csx_extended_amxx_2_0_1_0_win32.zip (151.6 KB, 772 views)

Last edited by souvikdas95; 07-09-2016 at 02:03. Reason: Version Update 2.0.1.0: Fixed Critical Rank Update Bug
souvikdas95 is offline