Raised This Month: $ Target: $400
 0% 

[CS:GO/L4D1/L4D2] Weapon Charms (1.19) [24-Nov-2023]


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Plugin ID:
7181
Plugin Version:
1.19
Plugin Category:
Fun Stuff
Plugin Game:
Any
Plugin Dependencies:
Servers with this Plugin:
2 
Plugin Description:
Weapon and item charm attachments.
Old 07-01-2020 , 02:06   [CS:GO/L4D1/L4D2] Weapon Charms (1.19) [24-Nov-2023]
Reply With Quote #1



(L4D2: all charms on the Pistol)


(CS:GO: various charm examples. Models created by Silvers.)




Thanks:
  • "Phoenix" and "Napas" for the original plugin idea, pin attachment and wiggle bone.
  • "ESKO" for inspiring me to start the project.
  • "CZE|EMINEM" for showing me how to model custom Charms.
  • "Lux" for testing and various help as always.
  • "xZk" for testing in L4D2.



Features:

All Games:
  • Translations support.
  • Database support saving players selected charm for all weapons.
  • Menu to select charm for current weapon and all other weapons.
  • Menus for admins to position and change angles of charms.
  • Menus only show available charms for the weapon.
  • Supports unloading and late loading the plugin.
  • Bots can use randomly selected charms.

CS:GO:
  • Custom charm models positioned for all Weapons, Molotov, C4 and Tablet.
  • Third person charm attachment view. (But no support for users changing to 3rd person).

L4D1 & L4D2:
  • All charms positioned for the Pistol.
  • 6 charms positioned to all weapons. Some have more.
  • Third person charm attachment view.
  • Automatically shows/hides the 1st and 3rd person charm when changing view.



Known Issues:

All Games:
  • Uses fake viewmodels because I cannot figure how to attach/bonemerge that follows the viewmodel_fov cvar to sit in the correct position.
  • If any charm models are missing this might cause an indexing error, so if you change the pos/ang/size and save it might affect the wrong one. Haven't fully tested. Please report if you tested.
  • Sometimes (rarely) the wrong weapon is shown when equipping a new weapon, cannot figure out how to fix.
  • Edit menus XYZ text not accurate for every model/view.

CS:GO:
  • Plugin copies and renames viewmodels, sending ~33 models (1 MB) to clients.
  • Uses fake arms/weapon. When a Charm is active the following issues occur:
  • Arms maybe incorrect for the players model (work in progress). All 3rd party maps seem to be affected.
  • Gloves are stock (not sure how to fix).
  • Weapon missing StatTrack and Stickers.
  • Weapon FOV changes to 90 and does not follow the viewmodel_fov cvar.
  • Left handed weapons are not compatible using the cl_righthand 1 cvar.
  • Weapon Viewmodel may show invisible section due to FOV.
  • Most stock game models cannot be resized, third party models would have to add support if required.

L4D1 & L4D2:
  • Uses fake arms/weapon. When a Charm is active the following issues occur:
  • Weapon FOV changes to 90 and does not follow the cl_viewmodelfovsurvivor cvar.
  • Weapon Viewmodel may show invisible section due to FOV.
  • Laser sight beam is not visible in first person view.
  • Blood splatter screen effect is not visible with an active charm.
  • Clashes with plugins that hide the viewmodel (maybe can support, report here about affected plugins).
  • L4D1 cannot resize models and only 1 charm model example is provided, add more yourself and please share.
  • Charms are removed while incapped to save excess code in fixing bugs.



Adding charms to weapons and custom charm models:

CS:GO:
  • Create a unique index in data/charms.data.csgo.cfg with the charm name and model path.
  • Copy the weapon classnames and their data from the Mustachio example provided. This already has a charm position setup for all weapons.
  • Adding support for more weapon classnames can be done via data/charms.weapons.csgo.cfg. This file has some more details.
  • Weapons missing attachment points cannot work. Download CS:GO - SDK (premium users only I think) from steam and use Model Viewer to open models and view their attachment point names.
  • Add your new weapon classname entry in data/charms.data.csgo.cfg for the new charm you're supporting, follow the details above about copying the positions.
  • Info about the keys:
- "attach_1": First person attachment point (usually name "1" or "2" for most models). When shooting sometimes the charm freezes, use "2" or other attachment point.
- "attach_2": Third person view attachment point. Since detecting current view in CS:GO doesn't work, you might want to comment out the "Hook_SetTransmitWorld" section and recompile the plugin to test positions.
- "default": Signals this charm will be default for the weapon classname when clients have no saved preferences.
- "vpos_1" and "vang_1" etc: Use sm_charm_edit [1 or 2] command to modify charm position and angles for 1st or 3rd person view.
- "bonemerge": Specifying a bone name which exists on both the weapon viewmodel and charm will use bonemerge attachment without having to manually position and use attachment points.

