Raised This Month: $ Target: $400
 0% 

Team Change Event


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
raa
Senior Member
Join Date: Oct 2005
Old 06-12-2007 , 14:37   Team Change Event
Reply With Quote #1

Hi, I need help with detecting when a player changes a team(including SPEC). Also, either within that function or using another method I need to detect team changes within one round as well. This is for CS1.6

I've tried using client_infochanged but it detects more then just team change.
like so..

Code:
public client_infochanged(id)     {         if(cs_get_user_team(id)==CS_TEAM_CT)         {         client_print(id,print_chat,"CT");         }     else if(cs_get_user_team(id)==CS_TEAM_T)         {         client_print(id,print_chat,"TERRORIST");         }     return PLUGIN_CONTINUE }

Here are some other functions I've got

Code:
public event_new_round()     {     log_amx("NEWROUND EVENT TRIGGERED")             new players[32], num     get_players(players, num,"e","SPECTATOR");             for (new i; i < num; ++i)         {         new is_PLAYER_SPEC = cs_get_user_team(players[i]) == CS_TEAM_SPECTATOR         if(is_PLAYER_SPEC)             {             log_amx("PLAYER WENT SPEC")         }     }     return PLUGIN_CONTINUE }
That seems to think you went spec even when you didn't.

I've also tried making a check function on spawn
Code:
public check_team(id)     {     new newteam[33]     get_user_team(id, newteam, 32 )             if(!equali(newteam,stored_team))         {         // DO TASK     }     return PLUGIN_CONTINUE }
And on deathmsg doing "get_user_team(victim, stored_team, 32 )" to store the team for compare on spawn.


anyway, can anyone help me with the best way to do this?
__________________

Last edited by raa; 06-12-2007 at 14:42.
raa is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-12-2007 , 14:41   Re: Team Change Event
Reply With Quote #2

Did you try with TeamInfo event? : http://wiki.alliedmods.net/Half-Life...vents#TeamInfo
__________________
Arkshine is offline
raa
Senior Member
Join Date: Oct 2005
Old 06-12-2007 , 15:15   Re: Team Change Event
Reply With Quote #3

Sounds like that "Sets" rather then detects. Let me know if/how I'm missing the point of teaminfo.

I did try this though and for some reason it didn't work. (Its been a month or so since I've messed with this plugin)
Code:
register_event("TextMsg","event_teamchange","a","1=1","2&Game_join_te","2&Game_join_ct")
__________________
raa is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-12-2007 , 15:39   Re: Team Change Event
Reply With Quote #4

I mean :

Code:
register_event( "TeamInfo", "event_team_info", "a" );

Code:
public event_team_info() {     new id = read_data( 1 );             new team[12];     read_data( 2, team, sizeof team - 1 );         switch( team[0] )     {         case 'C' :  // CT         case 'T' :  // TERRORIST         case 'S' :  // SPECTATOR     } }
__________________
Arkshine is offline
Old 07-15-2007, 04:57
raa
This message has been deleted by raa. Reason: FIXED
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 10:37.


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