Jump to content

I need a help in a code.


WiBox

Recommended Posts

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

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 by DeadthStrock
  • Thanks 1
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...