Jump to content

[HELP] Pickup


1LoL1

Recommended Posts

Hello can anyone help me with my code please? how i can pickup respawn for 5 seconds?

local pickup = createPickup(x,y,z,3,id,3) 
  
function gift (thePlayer) 
test 
end 
addEventHandler ( "onPickupUse", pickup, gift ) 

Link to post

Something like this?

function SpawnPicks ( ) 
    if ( not pickup ) then 
        pickup = createPickup(x,y,z,3,id,3) 
        addEventHandler ( "onPickupHit", pickup, onPickupHit ) 
    end 
end 
addEventHandler ( "onResourceStart", resourceRoot, SpawnPicks ) 
  
  
function onPickupHit ( ) 
    if isElement ( pickup ) then 
        destroyElement ( pickup ) 
        setTimer ( function() 
            SpawnPicks() 
            outputChatBox ( "Pickup created" ) 
        end, 5000, 1 ) 
    end 
  
    pickup = nil 
end 

Link to post
Something like this?
function SpawnPicks ( ) 
    if ( not pickup ) then 
        pickup = createPickup(x,y,z,3,id,3) 
        addEventHandler ( "onPickupHit", pickup, onPickupHit ) 
    end 
end 
addEventHandler ( "onResourceStart", resourceRoot, SpawnPicks ) 
  
  
function onPickupHit ( ) 
    if isElement ( pickup ) then 
        destroyElement ( pickup ) 
        setTimer ( function() 
            SpawnPicks() 
            outputChatBox ( "Pickup created" ) 
        end, 5000, 1 ) 
    end 
  
    pickup = nil 
end 

No but thanks and my problem is solved. I used this and work. :D

local pickup = createPickup(x,y,z,3,id,5000) 
  
function gift (thePlayer) 
test 
end 
addEventHandler ( "onPickupHit", pickup, gift ) 

Link to post

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