Jump to content

I need help with this


AlinuTz!

Recommended Posts

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?

Link to comment
  • Moderators

- You don't use x, y, z so unnecessary.
sourcePlayer is not defined.
and you can use hardcoded localPlayer to get client's element.

-- CLIENT

addEventHandler("onClientRender", root, function()
    if isPedOnGround(localPlayer) then
        setElementHealth(localPlayer, 0)
    end
end)

 

Edited by Patrick
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...