Hi, I am stuck at this script. I want the script work like this: when ped falls on the ground it automatically kills the ped when he touches the ground
function isPedOnGround ()
local ped = getLocalPlayer()
local x,y,z = getElementPosition( ped )
if isPedOnGround ( sourcePlayer ) then
setElementHealth(ped, 0)
end
addEventHandler("onClientPreRender", root, isPedOnGround)
Can anyone tell me what's wrong with it?