yMassai Posted July 14, 2012 Share Posted July 14, 2012 local markers = { {1824.73217,-1852.47290,12.41406} {1824.53881,1675.97546,12.38281} {1855.18969,-1405.53662,12.39062} {1661.61486,-1295.06185,13,43967} } function Marca () x, y, z = busmakers () MarkerB = createMarker ( x, y, z, "cylinder", 2.0, 255, 255, 0, 85, localPlayer ) Blip = createBlipAttachedTo ( MarkerB, 51, localPlayer ) end addEventHandler ( "createMarcaEvent", root, Marca ) I want to create not random marks, which obey the order posted. exemple : 1 {1824.73217,-1852.47290,12.41406}, 2 {1824.53881,1675.97546,12.38281}, ... Link to comment
HunT Posted July 14, 2012 Share Posted July 14, 2012 What is this? Is totally wrong function Marca () x, y, z = busmakers () MarkerB = createMarker ( x, y, z, "cylinder", 2.0, 255, 255, 0, 85, localPlayer ) Blip = createBlipAttachedTo ( MarkerB, 51, localPlayer ) end addEventHandler ( "createMarcaEvent", root, Marca ) x, y, z = busmakers () ????? createMarcaEvent ????? Where u look this examples. Link to comment
yMassai Posted July 14, 2012 Author Share Posted July 14, 2012 local markers = { {1824.73217,-1852.47290,12.41406} {1824.53881,1675.97546,12.38281} {1855.18969,-1405.53662,12.39062} {1661.61486,-1295.06185,13,43967} } function busmakers () return unpack (markers [ math.random ( #markers ) ] ) end addEvent ( "createMarcaEvent", true ) function Marca () x, y, z = busmakers () MarkerB = createMarker ( x, y, z, "cylinder", 2.0, 255, 255, 0, 85, localPlayer ) Blip = createBlipAttachedTo ( MarkerB, 51, localPlayer ) end addEventHandler ( "createMarcaEvent", root, Marca ) sorry did not put the event 'function busmakers () return unpack (markers [ math.random ( #markers ) ] ) end' how can I use on a non-random? Link to comment
Castillo Posted July 14, 2012 Share Posted July 14, 2012 By "non-random" you mean like a route? P.S: local markers = { {1824.73217,-1852.47290,12.41406} {1824.53881,1675.97546,12.38281} {1855.18969,-1405.53662,12.39062} {1661.61486,-1295.06185,13,43967} } You have missing commas after each item. Link to comment
yMassai Posted July 14, 2012 Author Share Posted July 14, 2012 local busmarkers = { {1824.73217,-1852.47290,12.41406} {1824.53881,1675.97546,12.38281} {1855.18969,-1405.53662,12.39062} {1661.61486,-1295.06185,13.43967} } my lack of attention. would be a route to the bus driver. Link to comment
Castillo Posted July 14, 2012 Share Posted July 14, 2012 You can make a Lua table and store player current marker index. Link to comment
Castillo Posted July 14, 2012 Share Posted July 14, 2012 I'll show you a small example. --Global: players = { } --In your create marker function: players [ playerElement ] = tableIndex Link to comment
yMassai Posted July 14, 2012 Author Share Posted July 14, 2012 sorry did not quite understand if you do not care to explain further. I like to take my doubts. you do not need to explain if you want. Link to comment
Castillo Posted July 14, 2012 Share Posted July 14, 2012 players = { } That would be the table where we'll store each player element and the current index of the table. players [ playerElement ] = 1 This would store a player element with the table index as 1, then you can do this: local index = players [ playerElement ] local x, y, z = unpack ( markers [ index ] ) 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