Raised This Month: $32 Target: $400
 8% 

Module: CSX Extended 2.0.1.0


Post New Thread Reply   
 
Thread Tools Display Modes
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, 569 views)
File Type: inc cstrike.inc (44.8 KB, 670 views)
File Type: zip csx_extended_amxx_2_0_1_0_win32.zip (151.6 KB, 702 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
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-26-2014 , 03:37   Re: Module: CSX Extended (v1.0)
Reply With Quote #2

Why you don't file a bug report so to be fixed in offiical release?
__________________
Arkshine is offline
souvikdas95
Senior Member
Join Date: Mar 2012
Old 02-26-2014 , 04:35   Re: Module: CSX Extended (v1.0)
Reply With Quote #3

Just like how the 1.8.3 dev releases still don't include updates from your Hamsandwich Module v1.4 :\
Who knows when they will update. But anyways please tell me where exactly should I post the report?
souvikdas95 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-26-2014 , 05:03   Re: Module: CSX Extended (v1.0)
Reply With Quote #4

I've filed a bug report about that, but Ham update needs testing. I've already asked people, but nobody want to help, so I'm alone to do this. That's said, this update should be in 1.8.3.

Also you can't compare a big patch to small fixes.

Anyway, you should actually wait, because BAILOPAN is making some changes and bug tracker is unavailable atm.
__________________
Arkshine is offline
souvikdas95
Senior Member
Join Date: Mar 2012
Old 02-26-2014 , 05:53   Re: Module: CSX Extended (v1.0.1)
Reply With Quote #5

Regarding Fixes, the module requires a lot of other fixes that I did not mention because they will require changing of the function of natives to some extent. eg. There is no need for separate native for get/set of stats2[4]. Yet for some unknown reason, two separate natives have been created.
Also, the new natives have been a great [REQ] for a long time among the scripters.
I don't deny the fact that with this separate release, there could be problems with differentiating this module from official release some day, yet as for now, I think, till an official release is done, this updated module could serve well.
I assure you that if ever a release is done with these updates, I would not hesitate to remove this.
souvikdas95 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-26-2014 , 06:29   Re: Module: CSX Extended (v1.0.1)
Reply With Quote #6

You have to keep in mind that if there are 2 natives, it's most likely to keep backward compatibility.
If you change things in official module, you should avoid to do unnecessary modifications.
__________________
Arkshine is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-26-2014 , 06:41   Re: Module: CSX Extended (v1.0.1)
Reply With Quote #7

There are 2 natives because 1 of them is cs specific.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 02-26-2014 at 06:41.
ConnorMcLeod is offline
souvikdas95
Senior Member
Join Date: Mar 2012
Old 02-26-2014 , 09:21   Re: Module: CSX Extended (v1.0.1)
Reply With Quote #8

@Arkshine - That's what. I had to keep that in mind. For this, the one who actually developed the module should have kept in mind about future requirements as well. If possible, then csx should be redeveloped if possible in one single release so that der are no complications in it's way of work. for instance, see that bodyhits[0] has no value similarly as stats[7] or you would find that in some, rank is both set at stats[7] as well as returned! Also, they have differentiated b/w rank and position which can cause a lot of trouble.
What I feel is that, when they created the module, they started with a base module for all games and split it among cs, dod, esf, ns, tfc and ts. If that's so, the chances for carelessness is high!

@ConnorMcLeod - but get_score function inside csstats.sma has both put together into single stats[11]... why? What do you mean by cs specific? There are only 2 games : cs and cz that it supports and the events are almost same in each of them.
Quote:
int AmxxCheckGame(const char *game)
{
if (strcasecmp(game, "cstrike") == 0 ||
strcasecmp(game, "czero") == 0)
{
return AMXX_GAME_OK;
}
return AMXX_GAME_BAD;
}

Last edited by souvikdas95; 02-26-2014 at 10:20.
souvikdas95 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-26-2014 , 10:23   Re: Module: CSX Extended (v1.0.1)
Reply With Quote #9

It's that, same base for different mods. Stats doesn't differ really the mods. It makes sense they reused code, then changing specific-mod things. That's the point also having same native name (get_stats() for example) for different mods (different modules, tfcx, dodx, etc..). You can have more easily a multimod plugin as code itself won't change. Same for forward, you will find "client_damage()" available for several mods.

get_stats2() is specific to CS, as you can see yourself in the code, it's related to bomb stats (explosion, defusing, etc.).
__________________
Arkshine is offline
souvikdas95
Senior Member
Join Date: Mar 2012
Old 02-26-2014 , 10:25   Re: Module: CSX Extended (v1.0.1)
Reply With Quote #10

and csx module itself is for CS. Hence the carelessness :\
I do value the importance of similar natives. Hence, a multimod stats would be appreciated.
However the best would be to merge csx with cstrike and similarly for all other mods and separate natives should be created. eg. cs_get_user_stats() ... cs_set_user_stats(). This would be the best because extra checks could be removed + it would be more direct + since stats data can be bulky at times, would help reduce the load to a large extent + support for customized fields would make it perfect

Last edited by souvikdas95; 02-26-2014 at 10:38.
souvikdas95 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:17.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode