1LoL1 Posted October 4, 2015 Posted October 4, 2015 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 )
CobbTheWarriorsRPG Posted October 4, 2015 Posted October 4, 2015 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
1LoL1 Posted October 4, 2015 Author Posted October 4, 2015 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. local pickup = createPickup(x,y,z,3,id,5000) function gift (thePlayer) test end addEventHandler ( "onPickupHit", pickup, gift )
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