Raised This Month: $32 Target: $400
 8% 

Help with player_team


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
selax
AlliedModders Donor
Join Date: Apr 2008
Location: Moscow
Old 03-08-2010 , 16:04   Help with player_team
Reply With Quote #1

Why its no work?
PHP Code:
public Action:Event_PlayerTeam(Handle:Event, const String:Name[], bool:DontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(Event"userid"));
    new 
Team GetEventInt(Event"team");
    new 
oldTeam GetEventInt(Event"oldteam");
    
    if (
client 0)
    {
        if(
IsClientInGame(client) && !IsFakeClient(client))
        {
            if(
oldTeam == || oldTeam == 1)
            {
                
ChangeClientTeam(client3);
            }
            else if(
oldTeam == 2)
            {
                
ChangeClientTeam(client2);
            }
            else
            {
                if(
Team == 2)
                {
                    
ChangeClientTeam(clientoldTeam);
                }
                else
                {
                    
ChangeClientTeam(clientTeam);
                }
            }
        }
    }

selax is offline
API
Veteran Member
Join Date: May 2006
Old 03-08-2010 , 19:26   Re: Help with player_team
Reply With Quote #2

Did you HookEvent()?
__________________
API is offline
Send a message via AIM to API
selax
AlliedModders Donor
Join Date: Apr 2008
Location: Moscow
Old 03-09-2010 , 02:03   Re: Help with player_team
Reply With Quote #3

Quote:
Originally Posted by pimpinjuice View Post
Did you HookEvent()?
Yes.
When i join to the game i get many messages:
PHP Code:
<nicknamejoin to Counter-Terrorists
<nicknamejoin to Counter-Terrorists
<nicknamejoin to Counter-Terrorists
<nicknamejoin to Counter-Terrorists
<nicknamejoin to Counter-Terrorists
<nicknamejoin to Counter-Terrorists
<nicknamejoin to Counter-Terrorists
<nicknamejoin to Counter-Terrorists
<nicknamejoin to Counter-Terrorists
<nicknamejoin to Counter-Terrorists
<nicknamejoin to Counter-Terrorists 
CS_SwitchTeam not work too.
I think need a timer 0.1 sec, but how do timer to "ChangeClientTeam" function?

Last edited by selax; 03-09-2010 at 02:06.
selax is offline
Cooltad
Veteran Member
Join Date: Apr 2008
Old 03-09-2010 , 03:23   Re: Help with player_team
Reply With Quote #4

I'm pretty sure you created an infinite loop with that code.
__________________
Please, give me some rep if you found what I posted useful. :]
Cooltad is offline
selax
AlliedModders Donor
Join Date: Apr 2008
Location: Moscow
Old 03-09-2010 , 06:46   Re: Help with player_team
Reply With Quote #5

Where you find a infinite loop? Plugin have only icludes, plugin info, onpluginstart (only hook) and this...
selax is offline
Cooltad
Veteran Member
Join Date: Apr 2008
Old 03-09-2010 , 06:49   Re: Help with player_team
Reply With Quote #6

Think about it. Those check happen every team switch right? So switching their teams make all the checks happen again, then they get switched again, etc.
__________________
Please, give me some rep if you found what I posted useful. :]
Cooltad is offline
selax
AlliedModders Donor
Join Date: Apr 2008
Location: Moscow
Old 03-09-2010 , 08:57   Re: Help with player_team
Reply With Quote #7

CS_SwitchTeam and ChangeClientTeam trigger a player_team event?
selax is offline
selax
AlliedModders Donor
Join Date: Apr 2008
Location: Moscow
Old 03-09-2010 , 09:48   Re: Help with player_team
Reply With Quote #8

Close this thread please, i realised this by reg console cmd jointeam.
selax is offline
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 22:58.


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