KariiiM Posted August 9, 2015 Posted August 9, 2015 Hey, i tried to make the reward distance between markers positions but i failed, thanks in advance --Part of my code: local markerlocations = { [1]={x=2220.43, y=2469.49, z=10.82}, [2]={x=1625.00, y=1850.43, z=10.82}, [3]={x= 1718.26, y=1484.68, z=10.82} } local theTable = { [1]={"LV", 2220.43, 2469.49, 11.82}, [2]={"LS", 1625.00, 1850.43, 11.82}, [3]={"SF", -2682.52, 574.32, 15.67} } addEventHandler("onResourceStart",resourceRoot, function () local px, py, pz = getElementPosition(source) local miniumDistance = 2000 for index, pos in pairs(markerlocations) do local marker = createMarker(pos.x, pos.y, pos.z-1, "cylinder", 1.3, 247,187, 7, 120) local x, y = pos[1], pos[2] local distance = getDistanceBetweenPoints2D(px, py, x, y) if (distance < miniumDistance) then miniumDistance = distance end end end)
Malak Posted August 9, 2015 Posted August 9, 2015 Why did you put it on onResourceStart ? your source of your event is the resource which is started, not even a player on an another element. Please explain what you really want.
KariiiM Posted August 9, 2015 Author Posted August 9, 2015 Between marker and marker there's an distance ,so i want to use this "distance" as numbers and it will remplace the price.
Malak Posted August 9, 2015 Posted August 9, 2015 if you want the position about 2 marker u have to save position data of ur both marker in var then compare it with getDistanceBetweenPoints2D.
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