Max+ Posted April 12, 2013 Share Posted April 12, 2013 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
MIKI785 Posted April 12, 2013 Share Posted April 12, 2013 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
Max+ Posted April 13, 2013 Author Share Posted April 13, 2013 i didn't understand you , what you mean ? i Need if i kill player create Pickup weapons , every time i kill a plyer , Link to comment
Max+ Posted April 13, 2013 Author Share Posted April 13, 2013 so any attempt to help me ? and it dosn't show any errors , Link to comment
Max+ Posted April 14, 2013 Author Share Posted April 14, 2013 Please Some one Help Me littel bit , Link to comment
Puma Posted April 14, 2013 Share Posted April 14, 2013 Try replacing 50 in createPickup by your timeout variable. Link to comment
Max+ Posted April 14, 2013 Author Share Posted April 14, 2013 and what's the time out .. whatever ? i simply need to make if player die create pick up weapon that's all , Link to comment
PaiN^ Posted April 14, 2013 Share Posted April 14, 2013 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
50p Posted April 14, 2013 Share Posted April 14, 2013 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now