Jump to content

Table


WelCome

Recommended Posts

Hi,  today i wanted create "random marker position" but i have problem

table ={

['A'] = {
	{-805.34595, 743.04645, 54.34844},
	{-809.69177, 764.23022, 54.34844},
	},
['B'] = {
	{-838.24719, 731.62659, 54.34844},
	{-834.38562, 762.48022, 54.34844},
},
}

addCommandHandler("commander",function()
for i,v in pairs(table) do
local ran = math.random(1,#v)
local marker =createMarker(v[ran][1],v[ran][2],v[ran][3],"ring",3,255,0,0,255)
createBlipAttachedTo(marker,18)
end
end)

sometimes marker create on wrong position and i dont know why :/

bad = https://imgur.com/a/xhPNXw7

good = https://imgur.com/a/uiSy3Fq

Link to comment
On 6/2/2018 at 09:49, WelCome said:

i want draw the cords of 'a' or 'b'

From my understanding, are you attempting to place a random marker whenever a player does the command? If so, this should work fine.

positions = {
	[1] = {-805.34595, 743.04645, 54.34844},
	[2] = {-809.69177, 764.23022, 54.34844},
	[3] = {-838.24719, 731.62659, 54.34844},
	[4] = {-834.38562, 762.48022, 54.34844},
}

addCommandHandler("commander", function()
	local ran = math.random(1, #positions)
	local marker = createMarker(positions[ran][1], positions[ran][2], positions[ran][3], "ring", 3, 255, 0, 0, 255)
	createBlipAttachedTo(marker, 18) 
end)

 

Edited by Skully
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...