| closedHow to intercept changeteam button event ? |
| Started by npk06 on 01-21-2007, 12:51 PM |
Threads: 2
Joined: Dec 2006
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
Threads: 103
Joined: May 2005
could tryn
register_clcmd("jointeam","whatever_function")Threads: 2
Joined: Dec 2006
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 ?
Threads: 57
Joined: Oct 2005
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}rnrnrnrnYou can also just make it store "1" in a global array (ie. g_Changingteam[33]) and test that in the plugin.Threads: 2
Joined: Dec 2006
Many thanks for your help, I'm gonna try this asap, it should work fine ;)

