[PAID] [STANDALONE] Weapon Sling Script / Weapons On Back

A script by catodev

No reviews yet.
[PAID] [STANDALONE] Weapon Sling Script / Weapons On Back main image

Full Description

[Tebex 5€ + tax]
[Preview Video]

Weapon Sling

Allows you to sling your weapon on front and on back.

Requires user to first unrack their weapon from vehicle trunk and disallows putting it away until racked again (They can sling it to use other guns or to free their hands).

Features:

  • Fully customizable attachments, vests and coordinates
  • Works with vanilla and addon weapons
  • Preserves and shows all attachments
  • Preserves and shows all weapon tints (experimental)
  • Works with custom weapon skins and addons
  • Automatic selection of the Sling for special bulletproofs
Code is accessible No
Subscription-based No
Lines (approximately) 2000
Requirements default weapon wheel
Support Yes

Important!

This script currently does not work with inventories that have any kind of hotbar system!
Examples include:

  • qb inventory
  • quasar inventory

However, the script works with all inventories that use the standard weapon wheel.

Support for OxInventory has recently been added!

Configuration:

  • Customizable Commands
  • Customizable Weapon Lists
  • Customizable Sling types for Male and Female
  • Customizable Notification
Config.ExperimentalMode = true --| Enables weapon tints, but that's work in progresss
Config.GrayWeapon 		= true --| grays out the weapons in the weapons wheel >> takes ca. +0.02ms more

Config.RequireTrunk		= true --| require a trunk to rack a new weapon

--| Here you can set vehicles that do not have the weapon storage in the trunk
Config.Vehicles = { --| 
	['ADDER'] = {
		-- Driver Side, Front = 0
		-- Driver Side, Rear = 1
		-- Passenger Side, Front= 2
		-- Passenger Side, Rear = 3
		-- Hood/Bonnet = 4
		-- Boot/Trunk = 5
		openDoors = function(vehicle)
			SetVehicleDoorOpen(vehicle, 4, false, false)
		end,
		closeDoors = function(vehicle)
			SetVehicleDoorShut(vehicle, 4, false)
		end,

		-- for a full list visit https://pastebin.com/D7JMnX1g
		-- just use these for the Hood/Bonnet
		bones =  {
			"overheat",
			"headlight_l",
			"headlight_r"
		}
	},
}

Config.IdleTicks = {
	200,	-- main loop		<< can be set higher
	500,	-- holster loop		<< can be set higher
	100,	-- spawner			<< can be set higher
	100,	-- action blocker	<< best to leave it as it is
	1,		-- weapon gray		<< best to leave it as it is
	500,	-- auto sling		<< can be set higher
}

--| notify trigger
Config.Notification = function(text)
	BeginTextCommandThefeedPost('STRING') --| gta5 default feature
	AddTextComponentSubstringPlayerName(text)
	EndTextCommandThefeedPostTicker(0,1)
end

--| blocked keys while racking
Config.BlockKeys = {
	23,
	25,
	37,
	140,
	141,
	142
}

--| weapons that take longer to draw
Config.SlowEquip = {
	'WEAPON_PISTOL',
	'WEAPON_PISTOL_MK2',
	'WEAPON_COMBATPISTOL',
	'WEAPON_APPISTOL',
	'WEAPON_STUNGUN',
	'WEAPON_PISTOL50',
	--'WEAPON_SNSPISTOL',
	--'WEAPON_SNSPISTOL_MK2',
	'WEAPON_HEAVYPISTOL',
	'WEAPON_VINTAGEPISTOL',
	--'WEAPON_FLAREGUN',
	'WEAPON_MARKSMANPISTOL',
	'WEAPON_REVOLVER',
	'WEAPON_REVOLVER_MK2',
	'WEAPON_DOUBLEACTION',
	'WEAPON_CERAMICPISTOL',
	'WEAPON_NAVYREVOLVER',
	'WEAPON_GADGETPISTOL',
	'WEAPON_STUNGON_MP',
	--'WEAPON_PISTOLMX3',

	'WEAPON_MICROSMG',
	'WEAPON_MACHINEPISTOL',
	'WEAPON_MINISMG',

	'WEAPON_SAWNOFFSHOTGUN',
	'WEAPON_DBSHOTGUN',
	'WEAPON_AUTOSHOTGUN',
}

 --╔══════════════════════════════════════════════════╗--
