Day of Defeat Plugins Community
This site is an archive — everything is readable and downloadable, nothing can be posted. Admin
Archive › Old Forum Threads › General › Requests for DoD Plugins › How to intercept changeteam button event ?
5 posts, 3 people · 3,093 views Thread Rating: ★★★★★
closedHow to intercept changeteam button event ?
Started by npk06 on 01-21-2007, 12:51 PM
N npk06
started this thread
Posts: 6
Threads: 2
Joined: Dec 2006
01-21-2007, 12:51 PM #1

Hi,rnrnI don't really want a plugin, but a hint on how to check something...rnrnIn fact, I'd like to prevent my plugin from acting when a player tries to change team. It would sound something like :rnrnif player[i] doesn't press change team button, then do something rnrnI hoped there would be some IN_SWITCHTEAM constant in the engine module but unfortunately it seems that there's not...rnrnAny idea on how to do that ?rnrnThanks a lot for your help

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
01-21-2007, 06:45 PM #2

could tryn

register_clcmd("jointeam","whatever_function")
N npk06
started this thread
Posts: 6
Threads: 2
Joined: Dec 2006
01-21-2007, 07:07 PM #3

Can't I rather use something likennif get_clcmd(.....) ?nnthere must be a native command called when you press the team key, but I don't know it.nnor it is clientside and it can't be intercepted until it has occured ?

Wilson [29th ID]
posted here
Posts: 623
Threads: 57
Joined: Oct 2005
01-22-2007, 01:37 AM #4

Diamond is right. It will be called as soon as the client changes team.rnrn

rnrnregister_clcmd( "jointeam", "function_handleteam" );rnrnpublic function_handleteam( id ) {rn     new args[16];rn     read_args( args, 15 );rn     new team = str_to_num( args );rnrn     if ( team == ALLIES )rn     {rn          // Joined alliesrn     }rn     else if ( team == AXIS )rn     {rn          // Joined axisrn     }rn     elsern     {rn          // Joined spectatorrn     }rn     return PLUGIN_HANDLED;rn}rnrn
rnrnYou can also just make it store "1" in a global array (ie. g_Changingteam[33]) and test that in the plugin.

N npk06
started this thread
Posts: 6
Threads: 2
Joined: Dec 2006
01-22-2007, 06:52 PM #5

Many thanks for your help, I'm gonna try this asap, it should work fine ;)

Archive › Old Forum Threads › General › Requests for DoD Plugins › How to intercept changeteam button event ?
DoD Plugins Archive · Repository · Old Forum Threads · Maps · Admin · built 14 Sep 2026 00:34 UTC