AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   switch players team each round (https://forums.alliedmods.net/showthread.php?t=57645)

iHaxor.Stan 07-08-2007 17:30

switch players team each round
 
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 07-08-2007 18:00

Re: switch players team each round
 
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 :D

oh and also, what module is required for this:
Code:

register_logevent("logevent_round_end", 2, "1=Round_End"

Lee 07-08-2007 20:48

Re: switch players team each round
 
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.

iHaxor.Stan 07-08-2007 21:06

Re: switch players team each round
 
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 :D

kp_uparrow 07-08-2007 21:14

Re: switch players team each round
 
um.. thats how its done

T0t4lly!

Lee 07-08-2007 21:19

Re: switch players team each round
 
:)

iHaxor.Stan 07-08-2007 21:27

Re: switch players team each round
 
Okay thank you VERY much!
I can't wait to finish my new plugin! argh!
+karma

iHaxor.Stan 07-08-2007 21:38

Re: switch players team each round
 
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..

Arkshine 07-08-2007 21:45

Re: switch players team each round
 
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

Lee 07-08-2007 21:46

Re: switch players team each round
 
Code:
switch(cs_get_user_team(id)) {     case CS_TEAM_T:     {         //do stuff     }     case CS_TEAM_CT:     {         //do other stuff     } }


All times are GMT -4. The time now is 21:35.

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