[Release] Weapons On Back

I found that when I took out the gun, resmon would increase suddenly (Although it may not affect server performance). But by the way, I like this scrip, thank you. :+1:

1 Like

I have found a solution that I just mentioned about the resmon problem.

Add this

GetSelectedPedWeapon(me) ~= wep_hash

for wep_name, wep_hash in pairs(SETTINGS.compatable_weapon_hashes) do
    if HasPedGotWeapon(me, wep_hash, false) then
        if not attached_weapons[wep_name] and GetSelectedPedWeapon(me) ~= wep_hash then
              AttachWeapon(wep_name, wep_hash, SETTINGS.back_bone, SETTINGS.x, SETTINGS.y, SETTINGS.z, SETTINGS.x_rotation, SETTINGS.y_rotation, SETTINGS.z_rotation, isMeleeWeapon(wep_name))
        end
    end
end
1 Like

Awesome! Thanks for taking the time to investigate and report that issue as well as providing a solution for it and for being astute to notice that!

I’ve just updated the OP with an updated link to the newest release, 1.2, which includes this optimization.

1 Like

My weapon is on my back but when I want to unsling off my back it’s saying unrack from vehicle as im using unrack from vehicle script how can i fix this?

does anyone know why when i have the weapons on back script and i have a weapon it doesn’t show on my back or when i holster it it show on my back then disappears?

Anyone know how to make it show gun attachments as well?

How were you able to get melee weapons to sling? We’re having a hell of a time getting the hatchet to sling.

Find out its model name and edit its x, y, z, xR, yR, zR. For example, the shield is “w_me_bottle” (I replaced the original bottle with the shield model)

2 Likes

Yeah, I tried that with “w_me_hatchet” and I’ve had a ton of issues with it. Which is confusing to me.

Hi, I´m trying to use the weapon-on-back in my localhost with the CompactRifle and i dont know why its doesn´t appear in the back :c
Can anyone help me?

I had this same issue, the weapon name for the compact rifle is a little different than what you’d expect - but in this thread, this has been the answer that worked:

[“w_ar_assaultrifle_smg”] = 1649403952,

It is broken, the guns just float above my head and are sideways, im trying to get them on the front i’ve used the numbers shown in these comments and it doesnt work

how can i change the position for different weapons so that they dont overlapped

and how can we fix that ?

Well there are probably lots of ways to get it done

One good way I can think of quickly is keep a number count of the # of currently attached weapons (can just be read from the collection of attached weapons) and use that to add some fixed offset amount

So 1 weapon = no offset
2 weapons = add 1 * offset
3 weapons = add 2 * offset

Is it compatible with ox_inventory? :face_with_raised_eyebrow:

Yes but if I use an ox_inventory style inventory with weapons that are items how can I make it work?

2 Likes

Is it possible to only show one weapon on the back and the pistols in a holster or something like that?

Just use /delobj
that will get rid of any weapons on your back


anyone know how to do this

1 Like