Jump to content

weapon


Recommended Posts

3 hours ago, kukimuki said:

how to make that to the weapon shows in my back??

-- Define the weapon model and its attachment bone
local weaponModel = 355 -- Change this to the model ID of the weapon you want to show
local boneName = "spine"

-- Get the player element and its position
local player = getLocalPlayer()
local x, y, z = getElementPosition(player)

-- Create the weapon object and attach it to the player's bone
local weaponObject = createObject(weaponModel, x, y, z)
attachElements(weaponObject, player, 0.3, -0.3, 0.6, 0, 0, 180, boneName)

use boneAttach

Link to comment

make sure pAttach resource is installed, use /attachweapon <weaponID>, also make adjustments on attach function

function attachWeaponToBack(player, weaponModel)
    local weaponObject = createObject(weaponModel, 0, 0, 0)
    exports.pAttach:attach(weaponObject, player, "Bip01 Spine", 0, -0.1, 0.2, 0, 180, 0)
end

addCommandHandler("attachweapon",
    function(player, command, weaponID)
        local weaponModel = tonumber(weaponID)
        if weaponModel then
            attachWeaponToBack(player, weaponModel)
            outputChatBox("Weapon attached to your back.", player)
        else
            outputChatBox("Invalid weapon ID.", player)
        end
    end
)

 

Link to comment
On 06/05/2023 at 23:16, FLUSHBICEPS said:

make sure pAttach resource is installed, use /attachweapon <weaponID>, also make adjustments on attach function

function attachWeaponToBack(player, weaponModel)
    local weaponObject = createObject(weaponModel, 0, 0, 0)
    exports.pAttach:attach(weaponObject, player, "Bip01 Spine", 0, -0.1, 0.2, 0, 180, 0)
end

addCommandHandler("attachweapon",
    function(player, command, weaponID)
        local weaponModel = tonumber(weaponID)
        if weaponModel then
            attachWeaponToBack(player, weaponModel)
            outputChatBox("Weapon attached to your back.", player)
        else
            outputChatBox("Invalid weapon ID.", player)
        end
    end
)

 

How i can download the pAttach? 
Cuz I tried one and it didnt worked

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...