Twiz. Posted November 7, 2012 Share Posted November 7, 2012 Hey Guys need help , i want to create a Marker with the Coordinates from the Table. I already did a thread like this but i was too dumb to understand . I hope you understand what i want , i want to create a little job to run into marker then go to another marker etc. . I can script everything else i want to but this is not working for me . local markerst = { <---- Table with Coordinates [1] = { 1, 1, 1}, [2] = { 2, 2, 2}, [3] = { 3, 3, 3}, } function idontgethowtodothis ( ) local x, y, z = i want the coordinates from up there ^ testarker = createMarker( x, y, z , . . . . ) addEventHandler("onMarkerHit", testarker, destroy) end function destroy() destroyElement( testarker ) end -- This is just an Example please help me : ( Link to comment
Fresku Posted November 7, 2012 Share Posted November 7, 2012 local x, y, z = markerst[1][1], markerst[1][2], markerst[1][3] Make a loop to get each of them coordinates Link to comment
Castillo Posted November 7, 2012 Share Posted November 7, 2012 Would be easier to use unpack. local x, y, z = unpack ( markerst [ 1 ] ) Link to comment
Fresku Posted November 7, 2012 Share Posted November 7, 2012 Would be easier to use unpack. local x, y, z = unpack ( markerst [ 1 ] ) Very nice... Very nice Link to comment
Twiz. Posted November 7, 2012 Author Share Posted November 7, 2012 I dont know if i´m doing something wrong but both wont work for me i dont see a Marker . Link to comment
Castillo Posted November 7, 2012 Share Posted November 7, 2012 local markerst = -- Table with Coordinates { [ 1 ] = { 1, 1, 1 }, [ 2 ] = { 2, 2, 2 }, [ 3 ] = { 3, 3, 3 }, } function idontgethowtodothis ( ) local x, y, z = unpack ( markerst [ 1 ] ) testarker = createMarker ( x, y, z ) addEventHandler ( "onMarkerHit", testarker, destroy ) end function destroy ( ) destroyElement ( testarker ) end Has to work. Link to comment
McDejan24 Posted November 7, 2012 Share Posted November 7, 2012 i have this problem 2 Link to comment
Twiz. Posted November 7, 2012 Author Share Posted November 7, 2012 local markerst = -- Table with Coordinates { [ 1 ] = { 1, 1, 1 }, [ 2 ] = { 2, 2, 2 }, [ 3 ] = { 3, 3, 3 }, } function idontgethowtodothis ( ) local x, y, z = unpack ( markerst [ 1 ] ) testarker = createMarker ( x, y, z ) addEventHandler ( "onMarkerHit", testarker, destroy ) end function destroy ( ) destroyElement ( testarker ) end Has to work. no its still not working , i tryed alot and i still dont know why its not working . I just want to script something like a job >.<. Link to comment
Castillo Posted November 7, 2012 Share Posted November 7, 2012 Post your entire script. Link to comment
Twiz. Posted November 7, 2012 Author Share Posted November 7, 2012 I did it was only this , i just wanted to test if i see the Marker. Link to comment
Castillo Posted November 7, 2012 Share Posted November 7, 2012 Oh, so you expected a function to execute on it's own? great. You must add either a command or a event handler, to test you can do this: local markerst = -- Table with Coordinates { [ 1 ] = { 1, 1, 1 }, [ 2 ] = { 2, 2, 2 }, [ 3 ] = { 3, 3, 3 }, } function idontgethowtodothis ( ) local x, y, z = unpack ( markerst [ 1 ] ) testarker = createMarker ( x, y, z ) addEventHandler ( "onMarkerHit", testarker, destroy ) end addEventHandler ( "onResourceStart", resourceRoot, idontgethowtodothis ) function destroy ( ) destroyElement ( testarker ) end Link to comment
Twiz. Posted November 7, 2012 Author Share Posted November 7, 2012 Ahh sorry, i made a command handler , forgot that >.<. 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