AlinuTz! Posted September 13, 2020 Posted September 13, 2020 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?
Moderators Patrick Posted September 13, 2020 Moderators Posted September 13, 2020 (edited) - 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 September 13, 2020 by Patrick community profile | map converters | map images | pDownloader | pAttach | model encrypter
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