L4D1 & L4D2:
  • The above information is relevant for these games, except instead of custom charm models we use stock game models.
  • This is because L4D1 and L4D2 has issues with the downloads table sending files to clients and something I do not support.




Natives: (for developers)
Spoiler





Public Commands:
PHP Code:
sm_charm    // Shows the Charms menu. Alternative usage: sm_charm [charm index] or 0 to remove.
sm_charms   // Shows the Charms weapon menu. 



Admin Commands:
  • Requires "z" - ADMFLAG_ROOT flag
PHP Code:
sm_charm_reload   // Reload the Charms config.
sm_charm_edit     // Usage: sm_charm_edit <type>. 1=First person. 2=Third person. Enables editing pos/ang/size.
sm_charm_ang      // Shows a menu allowing you to adjust the charm angles.
sm_charm_pos      // Shows a menu allowing you to adjust the charm position.
sm_charm_size     // Shows a menu allowing you to adjust the charm size.
sm_charm_save     // Saves the data config. Suggest saving after editing each charm, either via menu or command. 



ConVars:
  • Saved to charms.cfg in your servers \cfg\sourcemod\ folder.
PHP Code:
// 0=Plugin off. 1=Plugin on.
charms_allow "1"

// 0=Plugin off, 1=Plugin on.
charms_bots "1"

// 0=None. 1=Give default charms to new players (search for default in the charms.data config).
charms_default "1"

// L4D/2 only: 0.0=Off. How often to check if a players in first or third person view to show/hide the correct Charm.
charms_check "0.2"

// Weapon Charms plugin version.
charms_version 



Changes:
Code:
1.19 (24-Nov-2023)
    - L4D2: Fixed the weapon being hidden after staggering when the stagger timer didn't reset (due to some plugins such as "Stagger Gravity").

1.18 (05-Sep-2023)
    - No longer shows the charm of the player you're spectating.

1.17 (16-Jul-2022)
    - L4D1 & L4D2: Fixed charms appearing after using a minigun when the plugin has been turned off.

1.16 (04-Dec-2021)
    - Changes to fix warnings when compiling on SourceMod 1.11.

1.15 (01-Jul-2021)
    - L4D2: Added a warning message to suggest installing the "Use Priority Patch" plugin if missing.

1.14b (15-May-2021)
    - L4D2: Fixed the Rifle weapon positions in 3rd person view.
    - Config file "charms.data.l4d2.cfg" has been updated.

    - Fixed bad translations data. Thanks to "weffer" for reporting.
    - Translation file "translations/es/charms.phrases.txt" has been updated.

1.14a (20-Apr-2021)
    - Added Spanish translations. Thanks to "AlexAlcala" for providing.

1.14 (12-Apr-2021)
    - L4D/L4D2: Fixed not restoring the charm after being revived.

1.13 (04-Mar-2021)
    - Added an extra check in case the database had not connected. Thanks to "Marttt" for reporting.
    - Added Portuguese translations. Thanks to "hoyxen" for providing.

1.12 (15-Feb-2021)
    - Fixed "Array index out-of-bounds" error. Thanks to "Alex101192" for reporting and "Marttt" for fixing.
    - Added Russian translations. Thanks to "Kleiner" for providing.

1.11 (05-Oct-2020)
    - Added cvar "charms_default" to give default charms to new players or none at all.

1.10 (01-Oct-2020)
    - Added support for following weapons "m_nSkin" value. Fixes L4D2 new weapon skins.
    - Added an "IsClientInGame" check to "TimerSpawn" due to rare case of logging an error.
    - L4D2: Added charms to CSS weapons since their viewmodel is now better from The Last Stand update.
    - L4D2: Changed "charms_precache" cvar default value to blank.
    - L4D2: Fixed various weapon positions supporting The Last Stand update changes.
    - L4D2: Fixed displaying the wrong arms model for L4D2 characters on L4D1 maps.
    - L4D/2: Fixed reloading or turning plugin off/on from making the weapon and arms invisible.
    - L4D/2: Fixed not hiding the charm when reviving someone.

