Sling Script — setup
Install Sling Script and get it configured on your server. Built for Standalone / ox_Inventory. New to Zentra? Start with the Installation guide to set up your core and license first.
Add it to your server
Download Sling Script from your portal, drop the zentra_sling_script folder into your resources directory, and add it to your server.cfg alongside your core and license key:
ensure zt_xxxxxxxxxx # your core (install once)
set zentra_license "ZS-XXXX-XXXX-XXXX-XXXX"
ensure zentra_sling_scriptOne license key runs every product you own, and your core only needs installing once. Full details are in the Installation and License keys guides.
Documentation
From the Sling Script v1.5 README, the same one included in your download.
A two-point weapon sling for FiveM. The player's rifle, SMG or shotgun hangs across their chest on a 3D strap that runs around the back of the neck, down the back and around the right side to the front mount. It follows the torso as the player moves, and other players see it too.
Standalone. It works with ox_inventory, or with no inventory at all.
Install
- Put the
zentra_sling_scriptfolder in yourresources. The folder name is the resource name, so if you rename it, use the new name inensureand in exports. - Add
ensure zentra_sling_scriptto your server.cfg, afterox_inventoryif you use it. - OneSync must be on.
- Let your staff set up the guns: give them the
sling.setupACE in server.cfg, for exampleadd_ace group.admin sling.setup allow(or changeConfig.SetupAce). They use/slingsetup.
Players pick the style, staff fit the guns
- Players (
/sling): pick the gun, how they carry it (chest two-point, back, left or right shoulder) and the webbing colour. It shows on their character as they pick, and Sling this gun keeps that choice for that weapon (saved on their PC). Then Draw / Sling / Hide it. - Staff (
Config.SetupAce,/slingsetup): fit how each gun sits in each carry: placement, angle, strap route (slung and in hand) and the strap mounts. Press Save for everyone and every player who carries that gun that way gets this fit, including players already wearing it. Reset this carry for everyone puts it back to the config defaults. - One setup for look-alike guns (
Config.SameFitin config.lua): the same gun in other colours / numbers shares one setup. Fit any of them in/slingsetupand the whole group is carried that way. - In hand is the same for every carry: a drawn gun always uses that weapon's In hand fit on the Front two-point carry (
Config.InHandCarry), whichever carry it came off. In/slingsetup, Strap fit for: In hand switches to the Front carry to fit it. - Fits are saved in
presets.jsoninside the resource, so they survive restarts. Copy that file to move them to another server.
Inventory: Config.InventoryMode in config.lua
| Mode | What it does |
|---|---|
'auto' (default) | Uses ox_inventory if your server has it, otherwise 'native' |
'ox_inventory' | The long guns in the player's ox_inventory. Draw / Sling use ox_inventory's own equip and put-away (its animation, ammo and serials). Attachments on the gun show on the slung gun, add-on attachments included. A gun the player picks up goes on the sling by itself (Config.AutoSelect). |
'native' | No inventory needed. The long guns the player's character has (GTA weapons, vMenu, any script giving weapons the normal way). Draw / Sling switch them with GTA natives. Nothing is ever given or taken. |
'external' | Your own inventory feeds the list through exports (see bottom). |
Commands
/sling: everyone (staff too) picks their gun, carry and webbing colour./slingsetup(staff): the setup menu. A camera circles your character while it's open: drag the screen or A / D / W / S to go around, wheel to zoom, or the Front / Left side / Back / Right side view buttons. Pick a gun and a carry, then fit it with everything below. Every change shows live on your own character, only you see it, until Save for everyone. Closing without saving undoes it. Anyone else gets a message instead of the menu./slingtoggle: sling or draw the gun. It has no key by default, so players bind it under Settings > Key Bindings > FiveM.
Fitting
- Weapon fit: where the rifle hangs (sideways / forward / up) and its angle (roll / down angle / turn).
- Strap fit for: Slung | In hand: the strap has two separate fits, one for the gun on the sling and one for the gun in the player's hands. Each has its own strap route and its own two mounts on the weapon. The switch decides which one the Attachment points / Strap route controls edit. The in-game editor edits whichever state the gun is in when you open it, so draw the gun first to fit the in-hand strap.
- Attachment points: the strap's two mounts on the gun, in the weapon model's axes.
- Strap route: every point the strap passes through, as sliders. Turn on Show mounts & strap guides to see them on your character, numbered and named, with the path between them.
- Move the strap in game: a camera faces your character. Click any strap point and drag it.
- Mouse wheel: closer / farther.
- A / D or arrows, Front / Left / Back / Right buttons, or right-drag: circle around.
- Done / Esc: back to the menu.
- Print route to F8: prints both routes (
routeandrouteDrawn) and both mount sets, so you can make them the default for everyone.
Everything here is per weapon and, once saved, the same for every player.
Config you may want to change
Config.Weapons: the guns that can be slung, with their default mount points. For add-on guns add{name='WEAPON_X', label='X', anchors=rifle}. If the model isn't built with +X toward the muzzle and +Z on top, addaxes = { roll, down, turn }(e.g. muzzle on +Y:axes = {0, 0, -90}).Config.Positions: the carries. The first one is the default. The chest carry's strap route is in itsroute.Config.HideStates: state bags that hide the sling, for death / downed scripts that keep the ped alive.Config.FollowTorso/Config.Torso: the chest carry follows the upper body and is attached toSKEL_Spine3. If the game ever puts it in the wrong place, it switches to placing it every frame and prints a line in F8 saying so.Config.RenderDistance,Config.DetailDistance,Config.MaxRenderedPlayers: how far away, and for how many players, slings are drawn.
Good to know
- The strap is drawn geometry routed through guide points. It isn't cloth physics and doesn't collide with clothing or vests. Vest clearance and the route sliders are how you keep it off the body.
- Default positions and routes are starting points for the freemode peds. Fit them to your peds and EUP.
- Each holstered gun uses one local (non-networked) weapon object per nearby player. Check
resmonwith a full server before raising the distance or player limits.
Exports ('external' mode or your own scripts), client side
exports['zentra_sling_script']:SetWeapons({ { id = 'serial-123', weapon = 'WEAPON_CARBINERIFLE', label = 'Patrol carbine', tint = 0, components = { 'COMPONENT_AT_AR_FLSH' } } })
exports['zentra_sling_script']:SetEquippedWeapon('serial-123') -- false = none in hand, nil = detect by weapon hash
exports['zentra_sling_script']:SelectWeapon('serial-123', { position = 'back', color = 'coyote' }) -- optional carry / colour, like a /sling pick
exports['zentra_sling_script']:GetSelection()
exports['zentra_sling_script']:SetSlingEnabled(false)
exports['zentra_sling_script']:ClearSling()
exports['zentra_sling_script']:ClearInventory()
exports['zentra_sling_script']:OpenMenu()In 'external' mode, the menu's Draw / Sling buttons fire zentra_sling_script:requestDraw / zentra_sling_script:requestHolster (local client events, with the item). Your inventory does the equip, then calls SetEquippedWeapon.