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)
Plugin library name: "charms_silvers"
* Creates a charm on the specified client.
* @param client Client index.
* @param index Charm index, or 0 to attempt using the clients current charm index if available.
native void Charms_Create(int client, int index = 0);
* Removes any charm from the specified client
* @param client Client index.
native void Charms_Delete(int client);
* Returns the clients current charm index. The charm might not be invalid and the index for another weapon they were holding.
* @param client Client index.
* @return Charm index.
native int Charms_GetIndex(int client);
* Checks if the client has a charm attached.
* @param client Client index.
* @return True if the client has a charm equipped
native bool Charms_GetValid(int client);
sm_charm // Shows the Charms menu. Alternative usage: sm_charm [charm index] or 0 to remove.
sm_charms // Shows the Charms weapon menu.
Requires "z" - ADMFLAG_ROOT flag
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.
Saved to charms.cfg in your servers \cfg\sourcemod\ folder.
// 0=Plugin off. 1=Plugin on.
// 0=Plugin off, 1=Plugin on.
// 0=None. 1=Give default charms to new players (search for default in the charms.data config).
// 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.
// Weapon Charms plugin version.
- L4D2: Added a warning message to suggest installing the "Use Priority Patch" plugin if missing.
- 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.
- Added Spanish translations. Thanks to "AlexAlcala" for providing.
- L4D/L4D2: Fixed not restoring the charm after being revived.
- Added an extra check in case the database had not connected. Thanks to "Marttt" for reporting.
- Added Portuguese translations. Thanks to "hoyxen" for providing.
- Fixed "Array index out-of-bounds" error. Thanks to "Alex101192" for reporting and "Marttt" for fixing.
- Added Russian translations. Thanks to "Kleiner" for providing.
- Added cvar "charms_default" to give default charms to new players or none at all.
- 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.
- 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.
- 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.
- 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.
- 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.
- L4D2: Fixed showing a duplicate weapon when using "thirdpersonshoulder". Thanks to "Alex101192" for reporting.
- 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.
- Fixed minor memory leak from bots, forgot to delete a handle I tried to remember.
- 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.
- 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.
- Initial release.
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.
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.
Download the charms.zip and extract the files to their respective folders in your servers \addons\sourcemod\ folder.
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).
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".
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.
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).