Stranger Posted March 28, 2014 Posted March 28, 2014 hello, i have a problem or maybe bug ? i don't know that if i used: setElementHealth (player, getElementHealth (player) - 30) it's work but if his health and his health has reached 30, his health is filled automatically, i don't know if this is a bug or something like that.
Anubhav Posted March 28, 2014 Posted March 28, 2014 local msec = 1000 -- Type mili - seconds here how much you whant. local hpC = getElementHealth (player) -- get players health local upmSec = 5000 -- type mili - seconds here of how much time you want take it make it u;. local up = 35 -- the hp should be up must be here function nameIt(player) -- function if hpC < 30 then -- checking players hp if 30 down then it will continue setTimer(setElementHealth,upmSec,3,player,up) -- it set its hp end end setTimer(nameIt,msec,0) If you meant the script then here. else-- If you meant the bug then you are talking about the health getting refiled automatically? Then post it at bugs section.
Stranger Posted March 28, 2014 Author Posted March 28, 2014 i meant, that i want his health go down not go up, like if i hit him , will take from his health 30% until he die but i here is the problem that make the health refilled if his health reached 30
Anubhav Posted March 28, 2014 Posted March 28, 2014 (edited) function playerHP(attacker) local hp = getElementHealth (source) if hp < 30 then cancelEvent() end end addEventHandler("onClientPlayerDamage",getRootElement(),playerHP) Edited March 28, 2014 by Guest
Arnold-1 Posted March 28, 2014 Posted March 28, 2014 1- you must make it -300 because full health is 1000 2- here is what you have to do health = getElementHealth(player) if health =< 300 then killPed(player) else setElementHealth(player,health - 300) end
Anubhav Posted March 28, 2014 Posted March 28, 2014 1- you must make it -300 because full health is 10002- here is what you have to do health = getElementHealth(player) if health =< 300 then killPed(player) else setElementHealth(player,health - 300) end Lol? See at the wiki setElementHealth example. Why there is -20 not -200?
Stranger Posted March 28, 2014 Author Posted March 28, 2014 you didn't understand me, i mean every time i hit him he loss 30 until he die, and i just wanna make it fast, i mean i want when i hit him not loss 5 or whatever he use , i just wanna make it if i hit him he loss 30 until he die but i have this problem that if the player close to die his health refilled, i want it if he close to die , his health not refilled, just keep going down, i wish that you understand what i meant.
iPrestege Posted March 28, 2014 Posted March 28, 2014 No that's impossible i'm sure that there's another script refilling the player health or please post whole code so we can help there.
Stranger Posted March 28, 2014 Author Posted March 28, 2014 no there is not a code that refilling the health, i'm sure, and the code i know there is no problem with it: addEventHandler ("onPlayerDamage", root, function (attacker, weapon, bodypart) if attacker then health = getElementHealth (source) setElementHealth (source, health - 30) end end)
Moderators IIYAMA Posted March 28, 2014 Moderators Posted March 28, 2014 you didn't understand me, i mean every time i hit him he loss 30 until he die, andi just wanna make it fast, i mean i want when i hit him not loss 5 or whatever he use , i just wanna make it if i hit him he loss 30 until he die but i have this problem that if the player close to die his health refilled, i want it if he close to die , his health not refilled, just keep going down, i wish that you understand what i meant. This is how you solve that problem. local healthLoss = 30 addCommandHandler("kill", function() local health = getElementHealth(localPlayer) if healh =< healthLoss then setElementHealth(localPlayer,0) else setElementHealth(localPlayer,healh-healthLoss) end end) Health gets refilled because you can't have negative health for players.
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