MAB Posted July 12, 2015 Posted July 12, 2015 i don't know how to make mta create one of these markers randomly when an event happens.. and on the hit one of the other two will be created and the old one get destroyed i tried and failed so i deleted the old code and i am here for help markers = { marker1 = createMarker ( 1640.04163, -2451.72778, 12.55469, "cylinder", 1.5, 255, 255, 0, 170 ), marker2 = createMarker ( -1641.87573, -183.24684, 13.14844, "cylinder", 1.5, 255, 255, 0, 170 ), marker3 = createMarker ( 1566.22876, 1498.72900, 9.83527, "cylinder", 1.5, 255, 255, 0, 170 ) } You can find me here.
GTX Posted July 12, 2015 Posted July 12, 2015 Put your positions like that in a table. markers = { {1640.04163, -2451.72778, 12.55469}, {-1641.87573, -183.24684, 13.14844}, {1566.22876, 1498.72900, 9.83527} } Use math.random to get random position. pos = markers[math.random(1, #markers)] And then create a marker. marker = createMarker(pos[1], pos[2], pos[3], "cylinder", 1.5, 255, 255, 0, 170) Use onClientMarkerHit and destroy previous marker and repeat step from the start. Continue from there by yourself. Do you require a paid scripter? Contact me! (Unavailable) Currently I am experienced in Lua, PHP, HTML, CSS, SQL and JS. Developer and owner of https://projectbea.st - Project Beast
WASSIm. Posted July 13, 2015 Posted July 13, 2015 Put your positions like that in a table. Use math.random to get random position. [lua]pos = markers[math.random(1, #markers)] And then create a marker. marker = createMarker(pos[1], pos[2], pos[3], "cylinder", 1.5, 255, 255, 0, 170) is better if use like this: local x, y, z = unpack(markers[math.random( #markers)]) local marker = createMarker(x, y, z, "cylinder", 1.5, 255, 255, 0, 170)
GTX Posted July 13, 2015 Posted July 13, 2015 Yeah, it's shorter but it does the same Do you require a paid scripter? Contact me! (Unavailable) Currently I am experienced in Lua, PHP, HTML, CSS, SQL and JS. Developer and owner of https://projectbea.st - Project Beast
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