Jump to content

[HELP] Pickup Weapons


Recommended Posts

Hi what's up greetings c:. I'm creating a command to drop a specific weapon, but I don't want these to be created as pickups, but as an object on the ground to make it more realistic with a collision that allows you to pick up the weapon, The detail is that I tried it and the weapon is actually created and the collision, but the problem arises when another player goes to take the weapon, it does not let him take it or everything is bugged, here I leave an example code, I hope for your help pls

local obj = {} local col = {}

addCommandHandler("dropkata",function(player) 
    local r = getPedRotation(player) 
    local x,y,z = getElementPosition(player) 
    takeWeapon(source, 8)
    obj[player] = createObject(325, x+math.sin(math.rad(-r))(1),y+math.cos(math.rad(-r))(1), z-1, 90)
    col[player] = createColSphere(x+math.sin(math.rad(-r))(1),y+math.cos(math.rad(-r))(1),z, 0.5) 

addEventHandler("onColShapeHit", col[source], 
    function(player)
    if getElementType(player) == "player" then
    giveWeapon(player, 8, 1, true)
  end 
end) 

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