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

[L4D2] Auto switch to infected team


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ilham92-cc-sakura
Senior Member
Join Date: Oct 2008
Location: /var/www/index.html
Old 02-07-2014 , 16:14   [L4D2] Auto switch to infected team
Reply With Quote #1

I create lan party for infected training, so I wrote simple code...

But this code I write, when player connect, in 60 second it will switch to infected, problem is when change side or next round, we had manually switch to infected,

so, how to make when player on survivor team, switch back to infected automatically?
PHP Code:
public bool:OnClientConnect(clientString:rejectmsg[], maxlen)
{
    
CreateTimer(60.0TimeSwitchclient);
    return 
true;
}

public 
Action:TimeSwitch(Handle:timerany:client)
{
    if(
IsClientInGame(client))
    {
        
ClientCommand(client,"jointeam 3");
    }
    else if(
IsClientConnected(client))
    {
        
CreateTimer(60.0TimeSwitchclient);
    }

__________________
ilham92-cc-sakura is offline
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 02-07-2014 , 17:48   Re: [L4D2] Auto switch to infected team
Reply With Quote #2

I have make a plugin for this in the request section.
Its not simple as that just switching and everything will work.
You need to preform SDKCall.
Also there is a bug.. if you from team infected switch to survivor is okay.. but if you from survivor switch to infected you'll have to switch to spectator first.

p/s: Wird that after 20 minutes do the google, i cant find the thread myself..

EDIT: Ah haa.. i have a backup it in my google drive... but is a private plugin. add me on steam
and your location is interesting..
__________________
If i happen to insulted you unintentionally,
it was me and Google Translate who did it.

Last edited by GsiX; 02-07-2014 at 18:22.
GsiX is offline
ilham92-cc-sakura
Senior Member
Join Date: Oct 2008
Location: /var/www/index.html
Old 02-07-2014 , 19:17   Re: [L4D2] Auto switch to infected team
Reply With Quote #3

lol...
I wrote in notepad, and no IDE for SourceMod~
__________________
ilham92-cc-sakura is offline
RU_6uK
SourceMod Donor
Join Date: May 2010
Old 02-09-2014 , 08:41   Re: [L4D2] Auto switch to infected team
Reply With Quote #4

PHP Code:
public OnPluginStart()
{
    
HookEvent("player_team"Event_PlayerTeam);
}

public 
Action:Event_PlayerTeam(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserIdGetEventIntevent"userid" ) );
    new 
team GetEventIntevent"team" );
    new 
bool:disconnect GetEventBoolevent"disconnect" );
    
    if ( !
IsFakeClientclient ) && team != && !disconnect )
    {
        
ChangeClientTeam(client3);
    }

RU_6uK 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 16:10.


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