bebo1king Posted June 13, 2016 Share Posted June 13, 2016 (edited) Hello , i am trying to make when player die he spawns to the nearest place from his death place so i created peds in made editor and take the file map to the mod folder and put in the meta ofc the problem which i got is : when i get peds position i get there (x) position only , idk how to get the (y) and (z) Server : addEventHandler("onResourceStart",getResourceRootElement(), function() for i,v in pairs (getElementsByType("ped")) do setTimer ( function () local x,y,z = getElementPosition(v) --outputChatBox (x..","..y..","..z,root) local location = getZoneName ( x,y,z ) local city = getZoneName ( x,y,z, true ) WorldSpawn = {x,y,z,location,city} destroyElement(v) end,500,1) end end) addEventHandler("onPlayerWasted", root, function() for i,positions in ipairs (WorldSpawn) do local x,y,z = getElementPosition (source) local Dist = getDistanceBetweenPoints3D (positions[1],positions[2],positions[3],x,y,z) if Dist < 100 then spawnPlayer (source,positions[1],positions[2],positions[3]) setCameraTarget(source,source) fadeCamera(source,true) end end end) i hope someone explain my problem Edited June 14, 2016 by Guest Link to comment
Noki Posted June 14, 2016 Share Posted June 14, 2016 You're not passing 'v' to the timer inside onResourceStart. Line 4: setTimer(function (v) Line 11: end, 500, 1, v) Link to comment
bebo1king Posted June 14, 2016 Author Share Posted June 14, 2016 You're not passing 'v' to the timer inside onResourceStart.Line 4: setTimer(function (v) Line 11: end, 500, 1, v) i get it now thx 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