Jump to content

setWeaponProperty [HELP]


TheBot

Recommended Posts

SERVER SIDE

function applyWeaponPropertiesToPlayer(player, weaponID)
    triggerClientEvent(player, "laxaevent", resourceRoot, weaponID)
end

addCommandHandler("setMP5Mode",
    function(player, command, mode)
        local weaponID = 29 -- MP5
        if mode == "default" then
            applyWeaponPropertiesToPlayer(player, weaponID)
        elseif mode == "pro" then
            applyWeaponPropertiesToPlayer(player, weaponID)
        end
    end
)

CLIENT SIDE

addEvent("laxaevent", true)
addEventHandler("laxaevent", root, 
    function(weaponID)
        if weaponID == 29 then
            setWeaponProperty(29, "pro", "weapon_range", 100)
            setWeaponProperty(29, "pro", "target_range", 25)
            setWeaponProperty(29, "pro", "accuracy", 100)
            setWeaponProperty(29, "pro", "damage", 15)
            setWeaponProperty(29, "pro", "maximum_clip_ammo", 60)
            setWeaponProperty(29, "pro", "flag_type_dual", false)
        end
    end
)

Since weapon properties are client-side only, you need to ensure that when reloading or switching weapons, the player retains the correct properties. This can be done using the

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...