1.9 (25-Jul-2020)
    - Any: "Attachments_API" version 1.5 fixes wrong or broken weapon models being shown.
    - Added some code to attempt fixing charms blocking +USE action. Thanks to Lux for providing.
    - Fixed not saving clients selected charms when "charms_bots" cvar was disabled.
    - L4D2: Fixed the "F-18" and "Missile" charms causing lag stutter on first usage.
    - L4D2: Fixed the "prop_minigun_l4d1" minigun from not removing charms when used.
    - L4D2: Fixed thirdperson weapon showing when using a minigun. Thanks to "Alex101192" for reporting.

1.8 (20-Jul-2020)
    - Added cvar "charms_timeout" to prevent equipping a new charm for X seconds.
    - L4D2: Jockey riding someone now deletes the charm and restores on ride end.
    - L4D2: Ladder fix from "Attachments_API" version 1.4 update.

1.7 (15-Jul-2020)
    - Added 4 natives for other plugins (support for L4D/2 "Extinguisher" plugin to create/remove charms).
    - Optimized bots using charms, no longer creating viewmodels or fake arms.
    - CSGO: Removed the charm when aiming down iron sights (Aug).
    - CSGO: Better replicating the players arms based on their current model.
    - CSGO: Blocked some silenced/modified weapons from using charms.

1.6 (11-Jul-2020)
    - Changed command "sm_charm" to allow using an optional arg to select the charm index.
    - Fixed L4D1 crash due to using the wrong dual pistol model.
    - Fixed L4D1 errors about event missing. Now hooks OnUse to hide charms when mounting a minigun.
    - Removes the charm when zooming down a scope. Thanks to "Alex101192" for reporting.
    - CSGO: The charm won't re-attach when shooting during scoped view, only when manually unscoping.
    - CSGO: Updated the C4 charm position in the "charms.data.csgo.cfg" config.
    - CSGO: Blocked plugin from running when "Sm_Skinchooser" plugin is detected.

1.5 (09-Jul-2020)
    - L4D2: Fixed showing a duplicate weapon when using "thirdpersonshoulder". Thanks to "Alex101192" for reporting.

1.4 (06-Jul-2020)
    - Added cvar "charms_precache" to prevent the plugin working and PreCaching models on certain maps.
    - Added a 1 frame delay in creating a charm to hopefully fix weapons or charms getting stuck or invisible.

1.3 (05-Jul-2020)
    - Fixed minor memory leak from bots, forgot to delete a handle I tried to remember.

1.2 (04-Jul-2020)
    - Added support for bots using random charms.
    - Added cvar "charms_bots" to control if bots can use charms.
    - Fixed L4D1 and L4D2 not removing charms when pinned.
    - Plugin "Attachments_API" updated and required.

1.1 (02-Jul-2020)
    - Fixed database creation error. Thanks to "NanoC" for reporting.
    - Fixed default charm settings in "charms.data.csgo.cfg" config.
    - Fixed batch exporting the project to .zip archive duplicating the .sp source code.

1.0 (01-Jul-2020)
    - Initial release.



Incompatible:
  1. L4D1 game bug: this plugin is incompatible with the Glare plugin, beam_spotlight turning on/off breaks the position. Tried to fix, not wasting more hours.
  2. CSGO various bugs: this plugin is incompatible with the Sm_Skinchooser plugin, too many different issues to fix, only fix would be real charms attachment.



Updating from 1.10 or older:
  • New cvars have been added: use the Cvar Configs Updater, or delete the old cvars config or manually add them.



Requirements:
  1. All games: Attachment_API plugin.
  2. L4D/2 only: ThirdPersonShoulder_Detect plugin.
  3. L4D/2 only: Use Priority Patch plugin.



Installation:

All games:
  1. Download the charms.zip and extract the files to their respective folders in your servers \addons\sourcemod\ folder.
  2. Setup a "charms" database entry in your servers \addons\sourcemod\configs\databases.cfg file.
    (you can duplicate "clientprefs" section changing the name to "charms" since SQLite is supported, or duplicate and rename an existing external database entry since MySQL is supported too).
  3. For those using MySQL and not clientprefs you have to login to phpMyAdmin or whatever you use to maintain your database and create a new database entry named "charms".

CS:GO:
  • For custom Charm models download the charms_models.zip and extract the \materials\ and \models\ folders to your servers main game folder.
  • You can find more custom Charm models for CS:GO on GameBanana thanks to "CZE|EMINEM" and "CrazySkull2k" for creating.
  • Use SM File/Folder Downloader and Precacher to serve custom charm models to clients (file paths can be found in the .txt file in the archives).

FastDL:
  • If using FastDL copy the \csgo\models\weapons\silvershot\ folder to your FTP. The folder and files in \viewmodels\ are generated on map start, the \charms\ are those you install. All must be copied to your FastDL server to prevent error boxes.
