Jump to content

How to use "getGroundPosition"


Wolfcraft22

Recommended Posts

Hello! I am using DayZ mod and I need to fix some problems with dead player's body creation.

As standard, the following code is provided:

  
local x,y,z = getElementPosition(source) 
local rotX,rotY,rotZ = getElementRotation(source) 
local skin = getElementModel(source) 
local ped = createPed(skin,x,y,z,rotZ) 
  

As you can see, if I kill someone who is in the air at the moment, the body will be created in the air too. But I need to attach the"ped" to the ground "z" coordinate. As I understand correctly, the only one way to do it is to use "getGroundPosition". As wiki says, it is a client-only function.

This is the function which makes player dead if he has zero blood:

function checkStats()

if getElementData(localPlayer,"blood") < 0 then

if not getElementData(localPlayer,"isDead") then

triggerServerEvent("kilLDayZPlayer",localPlayer,false,false)

setCameraTarget (localPlayer, false)

end

end

end

setTimer(checkStats,1000,0)

should I get ground position here? And how to do it correctly?

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...