Raised This Month: $193 Target: $400

[EXTENSION] Left 4 Downtown (0.4.6) - L4D2 is here and supported

Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Veteran Member
Join Date: Mar 2004
Old 04-27-2009 , 01:58   [EXTENSION] Left 4 Downtown (0.4.6) - L4D2 is here and supported
Reply With Quote #1

Left 4 Downtown

Unlock maximum players slots ( up to 18*) in Left 4 Dead 1/2, also provide some new developer functionality.
Finale auto-spawns can now be disabled with srsmod

Download the left4downtown- located at the bottom of the post and extract it into /left4dead2/addons/sourcemod/

Simply set the l4d_maxplayers CVAR to what you want in server.cfg (e.g. l4d_maxplayers 12), or -1 to disable override. You can also set -maxplayers or +maxplayers from command line instead of using the CVAR.

Plugins/Maxplayers - take advantage of those extra slots!
* l4d_maxplayers - valid value is x, such that -1 <= x <= +maxplayers <= maxclients 
  - using -1 will disable the slots patching (default behavior)
  - using any other value will patch L4D to allow more than the default slots
  - setting +maxplayers to anything other than 8 will change the default cvar value to that
* left4downtown_version - the current version of this extension
Plugins/Developers - plugins using my natives
PHP Code:
 * @brief Called whenever ZombieManager::SpawnTank(Vector&,QAngle&) is invoked
 * @remarks Not invoked if z_spawn tank is used and it gives a ghosted/dead player tank
 * @param vector    Vector coordinate where tank is spawned
 * @param qangle    QAngle where tank will be facing
 * @return         Pl_Handled to block tank from spawning, Pl_Continue otherwise.
forward Action:L4D_OnSpawnTank(const Float:vector[3], const Float:qangle[3]);

 * @brief Called whenever ZombieManager::SpawnWitch(Vector&,QAngle&) is invoked
 * @param vector    Vector coordinate where witch is spawned
 * @param qangle    QAngle where witch will be facing
 * @return         Pl_Handled to block witch from spawning, Pl_Continue otherwise.
forward Action:L4D_OnSpawnWitch(const Float:vector[3], const Float:qangle[3]);

 * @brief Called whenever CTerrorGameRules::ClearTeamScores(bool) is invoked
 * @remarks     This resets the map score at the beginning of a map, and by checking 
 *                the campaign scores on a small timer you can see if they were reset as well.
 * @param newCampaign  if true then this is a new campaign, if false a new chapter
 * @return         Pl_Handled to block scores from being cleared, Pl_Continue otherwise.
forward Action:L4D_OnClearTeamScores(bool:newCampaign);

 * @brief Called whenever CTerrorGameRules::SetCampaignScores(int,int) is invoked
 * @remarks The campaign scores are updated after the 2nd round is completed
 * @param scoreA  score of logical team A
 * @param scoreB  score of logical team B
 * @return         Pl_Handled to block campaign scores from being set, Pl_Continue otherwise.
forward Action:L4D_OnSetCampaignScores(&scoreA, &scoreB);

 * @brief Called whenever CDirector::OnFirstSurvivorLeftSafeArea
 * @remarks A versus round is started when survivors leave the safe room, or force started
 *          after 90 seconds regardless.
 * @param client  the survivor that left the safe area first
 * @return         Pl_Handled to block round from being started, Pl_Continue otherwise.
forward Action:L4D_OnFirstSurvivorLeftSafeArea(client);

 * @brief Called whenever CDirector::GetScriptValue(const char*, int) is invoked
 * @remarks A script value is map specific
 * @param key     the script's key name
 * @param retVal  what to override the return value with
 * @return         Pl_Handled to override return value, Pl_Continue otherwise.
forward Action:L4D_OnGetScriptValueInt(const String:key[], &retVal);

 * @brief Called whenever CTerrorPlayer::OnEnterGhostState(CTerrorPlayer*) is invoked
 * @remarks This happens when a player enters ghost mode (or in finales auto-materialized)
 * @param client  the client that has entered ghost mode
