Wolfcraft22 Posted August 27, 2016 Share Posted August 27, 2016 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
Wumbaloo Posted August 27, 2016 Share Posted August 27, 2016 As the wiki says, the function getGroundPosition needs 3 arguments (x, y, z) and it returns a float that is the z position. After your getElementPosition, write: local z = getGroundPosition(x, y, z) Link to comment
Wolfcraft22 Posted August 27, 2016 Author Share Posted August 27, 2016 Thanks! It seems to work now! Link to comment
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