Jump to content

CreateDeath Pickup Bugged ?


Max+

Recommended Posts

Hi Guys i tryed make a pick show after player die a weapon pick up if any player take it it go and give him ammo ,

i killed my self and no pick up showing ,

function destroyDeathPickup ( pickup ) 
    if ( isElement ( pickup ) ) then 
        removeEventHandler ( "onPickupUse", pickup) 
        destroyElement ( pickup ) 
    end 
end 
  
addEventHandler ( "onPlayerWasted", root, 
    function ( ) 
        local timeout = 60000 
        local x, y, z = getElementPosition ( source ) 
        local currentweapon = getPedWeapon ( source ) 
        local totalammo = getPedTotalAmmo ( source ) 
        local pickup = createPickup ( x, y, z, 2, currentweapon, 50, totalammo ) 
        addEventHandler ( "onPickupUse", pickup, onDeathPickupHit ) 
        setTimer( destroyDeathPickup, timeout, 1, pickup ) 
    end 
) 

Link to comment

There are no errors/warnings?

local pickup = createPickup ( x, y, z, 2, currentweapon, 50, totalammo ) 

You got respawn set at 50ms, that's a little bit low, don't you think? If you want the weapon to be spawned only once, use 60000 as your timeout is.

Link to comment

Server :

addEventHandler ( 'onPlayerWasted', root, 
    function ( attacker ) 
        if attacker and attacker ~= source then 
            local weapon = getPedWeapon ( source ); 
            local ammo = getPedTotalAmmo ( source ); 
            if weapon == 0 then return end; 
            if ammo == 0 then return end; 
            local x, y, z = getElementPosition ( source ); 
            createPickup ( x, y, z, 2, weapon, _, ammo ); 
        end 
    end  
); 

Link to comment

1. You add function onDeathPickupHit to event handler but this function does not exist.

2. removeEventHandler requires a function handle to be removed.

As mentioned before, try to change the respawn time of the pickup to something higher. It doesn't really matter how long because you may want to destroy it once a player hits it or timer will destroy it.

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