Spice Posted July 4, 2015 Share Posted July 4, 2015 local markers = { {1368.45532, -1279.79651, 13.54688}, {777.17426, 1871.52454, 4.90737}, } function markerscreate () local mx,my,mz = unpack(markers[index]) createMarker (mx, my, mz, "arrow", 2, 230, 0, 0, 180) end addEventHandler( "onClientResourceStart", resourceRoot, markerscreate ) Can anyone fix this ? and tell me please why it's not working Link to comment
bosslorenz Posted July 4, 2015 Share Posted July 4, 2015 Try this one function markerscreate () createMarker( 1368.45532, -1279.79651, 13.54688, "arrow", 2, 230, 0, 0, 180) createMarker( 777.17426, 1871.52454, 4.90737, "arrow", 2, 230, 0, 0, 180) end addEventHandler( "onClientResourceStart", resourceRoot, markerscreate) Link to comment
Spice Posted July 4, 2015 Author Share Posted July 4, 2015 Try this one function markerscreate () createMarker( 1368.45532, -1279.79651, 13.54688, "arrow", 2, 230, 0, 0, 180) createMarker( 777.17426, 1871.52454, 4.90737, "arrow", 2, 230, 0, 0, 180) end addEventHandler( "onClientResourceStart", resourceRoot, markerscreate) I want to make them with table Link to comment
bosslorenz Posted July 4, 2015 Share Posted July 4, 2015 local markers = { {1368.45532, -1279.79651, 13.54688, "arrow", 2, 230, 0, 0, 180}, {777.17426, 1871.52454, 4.90737, "arrow", 2, 230, 0, 0, 180}, }--add more markers here if u want. function markerscreate() for i , m in pairs (markers) do marker = createMarker (v[1],v[2],v[3],v[4]) end end addEventHandler( "onClientResourceStart", root(), markerscreate) Link to comment
n3wage Posted July 4, 2015 Share Posted July 4, 2015 this is not working because you don't have defined index, Use a loop like this: local markers = { {1368.45532, -1279.79651, 13.54688}, {777.17426, 1871.52454, 4.90737}, } function markerscreate () for index, value in ipairs ( markers ) do local mx,my,mz = unpack( markers[index] ) createMarker (mx, my, mz, "arrow", 2, 230, 0, 0, 180) end end addEventHandler( "onClientResourceStart", resourceRoot, markerscreate ) 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