- 188
- 63
- Версия MoonLoader
- .026-beta
У меня есть такой код, вопрос, как сделать так, что бы по вводу команды ставилась метка на ближайшую территорию, которая находится в таблице famzones?
Lua:
local fam_zones = {
{1245.0756835938, 2521.9340820313, 10.820300102234},
{1377.6423339844, 2558.0581054688, 10.820300102234},
{1530.2253417969, 2540.5412597656, 10.820300102234},
{1639.9075927734, 2546.1875, 10.820300102234},
{1775.1242675781, 2569.1574707031, 10.820300102234},
{1904.3698730469, 2568.2907714844, 10.820300102234},
{1971.3125, 2495.2446289063, 11.178199768066},
{2106.4838867188, 2513.3659667969, 10.820300102234},
{2271.8493652344, 2529.7958984375, 10.820300102234},
{2367.0739746094, 2548.3286132813, 10.820300102234},
{2484.4758300781, 2509.4750976563, 21.880100250244},
{2593.3864746094, 2480.0715332031, 10.820300102234},
{1305.4190673828, 2354.8278808594, 10.820300102234},
{1409.4361572266, 2343.1748046875, 10.820300102234},
{1504.3748779297, 2363.6315917969, 10.820300102234},
{1676.8702392578, 2358.7233886719, 10.820300102234},
{1747.8605957031, 2350.5095214844, 10.828100204468},
{1888.0512695313, 2395.5412597656, 11.178199768066},
{2014.9621582031, 2380.1115722656, 10.820300102234},
{2177.2053222656, 2379.6142578125, 10.820300102234},
{2277.7419433594, 2342.3488769531, 10.820300102234},
{2364.416015625, 2382.9560546875, 10.820300102234},
{2517.7490234375, 2334.6147460938, 10.820300102234},
{2637.3259277344, 2352.0290527344, 10.820300102234},
{1306.310546875, 2222.9750976563, 11.023400306702},
{1365.8634033203, 2223.091796875, 11.023400306702},
{1480.2552490234, 2213.4929199219, 11.023400306702},
{1664.3426513672, 2206.482421875, 10.820300102234},
{1751.6616210938, 2203.1511230469, 10.820300102234},
{1937.7974853516, 2307.3674316406, 10.820300102234},
{2043.9991455078, 2292.8840332031, 10.820300102234},
{2162.3725585938, 2231.2775878906, 10.820300102234},
{2236.9599609375, 2235.9892578125, 10.820300102234},
{2348.4553222656, 2261.7629394531, 8.1478004455566},
{2535.541015625, 2250.2392578125, 10.820300102234},
{2601.7788085938, 2213.2136230469, 10.820300102234},
{1313.3201904297, 2085.3244628906, 10.812700271606},
{1417.4935302734, 2091.9184570313, 11.016699790955},
{1480.8618164063, 2110.0280761719, 11.023400306702},
{1663.1033935547, 2134.3303222656, 10.820300102234},
{1770.0413818359, 2105.4792480469, 10.823499679565},
{1843.9016113281, 2095.9645996094, 10.820300102234},
{2042.1423339844, 2122.7888183594, 10.820300102234},
{2108.1848144531, 2149.5966796875, 10.820300102234},
{2252.3701171875, 2161.8852539063, 10.820300102234},
{2369.4704589844, 2120.921875, 10.840000152588},
{2557.61328125, 2101.4113769531, 10.815400123596},
{2601.9670410156, 2091.9614257813, 10.821499824524},
{1329.1450195313, 1958.2725830078, 10.820300102234},
{1392.7108154297, 2006.2274169922, 10.820300102234},
{1562.0900878906, 2002.5571289063, 10.820300102234},
{1685.8216552734, 2004.8166503906, 10.820300102234},
{1752.1873779297, 2026.8989257813, 10.820300102234},
{1922.1884765625, 2020.9283447266, 10.8125},
{2030.7192382813, 2046.1719970703, 11.057900428772},
{2169.1945800781, 1970.6434326172, 10.820300102234},
{2218.4987792969, 2007.9858398438, 10.820300102234},
{2408.4133300781, 2016.1817626953, 10.820300102234},
{2529.2534179688, 2024.2392578125, 11.182499885559},
{2665.9111328125, 2012.4017333984, 10.828100204468},
{1342.7017822266, 1885.0229492188, 10.820300102234},
{1442.5372314453, 1888.0239257813, 10.820300102234},
{1508.3708496094, 1882.8322753906, 10.820300102234},
{1674.3702392578, 1840.7349853516, 10.820300102234},
{1743.5196533203, 1854.0592041016, 10.820300102234},
{1933.6622314453, 1815.3081054688, 12.714400291443},
{2017.4661865234, 1899.4197998047, 12.328900337219},
{2162.7263183594, 1904.8946533203, 10.8125},
{2281.6350097656, 1868.4516601563, 10.820300102234},
{2354.1635742188, 1882.8624267578, 10.671899795532},
{2542.3120117188, 1847.2442626953, 11.023400306702},
{2638.5900878906, 1841.4537353516, 11.023400306702},
{1308.0769042969, 1671.5762939453, 10.820300102234},
{1367.5679931641, 1687.7359619141, 10.820300102234},
{1563.3303222656, 1680.4539794922, 10.820300102234},
{1681.0587158203, 1722.6944580078, 10.820300102234},
{1728.9741210938, 1724.0864257813, 10.817700386047},
{1899.6354980469, 1726.0500488281, 10.820300102234},
{2046.8638916016, 1731.6120605469, 10.820300102234},
{2177.0681152344, 1718.3779296875, 11.046899795532},
{2307.9201660156, 1647.8637695313, 11.046899795532},
{2342.1613769531, 1703.7764892578, 10.820300102234},
{2470.1550292969, 1722.8751220703, 10.820300102234},
{2634.6145019531, 1716.7078857422, 11.023400306702},
{1303.9273681641, 1606.5357666016, 10.820300102234},
{1367.7915039063, 1579.7379150391, 10.820300102234},
{1503.580078125, 1575.1273193359, 10.820300102234},
{1672.4946289063, 1566.4660644531, 10.770400047302},
{1734.6130371094, 1561.921875, 10.820300102234},
{1893.1798095703, 1596.4073486328, 10.539999961853},
{2037.33984375, 1600.7545166016, 10.820300102234},
{2125.4631347656, 1573.1697998047, 10.820300102234},
{2298.0554199219, 1570.1790771484, 11.046899795532},
{2371.81640625, 1602.7303466797, 10.820300102234},
{2499.5319824219, 1622.8746337891, 10.820300102234},
{2594.7348632813, 1618.5783691406, 10.820300102234},
{1278.9794921875, 1503.9267578125, 10.820300102234},
{1367.4929199219, 1441.5504150391, 10.820300102234},
{1502.8361816406, 1447.7661132813, 10.834500312805},
{1598.1248779297, 1450.4155273438, 10.828100204468},
{1725.6114501953, 1442.6324462891, 10.802800178528},
{1907.3165283203, 1444.6495361328, 10.820300102234},
{1968.7984619141, 1401.6138916016, 9.2578001022339},
{2178.9772949219, 1450.9591064453, 10.820300102234},
{2233.1694335938, 1448.7192382813, 11.054699897766},
{2377.0412597656, 1430.5694580078, 10.820300102234},
{2453.6455078125, 1419.0955810547, 10.906299591064},
{2622.0524902344, 1459.3699951172, 10.830300331116},
{1290.8389892578, 1257.9187011719, 10.820300102234},
{1367.5250244141, 1292.6046142578, 10.820300102234},
{1502.9479980469, 1311.8677978516, 10.861100196838},
{1670.1267089844, 1327.2960205078, 10.754599571228},
{1741.2958984375, 1284.0961914063, 10.836899757385},
{1867.4093017578, 1284.5666503906, 10.820300102234},
{1975.2985839844, 1264.1256103516, 10.820300102234},
{2177.0881347656, 1292.0786132813, 10.820300102234},
{2238.3557128906, 1293.4400634766, 10.820300102234},
{2418.2495117188, 1299.7308349609, 10.820300102234},
{2492.4313964844, 1324.771484375, 10.820300102234},
{2610.7712402344, 1292.6728515625, 10.820300102234},
{1321.9283447266, 1153.0766601563, 10.820300102234},
{1380.6049804688, 1154.3581542969, 10.820300102234},
{1541.9670410156, 1120.6960449219, 10.820300102234},
{1672.7612304688, 1177.8402099609, 10.820300102234},
{1752.515625, 1145.7247314453, 10.820300102234},
{1896.6508789063, 1164.8088378906, 10.820300102234},
{2007.8129882813, 1173.3646240234, 10.820300102234},
{2114.001953125, 1139.8425292969, 10.820300102234},
{2294.390625, 1181.3239746094, 10.820300102234},
{2361.6262207031, 1166.3442382813, 10.820300102234},
{2516.8037109375, 1179.4337158203, 10.822199821472},
{2597.9477539063, 1170.8250732422, 10.820300102234},
{1302.7882080078, 1068.4019775391, 10.820300102234},
{1429.8806152344, 1044.9764404297, 10.812999725342},
{1557.8602294922, 1007.290222168, 10.8125},
{1635.0251464844, 1038.6553955078, 10.820300102234},
{1732.0224609375, 1049.0081787109, 10.820300102234},
{1858.4586181641, 1035.2294921875, 10.820300102234},
{1991.0180664063, 987.59619140625, 10.812700271606},
{2187.6662597656, 1003.1644287109, 10.820300102234},
{2299.1203613281, 1050.9929199219, 10.820300102234},
{2386.8171386719, 1041.3935546875, 10.820300102234},
{2461.2087402344, 1004.2971801758, 10.820300102234},
{2592.4650878906, 1082.7576904297, 10.820300102234},
{1315.1932373047, 914.74407958984, 9.8990001678467},
{1405.9516601563, 935.28430175781, 10.820300102234},
{1540.9268798828, 922.62548828125, 10.820300102234},
{1672.8619384766, 915.90570068359, 10.717599868774},
{1749.5225830078, 913.5908203125, 10.712100028992},
{1882.4613037109, 921.20330810547, 10.820300102234},
{2012.3764648438, 921.1904296875, 10.820300102234},
{2176.9326171875, 924.87652587891, 11.099499702454},
{2267.7587890625, 938.92437744141, 10.822099685669},
{2391.5363769531, 958.33392333984, 10.820300102234},
{2513.5170898438, 962.17291259766, 10.820300102234},
{2688.3374023438, 909.18029785156, 10.691200256348}
}
local famzones = {}
-- где то в main
sampRegisterChatCommand('fz', cmd_fz)
-- onShowDialog
if title:find("Список территорий вашей семьи") then
for line in text:gmatch("[^\n]+") do
if line:find("%[%d+%] Территория №(%d+)") then
count = line:match("%[%d+%] Территория №(%d+)")
famzones[tonumber(count)] = fam_zones[tonumber(count)] or { -1, -1, -1 }
print('Номер: ',tonumber(count), 'Координаты: ',table.concat(famzones[tonumber(count)], ','))
end
end
end