Raised This Month: $7 Target: $400
 1% 

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


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Downtown1
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
v0.4.6

Description:
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

Installation:
Download the left4downtown-0.4.6.0-l4d2.zip located at the bottom of the post and extract it into /left4dead2/addons/sourcemod/

Usage:
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!
ConVars:
Code:
* 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
Forwards:
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); 
Natives:
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(); 
Notes:
  • 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?
Changelog:
  • 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.


Views:
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-0.3.1.0-l4d.zip (134.9 KB, 16461 views)
File Type: zip left4downtown-0.4.6.0-l4d2.zip (141.7 KB, 53640 views)
File Type: zip left4downtown-0.4.6.0-src.zip (91.8 KB, 15189 views)

Last edited by psychonic; 07-26-2010 at 07:37.
Downtown1 is offline
CrimsonGT
Veteran Member
Join Date: Oct 2007
Location: Gainesville, FL
Old 04-27-2009 , 11:16   Re: [EXTENSION] Left 4 Downtown (0.1.0)
Reply With Quote #2

Looks good, nice to see a start of an extension for L4D. Any thoughts on continually updating it to have hooks/natives needed in SM?
__________________
CrimsonGT is offline
Downtown1
Veteran Member
Join Date: Mar 2004
Old 04-27-2009 , 12:35   Re: [EXTENSION] Left 4 Downtown (0.1.0)
Reply With Quote #3

I'll be winging the design process since this is my first ever SM extension, so just let me know what you folks want and I'll try to add it. If you provide the sigscans too, then I'll add it that much faster.

Though it will have to wait for the next 2 weeks till my finals are over.
Downtown1 is offline
coach
SourceMod Donor
Join Date: Jun 2008
Old 04-27-2009 , 18:13   Re: [EXTENSION] Left 4 Downtown (0.1.0)
Reply With Quote #4

Will this work with the 1.3 snapshots?
coach is offline
Downtown1
Veteran Member
Join Date: Mar 2004
Old 04-27-2009 , 19:07   Re: [EXTENSION] Left 4 Downtown (0.1.0)
Reply With Quote #5

I wish I could tell you, but I developed this against the sourcemod-1.2 stable branch so I don't know.
Downtown1 is offline
cloudrus
New Member
Join Date: Apr 2009
Old 04-27-2009 , 22:47   Re: [EXTENSION] Left 4 Downtown (0.1.0)
Reply With Quote #6

im getting this

[SM] Plugin L4D_CAL_Ready_Up.smx failed to load: Required extension "Left 4 Downtown" file("left4downtown.ext") not running.
cloudrus is offline
CrimsonGT
Veteran Member
Join Date: Oct 2007
Location: Gainesville, FL
Old 04-27-2009 , 23:08   Re: [EXTENSION] Left 4 Downtown (0.1.0)
Reply With Quote #7

Make sure the extensions running (and make sure you installed it...) by typing sm exts list.
__________________
CrimsonGT is offline
cloudrus
New Member
Join Date: Apr 2009
Old 04-28-2009 , 00:05   Re: [EXTENSION] Left 4 Downtown (0.1.0)
Reply With Quote #8

thanks

Last edited by cloudrus; 04-28-2009 at 00:13.
cloudrus is offline
madcap
Senior Member
Join Date: Feb 2009
Old 04-28-2009 , 09:39   Re: [EXTENSION] Left 4 Downtown (0.1.0)
Reply With Quote #9

Can you be more specific about what this function does?

L4D_RestartScenarioFromVote(const String:map[]);
madcap is offline
Downtown1
Veteran Member
Join Date: Mar 2004
Old 04-28-2009 , 10:38   Re: [EXTENSION] Left 4 Downtown (0.1.0)
Reply With Quote #10

Quote:
Originally Posted by madcap View Post
Can you be more specific about what this function does?

L4D_RestartScenarioFromVote(const String:map[]);
Does the same thing as the successful result of a "callvote restartgame" as far as I know. I have only tried it with argument 'map' having the same value as GetCurrentMap(). In that case it just restarts the round.
Downtown1 is offline
Reply


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 02:56.


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