Current Translations: English (en), Portuguese (pt), Russian (ru).
Attached Files
File Type: zip charms_models.zip (6.82 MB, 1851 views)
File Type: zip charms.zip (75.1 KB, 240 views)
__________________

Last edited by Silvers; 11-24-2023 at 18:45.
Silvers is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 07-01-2020 , 02:23   Re: [CS:GO/L4D1/L4D2] Weapon Charms (1.0) [01-Jul-2020]
Reply With Quote #2

Reserved.

I will be updating the models at some point polishing the Shades for example which appears too small. - (Valve time, some year when I'm able to).

There are probably other issues unknown to me at this time. Please report any problems and I'll see what I can do.
__________________

Last edited by Silvers; 09-21-2021 at 10:05.
Silvers is offline
Alex101192
Senior Member
Join Date: Aug 2018
Old 07-01-2020 , 05:57   Re: [CS:GO/L4D1/L4D2] Weapon Charms (1.0) [01-Jul-2020]
Reply With Quote #3

Wow nice plugin silver. I will test it soon.
Alex101192 is offline
CrazySkull2k
Member
Join Date: Feb 2017
Old 07-01-2020 , 10:18   Re: [CS:GO/L4D1/L4D2] Weapon Charms (1.0) [01-Jul-2020]
Reply With Quote #4

Awsome release! I've been working with Eminem for the past days, and we are currently working on Apex Legends, Rainbow Six & Half Life Alyx Charms

Last edited by CrazySkull2k; 07-01-2020 at 10:59.
CrazySkull2k is offline
Steve Merson
Junior Member
Join Date: Sep 2013
Location: Schweiz
Old 07-01-2020 , 16:39   Re: [CS:GO/L4D1/L4D2] Weapon Charms (1.0) [01-Jul-2020]
Reply With Quote #5

Very awesome! I have waited for this Plugin very long time.

Thanks for sharing this with the Community. <3
Steve Merson is offline
The Killer NL
AlliedModders Donor
Join Date: Aug 2018
Location: The Netherlands
Old 07-01-2020 , 16:41   Re: [CS:GO/L4D1/L4D2] Weapon Charms (1.0) [01-Jul-2020]
Reply With Quote #6

Would be lovely if it had store support tho

But great plugin bro!
__________________

The Killer NL is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 07-01-2020 , 17:22   Re: [CS:GO/L4D1/L4D2] Weapon Charms (1.0) [01-Jul-2020]
Reply With Quote #7

Hi, sorry for asking but does it also have support for L4D2 melee weapons? I haven't found any info about it the main thread. I'm asking that because melee behavior is very specific in most cases.
__________________
Marttt is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 07-01-2020 , 17:42   Re: [CS:GO/L4D1/L4D2] Weapon Charms (1.0) [01-Jul-2020]
Reply With Quote #8

Quote:
Originally Posted by CrazySkull2k View Post
Awsome release! I've been working with Eminem for the past days, and we are currently working on Apex Legends, Rainbow Six & Half Life Alyx Charms



Quote:
Originally Posted by The Killer NL View Post
Would be lovely if it had store support tho

But great plugin bro!
I haven't used any store plugins and don't know what's needed. Not really something I want to do.


Quote:
Originally Posted by Marttt View Post
Hi, sorry for asking but does it also have support for L4D2 melee weapons? I haven't found any info about it the main thread. I'm asking that because melee behavior is very specific in most cases.
With some modification it might work, but some melee weapons are missing attachments and not something I'll support. Same issue with CS:GO knives they're all missing attachment points so cannot work.
__________________
Silvers is offline
NanoC
Veteran Member
Join Date: Jan 2016
Location: Argentina
Old 07-01-2020 , 18:25   Re: [CS:GO/L4D1/L4D2] Weapon Charms (1.0) [01-Jul-2020]
Reply With Quote #9

Amazing! for you!
I'll test it and come back later to give you more feedback
__________________
NanoC is offline
Send a message via Skype™ to NanoC
Zeddy_god
Senior Member
Join Date: May 2015
Location: Mumbai, India
Old 07-02-2020 , 02:28   Re: [CS:GO/L4D1/L4D2] Weapon Charms (1.0) [01-Jul-2020]
Reply With Quote #10

I've installed it correctly, once the cham is applied you see the charm in your screen, but the weapon disappears and is replaced by error boxes.

Another friend of mine tried to install and the same happened with him. I believe some models might be missing as well


Error downloading models/weapons/silvershot/viewmodels/v_shot_mag7.mdl.bz2
and other such gun models.
__________________
Zeddy_god 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 17:51.


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