Jump to content

Pickup .... Help


HoLsTeN

Recommended Posts

hi all

i want make small script for Pickup health

function createDeathPickup ( totalammo, killer, killerweapon, bodypart ) --when a player dies 
   x, y, z = getElementPosition ( killer ) --get the position of the person who died and define it as x, y and z 
    health = setElementHealth ( source, getElementHealth(source) + 40 ) 
    createPickup ( x, y, z, 0, health, 10000 , totalammo ) 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), createDeathPickup ) 

but the code not work help me pls

Link to comment
function createDeathPickup ( totalammo, killer, killerweapon, bodypart ) --when a player dies 
   x, y, z = getElementPosition ( source ) --get the position of the person who died and define it as x, y and z 
setTimer(function()    createPickup ( x, y, z, 0, getElementHealth(killer) + 40, 10000 , totalammo ) end,1000,1) 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), createDeathPickup ) 

maybe you mean this ?

Link to comment

Try

function createDeathPickup ( totalammo, killer, killerweapon, bodypart ) --when a player dies 
   x, y, z = getElementPosition ( source ) --get the position of the person who died and define it as x, y and z 
setTimer(function()    createPickup ( x, y, z, 0, getElementHealth(killer) + 40,false, totalammo ) end,1000,1) 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), createDeathPickup ) 

Link to comment
function createDeathPickup ( totalammo, killer, killerweapon, bodypart ) 
  x, y, z = getElementPosition ( source ) 
  setTimer( function ( killer, totalammo ) createPickup ( x, y, z, 0, getElementHealth(killer) + 40,false, totalammo ) end,1000,1, killer, totalammo) 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), createDeathPickup ) 

Link to comment
function createDeathPickup ( totalammo, killer, killerweapon, bodypart ) 
  x, y, z = getElementPosition ( source ) 
  setTimer( function ( killer, totalammo ) createPickup ( x, y, z, 0, getElementHealth(killer) + 40,nil,totalammo ) end,1000,1, killer, totalammo) 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), createDeathPickup ) 

Link to comment

i try this code but it is not work

Bad argument getElementPosition

Bad argument createPickup

function createDeathPickup ( player ) 
    local x,y,z = getElementPosition ( player ) 
    createPickup ( x, y, z, 0, 100 ) 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), createDeathPickup ) 

Link to comment

Maybe something like this? ( There may be errors, I'm not good at scripting :P Just an idea )

function createDeathPickup ( totalammo, killer, killerweapon, bodypart ) 
  x, y, z = getElementPosition ( source ) 
   health = createPickup ( x, y, z, 0, 100) 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), createDeathPickup ) 
  
function destroyPickup 
    destroyElement(health) 
end 
addEventHandler("onPickupHit", health, destroyPickup) 

Link to comment

You want to create a pickup with player health? if so, try this:

function createDeathPickup ( totalammo, killer, killerweapon, bodypart ) 
   local  x, y, z = getElementPosition ( source ) 
   local  health = createPickup ( x, y, z, 0, 40) 
   addEventHandler("onPickupHit", health, destroyPickup) 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), createDeathPickup ) 
  
function destroyPickup() 
    destroyElement(source) 
end 

Link to comment
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 

Edited by Guest
Link to comment

Because that part is not there...

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 

Try it.

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