๐งฑ How to Install
Follow instructions in
๐ง Features
โ
/hand [object]
to spawn a predefined prop in hands
โ
/throw
command or keybind (default G
) to throw the object
โ
Realistic throw physics from hand or vehicle window
โ
[E] Pickup interaction hint when near a thrown object
โ
Modular config to enable/disable features
โ
Scaleform hints with keybind awareness
โ
Full export & event support for other resources
โ
Fully client-side and framework-independent
๐ Commands
Spawns a prop from the config into your hand
Cancels current held object or shows usage
Throws the held object in a random direction
๐ฎ Keybind
Action
Default
Can Rebind In Settings?
To rebind, go to Settings โ Key Bindings โ FiveM โ Throw Held Object
โ๏ธ Config (config.lua
)
๐น Predefined Objects
Copy Config.Objects = {
waterbottle = { label = "Water Bottle", model = "prop_ld_flow_bottle" },
brick = { label = "Brick", model = "prop_brick_01" },
toolbox = { label = "Toolbox", model = "prop_tool_box_04" }
}
๐น Global Settings
Copy Config.Settings = {
AllowInVehicle = true, -- Allow throwing from vehicles
ForceUnarmed = true, -- Forces player to be unarmed while holding
BlockMelee = true, -- Prevents melee while holding
BlockAiming = true, -- Disables aiming and shooting
ShowThrowHint = true, -- Scaleform hint [G] Throw Object
ShowAvailableObjects = true -- Show object list if /hand has no args
}
Config.PickupKey = 38 -- [E] to pick up
๐งฉ Exports
๐งช Check if player is holding something
Copy exports["DH_Throw"]:IsPlayerHoldingObject() then ... end
๐ฆ Get current held object
Copy name = exports["DH_Throw"]:GetHeldObjectName()
local entity = exports["DH_Throw"]:GetHeldObjectEntity()
โ Remove the held object
Copy exports["DH_Throw"]:RemoveHeldObject()
๐ Set an object via code (same as /hand)
Copy exports["DH_Throw"]:SetHeldObject("brick")
๐ช Events & Callbacks
๐ DH_Throw:ObjectPickedUp
Triggered when any object is picked up:
Copy AddEventHandler("DH_Throw:ObjectPickedUp", function(objectName, netId, entity)
print("Picked up:", objectName)
end)
๐ RegisterOnObjectPickup(callback)
Alternative method for pickup detection:
Copy exports["DH_Throw"]:RegisterOnObjectPickup(function(objectName, netId, entity)
-- custom logic
end)
๐ก Tips
All objects thrown are synced and visible to all players
Throw direction is random when on foot, or based on seat position in vehicles
Melee, aiming, and weapon switching can all be disabled via config
Fully expandable โ drop in new objects, add sounds, integrate with inventory
โ Frequently Asked Questions
Can I add my own objects?Yes! Just add them to the Config.Objects
table in config.lua
:
Copy brick = { label = "Brick", model = "prop_brick_01" }
Can players hold more than one object at a time?No โ the script is designed so a player can only hold one object at a time. Calling /hand
again will replace the current one.
Does this work inside vehicles?Yes! If Config.Settings.AllowInVehicle = true
, players can throw objects out of the left or right window based on seat position.
Can I integrate this with my inventory syste, (OX/QS/etc)?Absolutely. Use the export:
Copy exports["DH_Throw"]:SetHeldObject("toolbox")
โฆand combine it with inventory checks or item usage in your own code.
Players are geting a warning: GetNetworkObject: no object by ID - What's up?This means a player tried to pick up an object that no longer exists, and it's completely harmless.