Raised This Month: $51 Target: $400
 12% 

Switch on client connect


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
selax
AlliedModders Donor
Join Date: Apr 2008
Location: Moscow
Old 12-23-2009 , 14:40   Switch on client connect
Reply With Quote #1

How switch client to CT on connect?
selax is offline
Bigbuck
Senior Member
Join Date: Jul 2009
Old 12-23-2009 , 23:34   Re: Switch on client connect
Reply With Quote #2

Use OnClientPutInServer and CS_SwitchTeam or ChangeClientTeam.
Bigbuck is offline
selax
AlliedModders Donor
Join Date: Apr 2008
Location: Moscow
Old 12-24-2009 , 07:15   Re: Switch on client connect
Reply With Quote #3

PHP Code:
public OnClientPutInServer(client)
{
    
CS_SwitchTeam(clientCS_TEAM_CT);

Switch me to CT model menu, i select model, but i in spectators or none team...
PHP Code:
public OnClientPutInServer(client)
{
    
ChangeClientTeam(clientCS_TEAM_CT);

Nothing do.
selax is offline
Bigbuck
Senior Member
Join Date: Jul 2009
Old 12-24-2009 , 09:23   Re: Switch on client connect
Reply With Quote #4

Try changing the CS_TEAM_CT to 2.
Bigbuck is offline
selax
AlliedModders Donor
Join Date: Apr 2008
Location: Moscow
Old 12-24-2009 , 09:48   Re: Switch on client connect
Reply With Quote #5

This not help
selax is offline
exvel
SourceMod Donor
Join Date: Jun 2006
Location: Russia
Old 12-24-2009 , 09:59   Re: Switch on client connect
Reply With Quote #6

Do this after player_team event
__________________
For admins: My plugins

For developers: Colors library
exvel is offline
Send a message via ICQ to exvel
selax
AlliedModders Donor
Join Date: Apr 2008
Location: Moscow
Old 12-24-2009 , 10:27   Re: Switch on client connect
Reply With Quote #7

I write this, but server is crashed
PHP Code:
    HookEvent("player_team",       Event_PlayerTeam,       EventHookMode_Pre); 
PHP Code:
public Event_PlayerTeam(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event,"userid"));
    if(
GetClientTeam(client) != CS_TEAM_T)
    {
        
CS_SwitchTeam(clientCS_TEAM_CT);
    }
    return 
Plugin_Handled;

selax is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 12-24-2009 , 12:54   Re: Switch on client connect
Reply With Quote #8

You're going to get an infinite loop there. You switch the player to CT and then check if the team is NOT T (which it won't be, because you're switching them to CT), which will just cause the server to keep doing the same thing over and over.
bl4nk is offline
Lord Canistra
Senior Member
Join Date: Mar 2009
Location: Tallinn, Estonia
Old 12-24-2009 , 15:16   Re: Switch on client connect
Reply With Quote #9

You don't need to check client's team here, just switch it to CT.
__________________
Lord Canistra is offline
selax
AlliedModders Donor
Join Date: Apr 2008
Location: Moscow
Old 12-26-2009 , 05:29   Re: Switch on client connect
Reply With Quote #10

PHP Code:
public Event_PlayerTeam(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event,"userid"));
    
ChangeClientTeam(clientCS_TEAM_CT);

This crash server too
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 14:58.


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