Raised This Month: $7 Target: $400
 1% 

Module: CS Team Changer Ultimate [avoids crashes in aggressive changes]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 07-31-2011 , 15:15   Module: CS Team Changer Ultimate [avoids crashes in aggressive changes]
Reply With Quote #1


- Counter-Strike Team Changer -


Download
View CPP file

I see that all plugins that change the teams excessively contain delay to avoid crashes. Native get_user_team is not used because of receiving wrong values and there are tasks with TeamInfo message.

Using this extension you may change the teams without any crash, indifferently you are using an aggressive changing type or not!

Also, this extension updates the AMX Mod X team indexes at clients then you will be able to use get_user_team native without problems, it will return fair values.

The difference between this and CStrike module is here (42).

An example is listed below.

PHP Code:
static iPlayers32 ], iNumiiPlayer;
get_playersiPlayersiNum );

for( 
0iNumi++ )
{
     
iPlayer iPlayers];

     switch( 
get_user_teamiPlayer ) )
     {
           case 
_:CSTEAM_TERRORISTcs_set_teamiPlayerCSTEAM_CT );
           case 
_:CSTEAM_CTcs_set_teamiPlayerCSTEAM_TERRORIST );
     }

     
// If you will use again this function, get_user_team native will give you a fair result!
     // The players will be transfering from a team to other without problems.



It is tested, it works perfectly with thirty two players. It changes sixteen players from Terrorists to Counter-terrorists and sixteen players from Counter-terrorists to Terrorists in the same time without any headaches instead of CStrike extension that crashes the server.

The header file is the one listed below.

PHP Code:
/**
 * Counter-Strike Team Changer
 * by Hattrick (Claudiu HKS)
 */

#if defined _cs_team_changer_included
  #endinput
#endif

#define _cs_team_changer_included

#if AMXX_VERSION_NUM >= 175
  #pragma reqlib cs_team_changer

  #if !defined AMXMODX_NOAUTOLOAD
    #pragma loadlib cs_team_changer
  #endif
#else
  #pragma library cs_team_changer
#endif

/** There are the teams you may use.
 */
enum CSTeam
{
  
CSTEAM_UNASSIGNED 0,
  
CSTEAM_TERRORIST 1,
  
CSTEAM_CT 2,
  
CSTEAM_SPECTATOR 3
};

/** You may do 64 transfers once a second using this extension! Server will not crash!
 * CStrike extension using cs_set_user_team native will crash server when approximately 24 transfers are reached!
 */

/** Transfers a player from a team to other one. The player's model will not be touched. The server will not be forged.
 * This native will automatically send a TeamInfo message. Will also change the team offset and the team index declared by AMX Mod X extension.
 */
native cs_set_team(ClientCSTeam:Team);

/** Changes the player's team index declared by AMX Mod X extension. The team offset and the scores' table will not be touched.
 * There will not be a TeamInfo message.
 */
native cs_set_team_id(ClientCSTeam:Team);

/** Changes the player's team offset. Scores' table will not be touched.
 */
native cs_set_team_offset(ClientCSTeam:Team);

/** Sends a fast TeamInfo message. The player will be transfered at the team you want but only in the scores' table.
*/
native cs_set_team_tablescore(ClientCSTeam:Team); 
Attached Files
File Type: zip CS Team Changer.zip (309.8 KB, 2242 views)
__________________

Last edited by claudiuhks; 02-20-2015 at 00:14.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
Pastout
Senior Member
Join Date: Dec 2010
Location: 1337 Street LeetTown
Old 07-31-2011 , 16:10   Re: Module: CS Team Changer [avoid crashes in aggressive changes]
Reply With Quote #2

Wow dude keep up the good work man.
Pastout is offline
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 08-01-2011 , 15:46   Re: Module: CS Team Changer [avoid crashes in aggressive changes]
Reply With Quote #3

Plz also point out the differences between this native and cs_set_user_team.
__________________

My Plugins For ZP

Inactive due to College and Studies
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-01-2011 , 16:31   Re: Module: CS Team Changer [avoid crashes in aggressive changes]
Reply With Quote #4

It's written in the first post.
__________________
Arkshine is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 08-02-2011 , 08:55   Re: Module: CS Team Changer [avoid crashes in aggressive changes]
Reply With Quote #5

I remember the normal cs_set_user_team() way working on normal server, but crashing on Zombie Plague with a lot of players. Have you tried this on ZP?
__________________
hleV is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-02-2011 , 09:00   Re: Module: CS Team Changer [avoid crashes in aggressive changes]
Reply With Quote #6

Quote:
Originally Posted by claudiuhks View Post
Also, this module updates the AMXX API team's ID at clients and you will can use the get_user_team native without problems, it will be giving you a fair result (not wrong)
This will be fixed in version 1.8.2dev as soon as Bail pushes the fix.

Quote:
Originally Posted by claudiuhks View Post
Lot of thanks to Arkshine for rewriting and compiling the module in windows and linux!
This makes it sound like Arkshine did everything except post it on the forums.
__________________

Last edited by fysiks; 08-02-2011 at 10:10.
fysiks is online now
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-02-2011 , 09:13   Re: Module: CS Team Changer [avoid crashes in aggressive changes]
Reply With Quote #7

I've not rewritten it, even if the code is quite small, I've just cleaned up a bit the code, changing some things (like changing 80% of code taken by few "if..else if..else" replacing by a "switch") and compiling. Don't know why he says "rewritten", it was not the purpose and with such small code, not really possible. So, claudiuhks, you should fix to avoid fysiks be traumatized more ;).
__________________

Last edited by Arkshine; 08-02-2011 at 10:55.
Arkshine is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 08-02-2011 , 12:35   Re: Module: CS Team Changer [avoid crashes in aggressive changes]
Reply With Quote #8

Mister fysiks, I just said that Arkshine opened the source, wrote something in it and closed. Why did you think he made all the code? Am I supposed to say what exactly he wrote in the source? And am I supposed to hide that he helped me with some code?

How to fix the problem with 'get_user_team' while the big plugins are using set_pdata_int? Do you think the offset changing with the fakemeta module will update the AMXX API team's ID?

The people are supposed to do thousands of things for make you happy mister fysiks...

@Arkshine at

Code:
you should fix to avoid fysiks be traumatized more ;).
Sorry but I don't think I have mind/power enough for do this...

@hleV at

Code:
I remember the normal cs_set_user_team() way working on normal server, but crashing on Zombie Plague with a lot of players. Have you tried this on ZP?
Tested at 32 players with like 120 team changes in one second
Also this cs_team_changer module is running on my zombie plague server, it is still alive since two or three days ago...

[IMG]http://img607.**************/img607/1240/unledhly.th.png[/IMG]

Without proofs we don't speak
__________________

Last edited by claudiuhks; 08-06-2011 at 15:42.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-02-2011 , 12:45   Re: Module: CS Team Changer [avoid crashes in aggressive changes]
Reply With Quote #9

Quote:
Originally Posted by claudiuhks View Post
Mister fysiks, I just said that Arkshine opened the source, wrote something in it and closed. Why did you think he made all the code?
In English, you said that he wrote the whole thing again. In reality, he "added/remove/optimized" a few things. No need to get all defensive.

Arkshine's comment about me being "traumatized" was a joke. FYI
__________________
fysiks is online now
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 08-02-2011 , 12:53   Re: Module: CS Team Changer [avoid crashes in aggressive changes]
Reply With Quote #10

can you explain what does "FYI" mean
I'm poor in english!
__________________
QQ:116268742
K.K.Lv is offline
Send a message via MSN to K.K.Lv
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 01:21.


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