SzbyDev Posted August 20, 2018 Share Posted August 20, 2018 I try to random spawn locations but not working local fegyverPedP = { --{2274.2573242188, -262.47836303711, 9.2684917449951}, --{1491.6328125, 295.41278076172, 18.663465499878}, [1] = {2756.822265625, -2513.9208984375, 13.642685890198}, [2] = {2761.572265625, -2531.7333984375, 13.638335227966}, } function createped(fegyverPed,fegyverPedP) local randompos = math.random(1, #fegyverPedP) fegyverPed = createPed(111, fegyverPedP[randompos], fegyverPedP[randompos], fegyverPedP[randompos]) --outputChatBox(fegyverPedP[randompos][1], fegyverPedP[randompos][2], fegyverPedP[randompos][3]) setElementInterior(fegyverPed, 0) setElementDimension(fegyverPed, 0) setElementFrozen(fegyverPed, true) setElementRotation(fegyverPed, 0, 0, 90) end 1 Link to comment
Moderators IIYAMA Posted August 20, 2018 Moderators Share Posted August 20, 2018 Quote fegyverPed = createPed(111, fegyverPedP[randompos], fegyverPedP[randompos], fegyverPedP[randompos]) --outputChatBox(fegyverPedP[randompos][1], fegyverPedP[randompos][2], fegyverPedP[randompos][3]) The answer to your question is already in YOUR comments. local fegyverPed = createPed(111, fegyverPedP[randompos][1], fegyverPedP[randompos][2], fegyverPedP[randompos][3]) Link to comment
SzbyDev Posted August 20, 2018 Author Share Posted August 20, 2018 I try it but not working the ped is not spawned Link to comment
AncienT Posted August 20, 2018 Share Posted August 20, 2018 (edited) 36 minutes ago, asdninja said: I try to random spawn locations but not working local fegyverPedP = { --{2274.2573242188, -262.47836303711, 9.2684917449951}, --{1491.6328125, 295.41278076172, 18.663465499878}, [1] = {2756.822265625, -2513.9208984375, 13.642685890198}, [2] = {2761.572265625, -2531.7333984375, 13.638335227966}, } function createped(fegyverPed,fegyverPedP) local randompos = math.random(1, #fegyverPedP) fegyverPed = createPed(111, fegyverPedP[randompos], fegyverPedP[randompos], fegyverPedP[randompos]) --outputChatBox(fegyverPedP[randompos][1], fegyverPedP[randompos][2], fegyverPedP[randompos][3]) setElementInterior(fegyverPed, 0) setElementDimension(fegyverPed, 0) setElementFrozen(fegyverPed, true) setElementRotation(fegyverPed, 0, 0, 90) end local fegyverPedP = { {2274.2573242188, -262.47836303711, 9.2684917449951}, {1491.6328125, 295.41278076172, 18.663465499878}, } function createped(fegyverPed,fegyverPedP) posPed = math.random(1,#fegyverPedP) for i,v in ipairs (fegyverPedP) do if i = posPed then fegyverPed = createPed(111, v[1], v[2], v[3]) setElementInterior(fegyverPed, 0) setElementDimension(fegyverPed, 0) setElementFrozen(fegyverPed, true) setElementRotation(fegyverPed, 0, 0, 90) end end end Edited August 20, 2018 by AncienT Link to comment
Moderators IIYAMA Posted August 20, 2018 Moderators Share Posted August 20, 2018 (edited) local fegyverPedP = { {2756.822265625, -2513.9208984375, 13.642685890198}, {2761.572265625, -2531.7333984375, 13.638335227966} } function createThisPed(positions) local randomPos = math.random(#positions) local fegyverPed = createPed(111, positions[randomPos][1], positions[randomPos][2], positions[randomPos][3]) setElementInterior(fegyverPed, 0) setElementDimension(fegyverPed, 0) setElementFrozen(fegyverPed, true) setElementRotation(fegyverPed, 0, 0, 90) end createThisPed(fegyverPedP) Untested Edited August 20, 2018 by IIYAMA Link to comment
SzbyDev Posted August 21, 2018 Author Share Posted August 21, 2018 Thank you guys for the help! 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