Raised This Month: $ Target: $400
 0% 

[Solved] How to Catch Change Team Event


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Stylaa
Senior Member
Join Date: Oct 2009
Location: Flensburg, Germany
Old 01-13-2011 , 09:07   [Solved] How to Catch Change Team Event
Reply With Quote #1

How i can catch the Change Team Event?

i store the Teams in a Variable

And how to catch the Teamchange and not just hook jointeam

i need cs_set_user_team too

Greetings


:My Code:

PHP Code:
public catch_team(id)
{
    if ( 
cs_get_user_team id ) == CS_TEAM_T )
    {
        
PlayerInfo[id][p_team] = 1
    
}
    else if( 
cs_get_user_team id ) == CS_TEAM_CT )
    {
        
PlayerInfo[id][p_team] = 2
    
}
    else if( 
cs_get_user_team id ) == CS_TEAM_SPECTATOR )
    {
        
PlayerInfo[id][p_team] = 3
    
}
    else if( 
cs_get_user_team id ) == CS_TEAM_UNASSIGNED )
    {
        
PlayerInfo[id][p_team] = 4
    
}

__________________

Some People brings Happynes by Coming
Some by Going

Last edited by Stylaa; 01-13-2011 at 11:17.
Stylaa is offline
Send a message via ICQ to Stylaa
SpeeDeeR
Veteran Member
Join Date: Mar 2010
Location: Bulgaria
Old 01-13-2011 , 09:09   Re: How to Catch Change Team Event
Reply With Quote #2

Registering jointeam in your case is a way.

Last edited by SpeeDeeR; 01-13-2011 at 09:14. Reason: clearness
SpeeDeeR is offline
Elusive138
Senior Member
Join Date: Dec 2010
Old 01-13-2011 , 09:26   Re: How to Catch Change Team Event
Reply With Quote #3

http://wiki.alliedmods.net/Half-Life...vents#TeamInfo

Use with register_event. TeamInfo is sent to all players (I think) to let themknow someone has changed teams. Use read_data(1) to get id, and read_data(2) to get team name.

Also, you should be using a switch instead of if...else if. Definitely do not call cs_get_user_team 4 times...
Elusive138 is offline
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 01-13-2011 , 09:36   Re: How to Catch Change Team Event
Reply With Quote #4

Code:
public catch_team(id) {     if ( cs_get_user_team ( id ) == CS_TEAM_T )     {         PlayerInfo[id][p_team] = 1     }     else if( cs_get_user_team ( id ) == CS_TEAM_CT )     {         PlayerInfo[id][p_team] = 2     }     else if( cs_get_user_team ( id ) == CS_TEAM_SPECTATOR )     {         PlayerInfo[id][p_team] = 3     }     else if( cs_get_user_team ( id ) == CS_TEAM_UNASSIGNED )     {         PlayerInfo[id][p_team] = 4     } }
You can simply do this instead:
Code:
public catch_team(id) {     PlayerInfo[id][p_team] = _:cs_get_user_team ( id ) }
__________________

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
Stylaa
Senior Member
Join Date: Oct 2009
Location: Flensburg, Germany
Old 01-13-2011 , 11:17   Re: How to Catch Change Team Event
Reply With Quote #5

Thanks this works now
__________________

Some People brings Happynes by Coming
Some by Going
Stylaa is offline
Send a message via ICQ to Stylaa
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 02:13.


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