координаты метки

yoshishi

Новичок
Автор темы
14
0
Версия MoonLoader
.027.0-preview
How do I get the coordinates of the blip? (not the target blip)
 

ChromiusJ

PARΛDIGM ΛSS
Друг
4,907
3,196
local x, y, z = getTargetBlipCoordinates()
1705086024019.png
 

Tectrex

Активный
97
101
Я вот сижу думаю, какой еще блип но не таргет... чекпоинт на карте может имелось ввиду??
Функция не моя. от

SR_team


Код:
function SearchCheckpoint(posX, posY, posZ, radius, isRace)
    local ret_posX, ret_posY, ret_posZ, isFind = 0.0, 0.0, 0.0, false

    for id = 0, 31 do
        local CheckpointStruct = isRace and 0xC7F168 + id * 56 or 0xC7DD88 + id * 160
        local CheckpointPosX, CheckpointPosY, CheckpointPosZ = representIntAsFloat(readMemory(CheckpointStruct + 0, 4, false)), representIntAsFloat(readMemory(CheckpointStruct + 4, 4, false)), representIntAsFloat(readMemory(CheckpointStruct + 8, 4, false))

        if CheckpointPosX ~= 0.0 or CheckpointPosY ~= 0.0 or CheckpointPosZ ~= 0.0 then
            local distance = getDistanceBetweenCoords3d(CheckpointPosX, CheckpointPosY, CheckpointPosZ, posX, posY, posZ)
            if distance < radius then
                ret_posX, ret_posY, ret_posZ, isFind, radius = CheckpointPosX, CheckpointPosY, CheckpointPosZ, true, distance
            end
        end
    end

    return isFind, ret_posX, ret_posY, ret_posZ
end

require 'lib.moonloader'

function main()
    while not isSampAvailable() do wait(0) end
   
    while true do
        wait(0)
        local result, x, y, z = SearchCheckpoint(posX, posY, posZ, 3000, false)
        if result then
            sampAddChatMessage(string.format("Blip/Checkpoint on: %.2f %.2f %.2f", x, y, z), -1)
        end
    end
end