---║                     PISTOLS                      ║---
 --╚══════════════════════════════════════════════════╝--

Config.ChangeHolster = 'holster' --| command to change > e.g.: /holster 2
Config.HolsterGrip = 20 --| button y / z
Config.HolsterWeapons = {
	'WEAPON_PISTOL',
	'WEAPON_PISTOL_MK2',
	'WEAPON_COMBATPISTOL',
	'WEAPON_APPISTOL',
	'WEAPON_PISTOL50',
	--'WEAPON_SNSPISTOL',
	--'WEAPON_SNSPISTOL_MK2',
	'WEAPON_HEAVYPISTOL',
	'WEAPON_VINTAGEPISTOL',
}

Config.HolstersMale = {
	["default"] = {
		with	= {7, 0, 0, 0},
		without	= {7, 0, 0, 0},
	},
	["1"] = {
		with	= {7, 1, 0, 0},
		without	= {7, 2, 0, 0},
	},
	["2"] = {
		with	= {7, 3, 0, 0},
		without	= {7, 4, 0, 0},
	},
}

Config.HolstersFemale = {
	["default"] = {
		with	= {7, 0, 0, 0},
		without	= {7, 0, 0, 0},
	},
	["1"] = {
		with	= {7, 1, 0, 0},
		without	= {7, 2, 0, 0},
	},
	["2"] = {
		with	= {7, 3, 0, 0},
		without	= {7, 4, 0, 0},
	},
}

 --╔══════════════════════════════════════════════════╗--
---║                     RIFLES                       ║---
 --╚══════════════════════════════════════════════════╝--

--| to put the gun back in the trunk
Config.Rack = 'rack'	--| command
Config.RackTime = 4000	--| time

--| weapons which must be on the back to be used
Config.SlingWeapons = {
	'WEAPON_SMG',
	'WEAPON_SMG_MK2',
	'WEAPON_ASSAULTSMG',
	'WEAPON_COMBATPDW',

	'WEAPON_PUMPSHOTGUN',
	'WEAPON_PUMPSHOTGUN_MK2',
	'WEAPON_ASSAULTSHOTGUN',
	'WEAPON_BULLPUPSHOTGUN',
	'WEAPON_MUSKET',
	'WEAPON_HEAVYSHOTGUN',
	'WEAPON_COMBATSHOTGUN',

	'WEAPON_ASSAULTRIFLE',
	'WEAPON_ASSAULTRIFLE_MK2',
	'WEAPON_CARBINERIFLE',
	'WEAPON_CARBINERIFLE_MK2',
	'WEAPON_ADVANCEDRIFLE',
	'WEAPON_SPECIALCARBINE',
	'WEAPON_SPECIALCARBINE_MK2',
	'WEAPON_BULLPUPRIFLE',
	'WEAPON_BULLPUPRIFLE_MK2',
	'WEAPON_COMPACTRIFLE',
	'WEAPON_MILITARYRIFLE',
	'WEAPON_HEAVYRIFLE',
	'WEAPON_TACTICALRIFLE',

	'WEAPON_MG',
	'WEAPON_COMBATMG',
	'WEAPON_COMBATMG_MK2',
	'WEAPON_GUSENBERG',

	'WEAPON_SNIPERRIFLE',
	'WEAPON_HEAVYSNIPER',
	'WEAPON_HEAVYSNIPER_MK2',
	'WEAPON_MARKSMANRIFLE',
	'WEAPON_MARKSMANRIFLE_MK2',
	'WEAPON_PRECISIONRIFLE',

	'WEAPON_VICTUSXMR',
}

--| weapon slings
Config.ChangeSling = 'sling'	--| command to change > e.g.: /sling 2