forward L4D_OnEnterGhostState(client); 
PHP Code:

 * @brief Get the current campaign scores stored in the Director
 * @remarks The campaign scores are updated after L4D_OnSetCampaignScores
 * @deprecated This will set the scores to -1 for both sides on L4D2,
 *               this function is no longer supported.
 * @param scoreA  score of logical team A
 * @param scoreB  score of logical team B
 * @return         1 always
native L4D_GetCampaignScores(&scoreA, &scoreB);

 * @brief Get the team scores for the current map
 * @remarks The campaign scores are not set until the end of round 2,
 *           use L4D_GetCampaignScores to get them earlier.
 * @deprecated This function can be called through SDKTools using CTerrorGameRules,
 *          and so you should switch off to using SDKTools instead of this native.
 * @param logical_team  0 for A, 1 for B
 * @param campaign_score  true to get campaign score instead of map score
 * @return         the logical team's map score 
 *                      or -1 if the team hasn't played the round yet,
 *                or the team's campaign score if campaign_score = true
native L4D_GetTeamScore(logical_teamcampaign_score=false);

 * @brief Restarts the setup timer (when in scavenge mode)
 * @remarks If game has already started, the setup timer will show,
 *           but it still won't go back into setup.
native L4D_ScavengeBeginRoundSetupTime();

 * @brief Restarts the round, switching the map if necessary
 * @remarks Set the map to the current map to restart the round
 * @param map  the mapname it should go to after the round restarts
 * @return     1 always
native L4D_RestartScenarioFromVote(const String:map[]);

 * @brief Removes lobby reservation from a server
 * @remarks Sets the reservation cookie to 0,
 *           it is safe to call this even if it's unreserved.
native L4D_LobbyUnreserve();

 * @brief Checks if the server is currently reserved for a lobby
 * @remarks Server is automatically unreserved if it hibernates or
 *          if all players leave.
 * @deprecated This will always return false on L4D2 or on Linux.
 * @return     true if reserved, false if not reserved
native bool:L4D_LobbyIsReserved(); 
  • The maximum players reported by HLSW/server browser will change automatically without using sv_visiblemaxplayers (you can still use sv_visiblemaxplayers like normal to override it for whatever reason).
  • By default teams are still locked to 4 infected, 4 survivors, so other plugins are necessary to use the extra slots for something other than show.
  • l4d_maxplayers is locked to be less than +maxplayers set from command line, so if you can't go above 8, buy more slots from your GSP.
  • With l4d_maxplayers -1 and +maxplayers 8, no code in memory is patched (default behaviour). With +maxplayers x (and x is not 8 ) the default value for l4d_maxplayers is x.
  • By connecting from lobby (or console with sv_allow_lobby_connect_only 1), no more than 4 on coop/survival or 8 on versus will be able to connect without unreserving the lobby. Use a plugin such as Remove Lobby Reservation or Super Versus to remove the reservation.
  • Finale auto-spawns can now be disabled in conjunction with srsmod.

Current Developers:
  • XBetaAlpha - XBetaAlpha has come out of nowhere to blow the world of L4D2 extensions away. When L4D2 was but a demo, he already had +8 player slots working on Linux! His contribution was so inspirational that I decided to instantly port the extension to L4D2 for Windows. He is currently responsible for the large swath of the L4D2 player slot Linux support.

Development sources:
  • hg clone http://bitbucket.org/downtown1/left4downtown/
  • Want to stay on the bleeding edge? Feel free to look at our latest sources at the repository listed above. We try to commit changes that won't crash, but we can't guarantee they'll work! Don't forget to switch to the l4d2_port branch using 'hg up -C l4d2_port'

