Stevenn Posted April 22, 2012 Posted April 22, 2012 hey, how can i create markers from a table? like markers = { {x,y,z}; {x,y,z}; } createMarker ( makers, blablabla )
Kenix Posted April 22, 2012 Posted April 22, 2012 Use loop. local tMarkers = { { nX = 0, nY = 0, nZ = 10 }; { nX = 200, nY = 200, nZ = 20 }; } for _, t in pairs( tMarkers ) do createMarker ( t.nX, t.nY, t.nZ ) end
Stevenn Posted April 22, 2012 Author Posted April 22, 2012 okay thanks, it works but if i want to change it to peds and i want to set the rotation? local sellerPeds = { { nX = 0, nY = 0, nZ = 10 }; { x = -1539, y = 126, z = 3, rotX = 0, rotY = 0, rotZ = 0 }; } for _, t in pairs( sellerPeds ) do sellerped = createPed ( 1, t.x, t.y, t.z, "cylinder", 2, 250,250,250 ) setElementRotation ( serllerped, t.rotX, t.rotY, t.rotZ ) end ??
Kenix Posted April 22, 2012 Posted April 22, 2012 (edited) Yes. But you have mistake with this What is it? Arguments wrong. Read wiki https://wiki.multitheftauto.com/wiki/CreatePed sellerped = createPed ( 1, t.x, t.y, t.z, "cylinder", 2, 250,250,250 ) setElementRotation ( serllerped, t.rotX, t.rotY, t.rotZ ) -- sellerped not defined And you should use ( for peds, players ) setPedRotation instead of setElementRotation https://wiki.multitheftauto.com/wiki/Scr ... troduction Edited April 22, 2012 by Guest
Stevenn Posted April 22, 2012 Author Posted April 22, 2012 Yes.But you have mistake with this sellerped = createPed ( 1, t.x, t.y, t.z, "cylinder", 2, 250,250,250 ) setElementRotation ( serllerped, t.rotX, t.rotY, t.rotZ ) -- sellerped not defined And you should use setPedRotation instead of setElementRotation i changed serllerped to sellerpad as it was a typo, although its still the same error!
Stevenn Posted April 22, 2012 Author Posted April 22, 2012 I can't understand what you mean with not defined.. i tried local sellerPeds = { { nX = 0, nY = 0, nZ = 10 }; { x = -1539, y = 126, z = 3, rotX = 0, rotY = 0, rotZ = 0 }; } for _, t in pairs( sellerPeds ) do local sell = createPed ( 1, t.x, t.y, t.z ) setPedRotation ( sell, t.rotX, t.rotY, t.rotZ ) -- sellerped not defined end
Kenix Posted April 22, 2012 Posted April 22, 2012 (edited) setPedRotation ( sell, t.rotX, t.rotY, t.rotZ ) Read arguments! I can't understand what you mean with not defined.. Example print( f( ) ) -- Call not defined function f -- Output: nil -- Debug: attempt to call global 'f' (a nil value) Edited April 22, 2012 by Guest
Castillo Posted April 22, 2012 Posted April 22, 2012 local sellerPeds = { { x = 0, y = 0, z = 10, rot = 0 }, { x = -1539, y = 126, z = 3, rot = 0 } } for _, t in ipairs ( sellerPeds ) do local sell = createPed ( 1, t.x, t.y, t.z, t.rot ) end
Kenix Posted April 22, 2012 Posted April 22, 2012 local tSellerPeds = { { nX = -1539, nY = 126, z = 3, nRotZ = 0 }; } for _, t in pairs( tSellerPeds ) do local uPedSell = createPed ( 1, t.nX, t.nY, t.nZ ) setPedRotation ( uPedSell, t.nRotZ ) end
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