View Single Post
Author Message
n3wton
Senior Member
Join Date: Mar 2010
Old 04-25-2010 , 10:34   [L4D2] Melee In The Safe Room (with unlock all melee weapons on every campaign)
Reply With Quote #1

Melee In The Saferoom


This simply spawns a number of melee weapons at the start of each round in the safe-room. I wrote this plugin just after 'The Passing' release as during this update valve thought it would be a good idea to have between 2 - 4 melee weapons in the safe-room, meaning sometime people had to use pistols...

How it works is it waits for a round to begin, then take the first active client from the survivors team and spawns X amount of melee weapons around this point.

How To Install

If you don't want all the melee weapons unlocked, simply copy the [L4D2] MeleeInTheSafeRoom.smx to your servers sourcemod/plugins folder.

If you want all melee weapons to be unlocked, download any one of the
- Melee In The Safe Room Version 2-*-*.zip

then extract all the files to there relevant folders on your server.



How I Unlocked All Melee Weapons

Basically, there is a melee_weapon_unlock.vpk that contains all the mission.txt files (1,2,3,4,5 & 6) that have a line in which list the melee weapons that are aloud on that campaign. I added all melee weapons that weren't in the list, but with a modded script. so for example if the fireaxe isn't available on a campaign then i have added fireaxe_mod, making l4d2 spawn a fireaxe_mod melee weapon. To make these "mod" melee weapons work, I edited the melee_manifest.txt and added all of the modded script locations. Then because valve have changed how vpk's load, I added all the modded scripts to the left4dead2/scripts/melee directory. Now when a client connects to the server, the modded scripts are downloaded to each client. There are 12 scripts at around 4kb each, so it will take 5 - 10 seconds for them to download, but once the client has the scripts they will never need download them again (unless they delete them).


l4d2_MITSR_Random
Spawn Random Weapons (1) or custom list (0)
Default: "1"

l4d2_MITSR_Amount
Number of weapons to spawn if l4d2_MITSR_Random is 1
Default: "4"

l4d2_MITSR_BaseballBat

Number of baseball bats to spawn (l4d2_MITSR_Random must be 0)
Default: "1"

*Note: Cvars for every class of melee weapon exist, but adding another 11 sections to this page seems silly. Look in [L4D2] MeleeInTheSaferoom.cfg for the full list.



Code:
- 1.0.0
 Initial Release

 - 1.0.1
 Small bug fix (increased timer from round start)

 - 1.0.2
 Fixed Bug with weapons spawning in wrong place
 Wrote better code for positioning and rotating melee weapons

- 1.0.3
A Quick Beta version used to check a hunter claws bug had been fixed.

- 1.0.4 
Added extra checking for spawn amounts.
Made sure knifes worked for edited servers.

- 1.0.5
Changed hunter claws check to check all cases (lower and higher caps)
added !mitserror command to output all weapon models spawned to help with debugging.

- 1.1.0
Changed how the weapons spawn, hopfully fixing the hunter claws once and for all (Thanks DJ_WEST)
Fixed some typos
Removed !mitserror
NOTE: Please delete the old [L4D2]MeleeSafeRoom.cfg before using this plugin.
NOTE: This version is broken, reuploaded 1.0.5

- 1.1.1
Right hopefully, hunter claws are 100% gone, now it finds out what weapons are aloud on that map, then picks from them.

- 1.2.0
Been a while since an update, and this isn't anything big, basically I've added an extra cvar for versus mode, if enabled both teams get the same melee weapons when set to random, to make it fair.

- 1.2.5
After many internal versions, trying to fix the glitches with unlocked melee weapons, I finally have one, which I believe works in all game modes. Basically, put the unlock_melee_weapons.vpk in your servers addon folder and this then downloads the individual files from the server to you clients on map start, because there all .txt files there all around 1 - 2kb each so they download instantly, enabling all melee weapons with no glitches and with audio.

- 1.2.6
added tonfa to the cfg list of files.
more sure sv_allowdownload is on.

- 2.0.0
 Complete rewrite, from a blank document.
 Fixed all errors (hopefully, tested for on all campaigns with two people with no errors)
 Made all Melee weapons work with out any glitches (read how to setup for more information)
 Now supports custom melee lists, e.g. spawn 4 knives, 1 golf club and 3 katans.
Cleaner faster code.

- 2.0.1
Quick (failing) test

- 2.0.2
Now spawns the default weapons, except for knives. Where it  spawns a huntingknife.

- 2.0.3
Added riot_shield to make sure people can get riot shields to spawn properly.
added !melee (admin command) to list all spawnable melee weapons on current campaign

- 2.0.4
Fixed a potential error where on campaign mode, melee weapons wouldn't spawn on any but the first map.

- 2.0.5
Add support for the sacrifice an no mercy.
Fixed a bug where hunter arms could be spawned.

- 2.0.6
MasterMind420 posted a release which use MITSR 2.0.5 but with some new .vpk's to unlock weapons.
Repackaged .zip file and updated code to correct version

- 2.0.7
Made my own vpk with only standard melee weapons unlocked (no knife or riot shield).
Precached all standard melee weapons.
(it looks like without having something client side, knife and riot just won't work)
Yours
N3wton
Attached Files
File Type: zip Melee In The Safe Room Version 2-0-5.zip (18.6 KB, 5866 views)
File Type: zip Melee In The Safe Room 2-0-7.zip (19.8 KB, 10867 views)
File Type: sp Get Plugin or Get Source ([L4D2] MeleeInTheSafeRoom.sp - 10465 views - 11.3 KB)

Last edited by n3wton; 06-19-2011 at 06:24. Reason: Adde Plugin Description.
n3wton is offline