Thanks to:
  • pRED* for his TF2 tools code, I looked at it a lot . and for answering questions on IRC
  • Fyren for being so awesome and inspiring me from his sdktools patch to do custom |this| calls.
  • ivailosp for providing the Windows addresses that needed to be patched to get player slot unlocking to work.
  • dvander for making sourcemod and teaching me about the mod r/m bytes.
  • DDRKhat for letting me use his Linux server to test this
  • Frustian for being a champ and poking around random Linux sigs so I could the one native I actually needed.
  • XBetaAlpha for making this a team effort rather than one guy writing all the code.
  • Anyone else I missed, let me know?
  • 0.4.6
    • Finale auto-spawns can now be disabled with srsmod.
    • Added L4D_OnEnterGhostState forward.
  • 0.4.5
    • Added L4D_OnGetScriptValueInt forward.
  • 0.4.4
    • Fixed crashing due to detouring CDirector::GetTankLimit() instead of ZombieManager::SpawnTank
    • Fixed crashing in OnFirstSurvivorLeftArea forward if the survivor was NULL
  • 0.4.3
    • Fixed crashing bug due to accidentally detouring RestartScenarioFromVote
    • Included ClearTeamScores signature (so the forward would work)
  • 0.4.2
    • Added a new forward L4D_OnFirstSurvivorLeftSafeArea, blocking it can prevent a versus round from being force started.
    • Forgot to enable all the forwards in 0.4.1, now they will actually fire.
  • 0.4.1
    • Fixed RestartScenarioFromVote signature, after patch broke it.
    • Put all the old natives/forwards back in, but GetTeamScore, IsReserved, and GetCampaignScores is deprecated
    • L4D gamedata should now have ServerPlayerCounts
    • Forgot to include the .autoload file which meant the extension wouldn't load automatically without a plugin dependency (now included).
  • 0.4.0
    • Ported to L4D2 for Windows and Linux.
    • new natives: L4D_ScavengeBeginRoundSetupTime resets the setup timer in scavenge mode
    • deprecated natives/forwards: All forwards for L4D2 have been removed. All scoring natives have been removed from L4D2.
    • bugfix: on Windows the server browser now shows the correct maxplayers
  • 0.3.1
    • note: latest L4D patch removed SetNextMission which was used to obtain the Director pointer and it broke all natives using the Director (RestartScenarioFromVote, GetCampaignScores)
    • bugfix: use SelectModelByPopulation to get the Director instead
  • 0.3.0
    • new forwards: OnSpawnTank, OnSpawnWitch, OnClearTeamScores, OnSetCampaignScores
    • new natives: GetCampaignScores, LobbyUnreserve, LobbyIsReserved
  • 0.2.2
    • l4d_maxplayers is now restricted to <= +-maxplayers set from command line.
    • Fixed a bug where l4d_maxplayers -1 and sv_allow_lobby_connect_only 0 meant that nobody could connect to the server.
  • 0.2.0
    • Max players can be overridden now using l4d_maxplayers cvar.
    • Added left4downtown_version cvar.
  • 0.1.0
    • Initial release.

0.3.0 - 1138 (l4d), 229 (src)
0.3.1 - 9576 (l4d), 1948 (src)
0.4.0 - 148 (l4d2), 37 (l4d), 37 (src)
0.4.1 - 884 (l4d2), 182 (src)
0.4.2 - 136 (l4d2), 43 (src)
0.4.3 - 309 (l4d2), 94 (src)
0.4.4 - 1533 (l4d2), 284 (src)
0.4.5 - 585 (l4d2), 139 (src)

New Version here
Attached Files
File Type: zip left4downtown- (91.8 KB, 11497 views)
File Type: zip left4downtown- (134.9 KB, 13141 views)
File Type: zip left4downtown- (141.7 KB, 42210 views)

Last edited by psychonic; 07-26-2010 at 07:37.
Downtown1 is offline

Thread Tools
Display Modes

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 15:45.

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