HoLsTeN Posted July 24, 2011 Share Posted July 24, 2011 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
Kenix Posted July 24, 2011 Share Posted July 24, 2011 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
HoLsTeN Posted July 24, 2011 Author Share Posted July 24, 2011 i mean if the player is die createPickup for health + 40 i think now u understand me AND THE CODE U BUT is wrong sorry >< Link to comment
HoLsTeN Posted July 24, 2011 Author Share Posted July 24, 2011 sorry man my english not good and the code is work but it have a bug if i use the pickup It still respawn ? Link to comment
Kenix Posted July 24, 2011 Share Posted July 24, 2011 You don't need respawn pickup ? Link to comment
HoLsTeN Posted July 24, 2011 Author Share Posted July 24, 2011 yes i want just 1 time Link to comment
Kenix Posted July 24, 2011 Share Posted July 24, 2011 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
HoLsTeN Posted July 24, 2011 Author Share Posted July 24, 2011 Now it is not work -_-" Link to comment
bandi94 Posted July 24, 2011 Share Posted July 24, 2011 use /debugscript 3 find the error and say where is the error Link to comment
DakiLLa Posted July 24, 2011 Share Posted July 24, 2011 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
HoLsTeN Posted July 25, 2011 Author Share Posted July 25, 2011 Still Not Work Guys I just want use for 1 time Link to comment
Kenix Posted July 25, 2011 Share Posted July 25, 2011 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
HoLsTeN Posted July 26, 2011 Author Share Posted July 26, 2011 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
[DemoN] Posted July 26, 2011 Share Posted July 26, 2011 Maybe something like this? ( There may be errors, I'm not good at scripting 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
HoLsTeN Posted July 27, 2011 Author Share Posted July 27, 2011 what happen no one know how ? i try with another code but stil not work Link to comment
Castillo Posted July 27, 2011 Share Posted July 27, 2011 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
HoLsTeN Posted July 27, 2011 Author Share Posted July 27, 2011 (edited) 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 September 15, 2011 by Guest Link to comment
Castillo Posted July 27, 2011 Share Posted July 27, 2011 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
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