Raised This Month: $ Target: $400
 0% 

switch players team each round


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
iHaxor.Stan
BANNED
Join Date: Jul 2007
Old 07-08-2007 , 17:30   switch players team each round
Reply With Quote #1

I need to know how to make all the players switch teams every round. Example: Round ends. Terrorists become CT's and CT's become T's. Teams switch every round.
I really really need to know how, and can you please tell me what Module i'd need for this?
Thanks in advance.
iHaxor.Stan is offline
iHaxor.Stan
BANNED
Join Date: Jul 2007
Old 07-08-2007 , 18:00   Re: switch players team each round
Reply With Quote #2

oh, and I also need to know how you can check to see if a player is T or CT.
for example (this isn't what I'm coding): Let's say I wanted T's to all have 200 HP.
I know about making the cvar, and having the HP set to the cvar, and how to do that. But how would I make it so that it only happens for T's / CT's ?

Hope someone can help with these questions.


EDIT: Alrighty here, through searching a bit more, I found:
Code:
register_logevent("logevent_round_end", 2, "1=Round_End")  
So that's how you check to see if the round is ended, eh?
If so, I know just need to know how to switch the players to the other teams at this round end.

If anybody would be willing to make a little tiny script for me, like a whole plugin, but just really basic and simple, using these features, I'd be sure to give you ++karma and many credits in my new plugin

oh and also, what module is required for this:
Code:
register_logevent("logevent_round_end", 2, "1=Round_End")  

Last edited by iHaxor.Stan; 07-08-2007 at 18:34.
iHaxor.Stan is offline
Lee
AlliedModders Donor
Join Date: Feb 2006
Old 07-08-2007 , 20:48   Re: switch players team each round
Reply With Quote #3

Code:
//import miscellaneous natives including register_logevent() #include <amxmodx> //import Counter-Strike related natives #include <cstrike> //called when the plugin starts public plugin_init() {     //used to identify the plugin     register_plugin("PLUGIN", "VERSION", "AUTHOR");     //registers a function to be called at the end of a round     register_logevent("roundEnd", 2, "1=Round_End"); } public roundEnd() {     //stores the maximum number of players the server can accomodate     new maxPlayers = get_maxplayers();     //loops over each player slot     for(new i = 1; i <= maxPlayers; i++)     {         //if a player isn't connected in this slot, skip the remaining         //code inside the loop but continue iteration         if(!is_user_connected(i))         {             continue;         }                 //determines which team the player in this slot belongs to         switch(cs_get_user_team(i))         {             //if the player in this slot is a T, switch them to CT             case CS_TEAM_T: cs_set_user_team(i, CS_TEAM_CT);             //if the player in this slot is a CT, switch them to T             case CS_TEAM_CT: cs_set_user_team(i, CS_TEAM_T);         }     } }

The Function Reference will come in handy in future.

Last edited by Lee; 07-08-2007 at 21:29.
Lee is offline
Lee
AlliedModders Donor
Join Date: Feb 2006
Old 07-08-2007 , 21:46   Re: switch players team each round
Reply With Quote #4

Code:
switch(cs_get_user_team(id)) {     case CS_TEAM_T:     {         //do stuff     }     case CS_TEAM_CT:     {         //do other stuff     } }
Lee is offline
iHaxor.Stan
BANNED
Join Date: Jul 2007
Old 07-08-2007 , 21:06   Re: switch players team each round
Reply With Quote #5

I'm sorry but that whole code looks like a foreign language to me because I'm really new. I don't understand what that code does :\
Do you think you might be able to whip up a simple plugin that changes every players team on round end? oh, and without killing them ;)
comments on teh code explaining what the codes do would REALLY pwn
iHaxor.Stan is offline
kp_uparrow
Penalized Member
Join Date: Jun 2006
Location: 192.168.0.1
Old 07-08-2007 , 21:14   Re: switch players team each round
Reply With Quote #6

um.. thats how its done

T0t4lly!
__________________
I USED A SECOND ACCOUNT TO DO MORE KARMA UPS AND DOWNS UNTIL GREENTRYST CAUGHT ME
kp_uparrow is offline
Lee
AlliedModders Donor
Join Date: Feb 2006
Old 07-08-2007 , 21:19   Re: switch players team each round
Reply With Quote #7

Lee is offline
iHaxor.Stan
BANNED
Join Date: Jul 2007
Old 07-08-2007 , 21:27   Re: switch players team each round
Reply With Quote #8

Okay thank you VERY much!
I can't wait to finish my new plugin! argh!
+karma
iHaxor.Stan is offline
iHaxor.Stan
BANNED
Join Date: Jul 2007
Old 07-08-2007 , 21:38   Re: switch players team each round
Reply With Quote #9

Sorry for double post but i needed you to see this..
I need to know how to check if a user is on T or CT.. because this plugin im creating involves terrorists and CT's having different weapons and stuff..
iHaxor.Stan is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 07-08-2007 , 21:45   Re: switch players team each round
Reply With Quote #10

see get_user_team() or cs_get_user_function() function.

http://www.amxmodx.org/funcwiki.php?go=func&id=159
http://www.amxmodx.org/funcwiki.php?go=func&id=199
__________________
Arkshine is offline
Reply



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 21:35.


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