View Single Post
Author Message
Fyren
FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren
Join Date: Feb 2106
Old 12-20-2008 , 07:13   [L4D] Unscrambler
Reply With Quote #1

This requires a SM 1.2 snapshot, obviously, since it's for L4D.

Place the l4dunscrambler.txt file in your sourcemod/gamedata directory.

The web compiler (which is 1.0.4) can't compile this as I use MaxClients. Feel free to compile on your own (with 1.2+, 1.1+ might work) instead of using the attached smx.

----

Added Windows signatures January 4th.

Bugfix posted on January 1st.

Bugfix posted on December 24th.

Turned off debug again December 28th, accidentally turned it on last update. (#define DEBUG 0 instead of 1, makes pretty big logs when on.)

In versus, when someone joins mid-game, the server will often scramble teams in later rounds. Until Valve fixes it, trying to play on a team with friends can be frustrating. This plugin stores the team list and at the beginning of a new round, swaps players around if necessary.

The plugin will create a config file, cfg/sourcemod/l4du.cfg.

There are two variables that set how long the plugin will try to fix teams on a new map. These are l4du_wait and l4du_holdon. Both are numbers of seconds to wait. It waits l4du_wait seconds before it gives up on trying to fix teams, unless there are still players mid-connect, in which case it waits for l4du_holdon more seconds. So, by default, it waits 30s at most. I do not recommending setting these higher, as people switching teams manually during this time will get forced back if they were playing in the previous map. These times are there to accomodate slow-loading players.

If you have a problem with the plugin, you should probably change the DEBUG define to 1 and put your log file up somewhere. It will make a log in the sourcemod logs directory. It outputs massive amounts of debug info and echoes to the server console, so you don't want to leave DEBUG 1 all the time, probably.

Random notes:
My code sucks but I'm sure Valve will fix the scrambling problem, so I didn't invest much effort into it. It could be much more efficient. It uses the SDKCall()s to properly give a player control of survivor bots as simply using ChangeClientTeam() from SM doesn't do so. I have only tested on my own Linux server as of now, but it works for me with no issues.

----

This requires a SM 1.2 snapshot, obviously, since it's for L4D.

Place the l4dunscrambler.txt file in your sourcemod/gamedata directory.

The web compiler (which is 1.0.4) can't compile this as I use MaxClients. Feel free to compile on your own (with 1.2+, 1.1+ might work) instead of using the attached smx.
Attached Files
File Type: sp Get Plugin or Get Source (l4dunscrambler.sp - 2902 views - 13.3 KB)
File Type: smx l4dunscrambler.smx (6.1 KB, 3609 views)
File Type: smx l4dunscrambler.debug.smx (7.4 KB, 1736 views)
File Type: txt l4dunscrambler.txt (486 Bytes, 3877 views)

Last edited by Fyren; 01-04-2009 at 16:48. Reason: updated signatures for Windows
Fyren is offline