Config.SlingsMale = {			--| sling variations for male ped models
	["1"] = { --> back
		dict = 'reaction@intimidation@1h', anim = 'intro', time = 0.325, wait = 1000,		--| take
		dict2 = 'reaction@intimidation@1h', anim2 = 'outro', time2 = 0.125, wait2 = 700,	--| place
		after = false, --| take weapon after anim
		x = 0.3, y = -0.15, z = -0.10,
		dx = 180.0, dy = 145.0, dz = 0.0
	},
	["2"] = { --> front
		dict = 'clothingtie', anim = 'try_tie_neutral_a', time = 0.0, wait = 1000,
		dict2 = 'clothingtie', anim2 = 'try_tie_neutral_a', time2 = 0.0, wait2 = 1000,
		after = true,
		x = 0.1, y = 0.20, z = 0.0,
		dx = 0.0, dy = 320.0, dz = 175.0
	},
	["3"] = { --> side
		dict = 'reaction@intimidation@cop@unarmed', anim = 'intro', time = 0.325, wait = 150,
		dict2 = 'reaction@intimidation@cop@unarmed', anim2 = 'outro', time2 = 0.125, wait2 = 250,
		after = false,
		x = -0.15, y = 0.08, z = -0.22,
		dx = 90.0, dy = 180.0, dz = 0.0
	},
	["4"] = { --> front 2
		dict = 'clothingtie', anim = 'try_tie_neutral_a', time = 0.0, wait = 1000,
		dict2 = 'clothingtie', anim2 = 'try_tie_neutral_a', time2 = 0.0, wait2 = 1000,
		after = true,
		x = 0.22, y = 0.24, z = 0.035,
		dx = 0.0, dy = 320.0, dz = 155.0
	},
	["5"] = {--> front 3
		dict = 'clothingtie', anim = 'try_tie_neutral_a', time = 0.0, wait = 1000,
		dict2 = 'clothingtie', anim2 = 'try_tie_neutral_a', time2 = 0.0, wait2 = 1000,
		after = true,
		x = 0.13, y = 0.25, z = 0.0,
		dx = 0.0, dy = 330.0, dz = 180.0
	},

	["6"] = {
		dict = '', anim = '', time = 0,
		dict2 = '', anim2 = '', time2 = 0,
		x = 0.1, y = 0.25, z = 0.1,
		dx = 345.0, dy = 340.0, dz = 180.0
	},
	["7"] = {
		dict = '', anim = '', time = 0,
		dict2 = '', anim2 = '', time2 = 0,
		x = 0.28, y = 0.24, z = 0.0,
		dx = 0.0, dy = 320.0, dz = 145.0
	},
	["8"] = {
		dict = '', anim = '', time = 0,
		dict2 = '', anim2 = '', time2 = 0,
		x = -0.15, y = -0.08, z = 0.22,
		dx = 290.0, dy = 180.0, dz = 0.0
	},
	["9"] = {
		dict = '', anim = '', time = 0,
		dict2 = '', anim2 = '', time2 = 0,
		x = 0.1, y = -0.184, z = 0.0,
		dx = 0.0, dy = 50.0, dz = 357.0
	},
	["10"] = {
		dict = '', anim = '', time = 0,
		dict2 = '', anim2 = '', time2 = 0,
		x = 0.1, y = -0.174, z = 0.0,
		dx = 0.0, dy = 35.0, dz = 352.0
	},
	["11"] = {
		dict = '', anim = '', time = 0,
		dict2 = '', anim2 = '', time2 = 0,
		x = 0.1, y = -0.20, z = 0.0,
		dx = 0.0, dy = 50.0, dz = 355.0
	},
}

