JeViCo Posted April 3, 2018 Posted April 3, 2018 (edited) marks = { { -2028.94299, 156.78644, 28.39065 }, { -2023.20532, 157.21294, 28.39178 }, } for i,v in pairs(marks) do local coord = v[1],v[2],v[3] --outputChatBox(coord) marker = createMarker(coord, 2,"corona",2,150,255,150,150) end Hello everyone! I treid to use pairs/ipairs today but markers didn't appear and i got this Any suggestions? Edited April 3, 2018 by Juuve
Moderators Patrick Posted April 3, 2018 Moderators Posted April 3, 2018 (edited) marks = { { -2028.94299, 156.78644, 28.39065 }, { -2023.20532, 157.21294, 28.39178 }, } for i,v in ipairs(marks) do marker = createMarker(v[1], v[2], v[3], 2,"corona",2,150,255,150,150) end Edited April 3, 2018 by gpetersz community profile | map converters | map images | pDownloader | pAttach | model encrypter
Moderators IIYAMA Posted April 3, 2018 Moderators Posted April 3, 2018 marker = createMarker(v[1], v[2], v[3], 2,"corona",2,150,255,150,150) /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ In your code: coord == v[1] And v[2], v[3] are left out. Which gives you this result: marker = createMarker(v[1], 2,"corona",2,150,255,150,150) And that isn't what you want. 1 Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
JeViCo Posted April 3, 2018 Author Posted April 3, 2018 (edited) the main problem that i get x,y,z ouput in chat correct, but i can't use it in createMarker even with tonumber. I got same result by using createMarker(v[1]) + pairs and createMarker(v[1], v[2], v[3]) + ipairs - SAME\\\\ marks = { { -2028.94299, 156.78644, 28.39065 }, { -2023.20532, 157.21294, 28.39178 }, } for i,v in pairs(marks) do local coord = v[1],v[2],v[3] outputChatBox(v[1]..", "..v[2]..", "..v[3]) marker = createMarker(coord, 2,"corona",2,150,255,150,150) end Output with this code + same error: Edited April 3, 2018 by Juuve
Moderators Patrick Posted April 3, 2018 Moderators Posted April 3, 2018 Your syntax was bad. marks = { { -2028.94299, 156.78644, 28.39065 }, { -2023.20532, 157.21294, 28.39178 }, } for i,v in ipairs(marks) do marker = createMarker(v[1], v[2], v[3], "checkpoint", 2, 150, 255, 150, 150) end 1 community profile | map converters | map images | pDownloader | pAttach | model encrypter
JeViCo Posted April 3, 2018 Author Posted April 3, 2018 (edited) 2 minutes ago, gpetersz said: Your syntax was bad. marks = { { -2028.94299, 156.78644, 28.39065 }, { -2023.20532, 157.21294, 28.39178 }, } for i,v in ipairs(marks) do marker = createMarker(v[1], v[2], v[3], "checkpoint", 2, 150, 255, 150, 150) end Thank you so much! That works now. I wrote the size before type// Edited April 3, 2018 by Juuve
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