AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Team Change Event (https://forums.alliedmods.net/showthread.php?t=56370)

raa 06-12-2007 14:37

Team Change Event
 
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?

Arkshine 06-12-2007 14:41

Re: Team Change Event
 
Did you try with TeamInfo event? : http://wiki.alliedmods.net/Half-Life...vents#TeamInfo

raa 06-12-2007 15:15

Re: Team Change Event
 
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")

Arkshine 06-12-2007 15:39

Re: Team Change Event
 
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     } }


All times are GMT -4. The time now is 10:37.

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