As the survivors are by default almost useless if they are incapped, I wanted to publish this plugin to dispense that, and in addition to giving a somewhat simpler alternative, to manage to use all their weapons and give a possible solution for those who use Windows since bug spawn of weapons spawns on the map when the weapons are configured for your script in incapped mode ("WeaponType" "pistol").
Details
Survivors can switch all their weapons, but cannot use all(slot 4|5). Also you can filter weapons to use in "incapped_weapons_classnamelist.cfg"
// 0:Disable, 1:Allow weapons of slot 1, -1: Allow only switch weapons of slot1 // Default: "1" incapped_weapons_slot1 "1"
// 0:Disable, 1:Allow weapons of slot 2, -1: Allow only switch weapons of slot2 // - // Default: "1" incapped_weapons_slot2 "1"
// 0:Disable, 1:Allow weapons of slot 3, -1: Allow only switch weapons of slot3 // Default: "1" incapped_weapons_slot3 "1"
// 0:Disable, 1:Allow weapons of slot 4, -1: Allow only switch weapons of slot4 // Default: "1" incapped_weapons_slot4 "1"
// 0:Disable, 1:Allow weapons of slot 5, -1: Allow only switch weapons of slot5 // Default: "1" incapped_weapons_slot5 "1"
// 0:Disable, 1:Force switch to primary weapon, 2: Force switch to secondary weapon // Default: "1" incapped_weapons_switch "1"
// 0:Disable, 1:Prevent give pistol on incapped // - // Default: "0" incapped_weapons_blockgive "0"
Admin Commands:
PHP Code:
"sm_iw_reload" //reload config data weapons list(incapped_weapons_classnamelist.cfg)
Credits
Silvers: for let me using your forwards, and your code
BHaType: for your code to auto create data cfg
Changelog
Code:
2020-04-01 (v1.5)
*Added new option in cvars: "incapped_weapons_slotX"
*Fixed bugs not allow incapped weapons
*Fixed bugs on map transition
2020-03-06 (v1.4)
*Improved method to set weapons to incapacitated mode when you have a melee weapon
*Improved the method to force switch weapon when incapacitated
*Fixed the restoration of info weapons when changing maps
*Fixed crash when using the "map" command on Windows
(ty xsirlalo that helped me to test)
2020-02-11 (v1.3)
*Added new admin cmd for to reload data cfg
*Fixed bug weapon spawn on map transition
*Changed method to remove weapon pistol on incapped
2020-01-20 (v1.2)
* Fixed "RestoreSecondary" function
* Changed switch method to FakeClientCommand (ty MasterMind420 by suggestion)
2020-01-14 (v1.1)
* Remove unnecessary events for L4D1
* Replaced method "RemoveEntity" for "AcceptEntityInput" (for SM1.8+)
2020-01-11 (v1.0)
* Initial release.