Jump to content

PickUp ..Help


^Dev-PoinT^

Recommended Posts

Hi all i need if Player Take The Health PickUp outputChatBox Msg To Him is it right?

function createDeathPickup ( totalammo, killer, killerweapon, bodypart ) 
       local  x, y, z = getElementPosition ( source ) 
       local  health = createPickup ( x, y, z, 0, 40) 
       addEventHandler("onPickupHit", health, givePlayerHealth) 
    end 
    addEventHandler ( "onPlayerWasted", getRootElement(), createDeathPickup ) 
      
    function givePlayerHealth(thePlayer) 
         setElementHealth(thePlayer,tonumber(getElementHealth(thePlayer))+tonumber(getPickupAmount(source))) 
        destroyElement(source) 
    end 
if getPickupType ( source ) == 0 then  
    amount = getPickupAmount ( source ) 
    outputChatBox ( "You picked up " .. amount .. " health", thePlayer) 
  

Link to comment
function createDeathPickup(totalammo, killer, killerweapon, bodypart) 
    local x, y, z = getElementPosition(source) 
    health = createPickup(x, y, z, 0, 40) 
end 
addEventHandler("onPlayerWasted", getRootElement(), createDeathPickup) 
  
function givePlayerHealth(player) 
    if getPickupType(source) == 0 then 
        local amount = getPickupAmount(source) 
        setElementHealth(player, tonumber(getElementHealth(player)) + tonumber(getPickupAmount(source))) 
        destroyElement(source) 
        outputChatBox("You picked up " .. amount .. " health", player) 
    end 
end 
addEventHandler("onPickupHit", health, givePlayerHealth) 

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