Config.SlingsFemale = { --| sling variations for female ped models
	["1"] = { --> back
		dict = 'reaction@intimidation@1h', anim = 'intro', time = 0.325, wait = 1000,		--| take
		dict2 = 'reaction@intimidation@1h', anim2 = 'outro', time2 = 0.125, wait2 = 700,	--| place
		after = false, --| place weapon after anim
		x = 0.3, y = -0.15, z = -0.10,
		dx = 180.0, dy = 145.0, dz = 0.0
	},
	["2"] = { --> front
		dict = 'clothingtie', anim = 'try_tie_neutral_a', time = 0.0, wait = 1000,
		dict2 = 'clothingtie', anim2 = 'try_tie_neutral_a', time2 = 0.0, wait2 = 1000,
		after = true,
		x = 0.1, y = 0.20, z = 0.0,
		dx = 0.0, dy = 320.0, dz = 175.0
	},
	["3"] = { --> side
		dict = 'reaction@intimidation@cop@unarmed', anim = 'intro', time = 0.325, wait = 150,
		dict2 = 'reaction@intimidation@cop@unarmed', anim2 = 'outro', time2 = 0.125, wait2 = 250,
		after = false,
		x = -0.15, y = 0.08, z = -0.22,
		dx = 90.0, dy = 180.0, dz = 0.0
	},
	["4"] = { --> front 2
		dict = 'clothingtie', anim = 'try_tie_neutral_a', time = 0.0, wait = 1000,
		dict2 = 'clothingtie', anim2 = 'try_tie_neutral_a', time2 = 0.0, wait2 = 1000,
		after = true,
		x = 0.22, y = 0.24, z = 0.035,
		dx = 0.0, dy = 320.0, dz = 155.0
	},

	["5"] = {
		dict = '', anim = '', time = 0,
		dict2 = '', anim2 = '', time2 = 0,
		x = 0.1, y = 0.25, z = 0.1,
		dx = 345.0, dy = 340.0, dz = 180.0
	},
	["6"] = {
		dict = '', anim = '', time = 0,
		dict2 = '', anim2 = '', time2 = 0,
		x = 0.28, y = 0.24, z = 0.0,
		dx = 0.0, dy = 320.0, dz = 145.0
	},
	["7"] = {
		dict = '', anim = '', time = 0,
		dict2 = '', anim2 = '', time2 = 0,
		x = 0.13, y = 0.25, z = 0.0,
		dx = 0.0, dy = 330.0, dz = 180.0
	},
	["8"] = {
		dict = '', anim = '', time = 0,
		dict2 = '', anim2 = '', time2 = 0,
		x = -0.15, y = -0.08, z = 0.22,
		dx = 290.0, dy = 180.0, dz = 0.0
	},
	["9"] = {
		dict = '', anim = '', time = 0,
		dict2 = '', anim2 = '', time2 = 0,
		x = 0.1, y = -0.184, z = 0.0,
		dx = 0.0, dy = 50.0, dz = 357.0
	},
	["10"] = {
		dict = '', anim = '', time = 0,
		dict2 = '', anim2 = '', time2 = 0,
		x = 0.1, y = -0.174, z = 0.0,
		dx = 0.0, dy = 35.0, dz = 352.0
	},
	["11"] = {
		dict = '', anim = '', time = 0,
		dict2 = '', anim2 = '', time2 = 0,
		x = 0.1, y = -0.20, z = 0.0,
		dx = 0.0, dy = 50.0, dz = 355.0
	},
}

--| automatically change the weapon sling
Config.UseAutoSling = true

--| auto slings for male peds

--> to get your current vest use /getvest
--> the vest id must allwasy be in [""]
--> [vestid] = slingid
Config.AutoSlingMale = {
	--> front vests
	["6"] = "4",
	["7"] = "6",
}

--| auto slings for female peds
Config.AutoSlingFemale = {
	--> front vests
	["26"] = "4",
	["7"] = "5",
}

 --╔══════════════════════════════════════════════════╗--
---║                   TRANSLATION                    ║---
 --╚══════════════════════════════════════════════════╝--

--| translations
Config.Translation = {
	['needTrunk1']		= 'You have to be at a trunk to draw the rifle!',
	['needTrunk2']		= 'You have to be at a trunk to put your rifle away!',

	['setHolster']		= 'You have successfully changed the holster!',
	['setToDefault']	= 'Holster has been set to default',

	['setSling']		= 'You have successfully changed the sling!',
	['notAvalible']		= 'This sling ID is not available',
}

IMPORTANT UPDATES

UPDATE v1.2.5
better performance
you can now gray out the weapons in the weaponwheel
added a option to change trunk location for a specific vehicle
added the option that you don’t need a trunk at all
UPDATE v1.3.0
Weapon-state can now be saved on restarts
UPDATE v1.5.0
Added support for OxInventory