Not your average hats...
- Mr.RuyC - For helping test the plugin on his server.
- Ja-Forces - Creating an "error" free L4D1 hats config + bug reports. (found here)
- bubbabyte - Testing 1.5 on their server and reporting several bugs.
- Don't Fear The Reaper - German translations.
- Ja-Forces - L4D1 data config found here: https://forums.alliedmods.net/showpo...7&postcount=57
- Hats covering a players eyes can block the players "use" function (opening doors etc). - Install: Use Priority Patch plugin to fix.
To edit models
- The position, angles and model name is saved to l4d_hats.cfg in your servers \addons\sourcemod\data\ folder.
- Each model has it's own section and each section is numbered from 1 to the current max of 128.
- Each section has 3 keys. "mod" which is required and the path to the model / hat.
- The 2 optional keys: "ang" and "pos" store the angle / position and can be set in-game with sm_hatang and sm_hatpos.
- You can customise the hat names with the "name" key as seen in the example below.
To edit hat positions
- You can view the model list and indexes by typing sm_hatlist.
- Use sm_hatadd to add a model to the config (must be the full model path as seen below).
- You can remove hats by typing sm_hatdel and part of the model name or the index number (1-64).
To edit hat sizes
- Choose your hat with the sm_hat command.
- Use the command sm_hatload to load on all players.
- Use the commands sm_hatpos and sm_hatang.
- These affect all players (which is why I recommend using sm_hatload)
- Once you're happy with the pos/ang use the command sm_hatsave.
- Choose your hat with the sm_hat command.
- Use the command sm_hatload to load on all players.
- Use the command sm_hatsize to set the size.
- This affects all players (which is why I recommend using sm_hatload)
- Once you're happy with the size use the command sm_hatsave.
- NOTE: Not all models can be resized.
Optional Translations for hat names:
"ang" "0.000000 0.000000 0.000000"
"loc" "2.000000 0.500000 0.500000"
"name" "Hand Gib"
- If you want to translate hat names into multiple languages, save the following as hatnames.phrases.txt in your servers \addons\sourcemod\translations folder.
- (Now included by default inside the plugins zip archive)
// All players
sm_hat // Displays a menu of hats allowing players to change what they are wearing.
sm_hatoff // Toggle to turn on or off the ability of wearing hats.
sm_hatshow // Toggle to see or hide your own hat.
sm_hatview // ^^
// Admins only (requires "z" flag):
sm_hatclient // Set a clients hat. Usage: sm_hatclient <#userid|name> [hat name or hat index: 0-128 (MAX_HATS)].
sm_hatc // Displays a menu listing players, select one to change their hat.
sm_hatoffc // Toggle the ability of wearing hats on specific players.
sm_hatrandom // Randomizes all players hats.
sm_hatrand // ^^
// Add and remove hat models with these commands.
sm_hatadd // Adds specified model to the config (must be the full model path).
sm_hatdel // Removes a model from the config (either by index or partial name matching).
sm_hatlist // Displays a list of all the hat models and indexs (for use with sm_hatdel).
// These commands are useful for editing the hat appearances.
sm_hatsave // Saves the hat origin and angles to the data config.
sm_hatload // Changes all players hats to the one you have.
sm_hatpos // Displays a menu allowing you to adjust the hat position (affects all hats/players).
sm_hatang // Displays a menu allowing you to adjust the hat angles (affects all hats/players).
sm_hatsize // Shows a menu allowing you to adjust the hat size (affects all hats/players).
Saved to l4d_hats.cfg
in your servers \cfg\sourcemod\
// 0=Plugin off, 1=Plugin on.
// Turn on the plugin in these game modes, separate by commas (no spaces). (Empty = all).
// Turn off the plugin in these game modes, separate by commas (no spaces). (Empty = none).
// Turn on the plugin in these game modes. 0=All, 1=Coop, 2=Survival, 4=Versus, 8=Scavenge. Add numbers together.
// 0=Disallow bots from spawning with Hats. 1=Allow bots to spawn with hats.
// Specify admin flags or blank to allow all players to spawn with a hat, requires the l4d_hats_random cvar to spawn.
// Specify admin flags or blank to allow all players access to the hats menu.
// 0.0=Off. How often to detect thirdperson view. Also uses ThirdPersonShoulder_Detect plugin if available.
// How transparent or solid should the hats appear. 0=Translucent, 255=Opaque.
// Prevent pre-caching models on these maps, separate by commas (no spaces). Enabling plugin on these maps will crash the server.
// Attach a random hat when survivors spawn. 0=Never. 1=On round start. 2=Only first spawn (keeps the same hat next round).
// 0=Off, 1=Save the players selected hats and attach when they spawn or rejoin the server.
// When a player is in third person view, display their hat. Hide when in first person view.
// Hats plugin version.
- Plugin now deletes the client cookie and hat if they no longer have access to use hats. Requested by "Darkwob".
- Removed cvar "l4d_hats_view" - recommended to use "ThirdPersonShoulder_Detect" plugin to turn on/off the hat view when in 3rd/1st person view.
- Fixed giving random hats to players when the "l4d_hats_random" cvar was set to "0". Thanks to "XYZC" for reporting.
- Fixed giving random hats on round_start when "l4d_hats_save" cvar was set to "1".
- Fixed "sm_hatrand" and "sm_hatrandom" from not giving random hats. Not sure when this broke.
- Added a warning message to suggest installing the "Attachments API" and "Use Priority Patch" plugins if missing.
- Added Simplified Chinese (chi) and Traditional Chinese (zho) translations. Thanks to "pan0s" for providing.
- Fixed not giving random hats to clients who have no saved hats. Thanks to "pan0s" for reporting.
- Fixed client not in-game errors. Thanks to "HarryPotter" for reporting.
- Added cvar "l4d_hats_bots" to allow or disallow bots from spawning with hats.
- Added cvar "l4d_hats_make" to allow players with specific flags only to auto spawn with hats.
- Added cvar "l4d_hats_wall" to prevent hats glowing through walls. Thanks to "Marttt" for the method and "Dragokas" for requesting.
- Fixed personal hats not showing when changing hat in external view.
- Fixed invalid client errors due to the last update. Thanks to "ur5efj" for reporting.
- Now blocks showing hats when spectating someone in first person view. Thanks to "Alex101192" for reporting.
- Fixed hats not hiding after being revived. Thanks to "Alex101192" for reporting.
- Changed "l4d_hats_precache" cvar default value to blank.
- Changed the way "l4d_hats_detect" works. Now also detects if reviving someone (events were unreliable and causing bugs).
- Fixed 1st and 3rd person view of hats wrongfully toggling under certain conditions. Thanks to "Alex101192" for reporting.
- Fixed some spelling mistakes in the "data/l4d_hats.cfg" hat names.
- Added Russian and Ukrainian translations - Thanks to "Dragokas" for providing.
- Fixed changing hats when "l4d_hats_save" and "l4d_hats_random" were set. Random is superseded by saved if present.
- Fixed command "sm_hatclient" throwing an error when only a client was specified.
- Fixed hat view "ThirdPersonShoulder_Detect" and "Survivor Thirdperson" plugins clashing.
- Extra checks to prevent "IsAllowedGameMode" throwing errors.
- Fixed not always loading client cookies before creating hats. Thanks to "Alex101192" for reporting.
- Fixed potentially not translating some strings.
- Fixed some functions not working for more than 100 hats.
- Fixed hats affecting Survivor Thirdperson view under certain conditions.
- Various changes to tidy up code.
- Various optimizations and fixes.
- Added cvar "l4d_hats_detect" to enable clients to see their own hat when 3rd person view is detected.
- Optionally uses "ThirdPersonShoulder_Detect" plugin by "Lux" and "MasterMind420", if available.
- Added bunch of maps to the default value of "l4d_hats_precache". Thanks to "Alex101192" for providing.
- Increased "l4d_hats_precache" cvar length, max usable length 490 (due to game limitations).
- Fixed "IsAllowedGameMode" from throwing errors when the "_tog" cvar was changed before MapStart.
- Removed "colors.inc" dependency.
- Updated these translation file encodings to UTF-8 (to display all characters correctly): German (de).
- Added command "sm_hatclient" to set a clients hat, requested by "foxhound27".
- Added commands "sm_hatshowon" and "sm_hatshowoff" to turn on/off personal hat visibility.
- Fixed cvar "l4d_hats_precache" from modifying the allow cvar. Now correctly disables on blocked maps.
- Added cvar "l4d_hats_precache" to prevent pre-caching models on specified maps.
- Fixed ghosts from having hats.
- Fixed "m_TimeForceExternalView not found" error for L4D1 - Thanks to "Ja-Forces" for reporting.
- Converted plugin source to the latest syntax utilizing methodmaps. Requires SourceMod 1.8 or newer.
- Changed cvar "l4d_hats_modes_tog" now supports L4D1.
- Added "Reset" option to the ang/pos/size menus, requested by "ZBzibing".
- Fixed depreciated FCVAR_PLUGIN and GetClientAuthString.
- Increased MAX_HATS value and added many extra L4D2 hats thanks to "Munch".
- Fixed the plugin not working in L4D1 due to a SetEntPropFloat property not found error.
- Fixed hats blocking players +USE by adding a single line of code - Thanks to "Machine".
- Fixed cvar "l4d_hats_random" from not working properly - Thanks to "Don't Fear The Reaper" for reporting.
- Added German translations - Thanks to "Don't Fear The Reaper".
- Small fixes.
- Fixed multiple hat changes only showing the first hat to players.
- Changing hats will no longer return the player to firstperson if thirdperson was already on.
- Fixed command "sm_hatc" making the client thirdpeson and not the target.
- Added cvar "l4d_hats_change" to put the player into thirdperson view when they select a hat, requested by "disawar1".
- Fixed a bug when printing to chat after changing someones hat.
- Fixed cvar "l4d_hats_menu" not allowing access if it was empty.
- Fixed the allow cvars not affecting everything.
- Added translations, required for the commands and menu title.
- Added optional translations for the hat names as requested by disawar1.
- Added cvar "l4d_hats_allow" to turn on/off the plugin.
- Added cvar "l4d_hats_modes" to control which game modes the plugin works in.
- Added cvar "l4d_hats_modes_off" same as above.
- Added cvar "l4d_hats_modes_tog" same as above, but only works for L4D2.
- Added cvar "l4d_hats_save" to save a players hat for next time they spawn or connect.
- Added command "sm_hatsize" to change the scale/size of hats as suggested by worminater.
- Fixed "l4d_hats_menu" flags not setting correctly.
- Optimized the plugin by hooking cvar changes.
- Selecting a hat from the menu no longer returns to the first page.
- Added "name" key to the config for reading hat names.
- Changed the way models are checked to exist and precached.
- Added new hat models to the config. Deleted and repositioned models blocking the "use" function.
- Changed the hat entity from prop_dynamic to prop_dynamic_override (allows physics models to be attached).
- Fixed command "sm_hatadd" causing crashes due to models not being pre-cached, cannot cache during a round, causes crash.
- Fixed pre-caching models which are missing (logs an error telling you an incorrect model is specified).
- Added cvar "l4d_hats_opaque" to set hat transparency.
- Changed cvar "l4d_hats_random" to create a random hat when survivors spawn. 0=Never. 1=On round start. 2=Only first spawn (keeps the same hat next round).
- Fixed hats changing when returning from idle.
- Replaced underscores (_) with spaces in the menu.
- Fixed hooking L4D2 events in L4D1.
- Fixed command "sm_hatc" not displaying for admins when they are dead/infected team.
- Minor bug fixes.
- Fixed command "sm_hatc" displaying invalid player.
- Fixed the fix of command "sm_hat" flags not applying.
- Fixed command "sm_hat" flags not applying.
- Added command "sm_hatoffc" for admins to disable hats on specific clients.
- Added cvar "l4d_hats_third" to control the previous update's addition.
- Added events to show / hide the hat when in third / first person view.
- Added cvar "l4d_hats_view" to toggle if a players hat is visible by default when they join.
- Resets variables for clients when they connect.
- Added command "sm_hatoff" - Toggle to turn on or off the ability of wearing hats.
- Added command "sm_hatadd" - To add models into the config.
- Added command "sm_hatdel" - To remove a model from the config.
- Added command "sm_hatlist" - To display a list of all models (for use with sm_hatdel)
- Initial release.
- Put this plugins .sp file into your \addons\sourcemod\scripting\ folder.
- Compile the plugin.
Updating from 1.35 or older:
- Download the .zip and extract the files to their respective folders in your servers \addons\sourcemod\ folder.
- Install the Use Priority Patch plugin to prevent blocking +USE.
- Optionally install: ThirdPersonShoulder_Detect to enable viewing Hats when thirdperson view is detected.
- New cvars have been added: use the Cvar Configs Updater, or delete the old cvars config or manually add them.
: English (en), German (de), Russian (ru), Ukrainian (ua), Simplified Chinese (chi) and Traditional Chinese (zho).