Jump to content

onPickupHit's source-element is not destroyable


mabako

Recommended Posts

I've experienced the following error when writing a bit advanced thing for my gamemode. The following code should(!) destroy the pickup when it's picked up, and send a message. But however, it doesn't destroy the pickup, nor does it give any message about "not a pickup" - so appearantly, something is wrong here :/

function PickupCashBox( hitPlayer ) 
    -- destroy the "source" element - the original pickup 
    destroyElement( source ) 
  
    -- tell he picked it up (and element should be destroyed) 
    outputChatBox( getClientName( hitPlayer ) .. " reached the pickup!" )  -- THIS message shows fine 
     
end 

  
function Start() 
    m_cashbox.Pickup = createPickup( start.X, start.Y, start.Z, 3, start.PickupID, 3000000 ) 
    if( m_cashbox.Pickup ) then 
        addEventHandler ( "onPickupHit", m_cashbox.Pickup, PickupCashBox ) 
    end 
end 

However, when i just use destroyElement( m_cashbox.Pickup ) instead of ( source ), it is fine - the pickup gets destroyed.

I hope this will fixed as soon as possible, so i can destroy them via source, which would come handy regarding I may put multiple pickups in my script at one time - and wont write a function for each.

cheers

mabako

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...