WiBox Posted May 29, 2018 Share Posted May 29, 2018 (edited) Hey can someone tell me a way as each time a player isn't in the colshape he will lose 20 hp in a second, I know everything just I need help for each second the player get -20 HP Zone1 = createColTube ( ..., ..., ....) function outsidetheColShape ( plr ) if ( isElementWithinColShape ( plr, Zone1 ) ) then -- i need help in this line please.... about the health.. end end Edited May 29, 2018 by SSKE Link to comment
WorthlessCynomys Posted May 29, 2018 Share Posted May 29, 2018 You should put the checking in a timer that executes every second. setTimer() getElementHealth() setElementHealth() Link to comment
WiBox Posted May 29, 2018 Author Share Posted May 29, 2018 I know i should use those, but I didn't know how to make each second remove 20 health.. setTimer ( function ( plr ) setElementHealth ( plr , getElementHealth( plr ) - 20 ) end, time.., 1) but about each second? Link to comment
WorthlessCynomys Posted May 29, 2018 Share Posted May 29, 2018 10 minutes ago, SSKE said: I know i should use those, but I didn't know how to make each second remove 20 health.. setTimer ( function ( plr ) setElementHealth ( plr , getElementHealth( plr ) - 20 ) end, time.., 1) but about each second? I'll get back to you in about an hour. Link to comment
Z4Zy Posted May 29, 2018 Share Posted May 29, 2018 (edited) Like This ?? Server Side :- addEventHandler("onColShapeHit",yourColName, function (player) setElementData(player,"inCol",true) end ) addEventHandler("onColShapeLeave",yourColName, function (player) setElementData(player,"inCol",false) end ) setTimer( function () for _,Player in ipairs ( getElementsByType("player") ) do if ( getElementData(Player,"inCol") == false ) then setElementHealth(Player,getElementHealth(Player)-20) end end end,1000,1) Replace "YourColName" with your col shape's name. Edited May 29, 2018 by DeadthStrock 1 Link to comment
WiBox Posted May 29, 2018 Author Share Posted May 29, 2018 Thanks! It worked, i really appreciate you're help 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