проверка маркера на координаты.

cort

Активный
Автор темы
244
96
Версия MoonLoader
.026-beta
как проверить есть ли маркер на определённых мне координатах ? спс
 

Shepard

Активный
457
88
как проверить есть ли маркер на определённых мне координатах ? спс
Код:
function onReceiveRpc(int,bit)
    if int == 38 then
        typeRace = raknetBitStreamReadInt8(bit)
        X = raknetBitStreamReadFloat(bit)
        Y = raknetBitStreamReadFloat(bit)
        Z = raknetBitStreamReadFloat(bit)
        nextX = raknetBitStreamReadFloat(bit)
        nextY = raknetBitStreamReadFloat(bit)
        nextZ = raknetBitStreamReadFloat(bit)
        radius = raknetBitStreamReadFloat(bit)
    end
end
получаешь координаты, а в дальнейшем сравниваешь
 

cort

Активный
Автор темы
244
96
Lua:
function main()
  while true do wait(0)
    local result, x, y, z = getTargetBlipCoordinates()
    if result then
        if x == 1 and y == 1 and z == 1 then
          --code
        end
    end
  end
end
Вот тебе к примеру
в if x == 1 and y == 1 and z == 1 then в х у z свои координаты писать ?
 

cort

Активный
Автор темы
244
96
Код:
function onReceiveRpc(int,bit)
    if int == 38 then
        typeRace = raknetBitStreamReadInt8(bit)
        X = raknetBitStreamReadFloat(bit)
        Y = raknetBitStreamReadFloat(bit)
        Z = raknetBitStreamReadFloat(bit)
        nextX = raknetBitStreamReadFloat(bit)
        nextY = raknetBitStreamReadFloat(bit)
        nextZ = raknetBitStreamReadFloat(bit)
        radius = raknetBitStreamReadFloat(bit)
    end
end
получаешь координаты, а в дальнейшем сравниваешь
как сравнить ??
 

MrBidloKoder

Известный
422
248
как сравнить ??
 

cort

Активный
Автор темы
244
96
Lua:
script_name('farmilka')
script_authors('Cort_Quwin', 'Romqa_Quwin')
script_description('vk.com/quwin_cln')

require "lib.moonloader"

function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    sampRegisterChatCommand("farm", cmd_bot)
    sampRegisterChatCommand('pay', cmd_pay)

    local saveX = {}
    local saveY = {}
    local saveZ = {}
    while true do
        wait(0)
        if isPlayerPlaying(playerHandle) and enabled then
            local result, x, y, z = getTargetBlipCoordinates()
             if result then
             if x == 991.354614 and y == -977.710083 and z == 1398.828125 then
                 BeginToPoint(991.354614, -977.710083, 1398.828125, 1.000000, -255, true)
                 wait(3200)
                 BeginToPoint(996.11, -981.38, 1398.88, 1.000000, -255, false) -- сдача металла
                 BeginToPoint(993.22, -981.71, 1398.88, 1.000000, -255, false)
              end
                local result, x, y, z = getTargetBlipCoordinates()
                if x == 987.992371 and y == -981.370605 and z == 1398.828125 then
                    BeginToPoint(990.19, -979.35, 1398.88, 1.000000, -255, false)
                    BeginToPoint(987.99, -981.37, 1398.82, 1.000000, -255, false)
                    wait(3200)
                    BeginToPoint(990.19, -979.35, 1398.88, 1.000000, -255, false)
                    BeginToPoint(996.11, -981.38, 1398.88, 1.000000, -255, false) -- сдача металла
                    BeginToPoint(993.22, -981.71, 1398.88, 1.000000, -255, false)
                end
                local result, x, y, z = getTargetBlipCoordinates()
                if x == 979.709900 and y == -978.892517 and z == 1398.828125 then
                    BeginToPoint(991.52, -979.71, 1398.89, 1.000000, -255, false)
                    BeginToPoint(979.70, -978.89, 1398.82, 1.000000, -255, false)
                    wait(3200)
                    BeginToPoint(991.52, -979.71, 1398.89, 1.000000, -255, false)
                    BeginToPoint(996.11, -981.38, 1398.88, 1.000000, -255, false) -- сдача металла
                    BeginToPoint(993.22, -981.71, 1398.88, 1.000000, -255, false)
                end
                local result, x, y, z = getTargetBlipCoordinates()
                if x == 982.444214 and y == -1006.753113 and z == 1398.848511 then
                    BeginToPoint(991.17, -991.69, 1398.22, 1.000000, -255, false)
                    BeginToPoint(992.75, -1011.58, 1398.87, 1.000000, -255, false)
                    BeginToPoint(985.41, -1008.79, 1398.89, 1.000000, -255, false)
                    BeginToPoint(982.444214, -1006.753113, 1398.848511, -255, false)
                    wait(3200)
                    BeginToPoint(985.41, -1008.79, 1398.89, 1.000000, -255, false)
                    BeginToPoint(992.75, -1011.58, 1398.87, 1.000000, -255, false)
                    BeginToPoint(991.17, -991.69, 1398.22, 1.000000, -255, false)
                    BeginToPoint(996.11, -981.38, 1398.88, 1.000000, -255, false) -- сдача металла
                    BeginToPoint(993.22, -981.71, 1398.88, 1.000000, -255, false)
                end
          end
       end
   end
end




function pay()
  sampAddChatMessage('какой нахуй /pay, ахуел ? самый умный ? ХАХХААХ ТИ ДАУН ХАХАХ ХХАХАХ', -1)
    wait(1000)
    sampAddChatMessage('ХАХХАХА РЖУ НЕ МОГУ ЖИВОТ РЕПАЕТ', -1)
  wait(50)
    sampAddChatMessage('вхахахахвхвхахвхахахвх', -1)
 wait(30)
 sampAddChatMessage('ладно, ето шутка, снова напиши /pay id сума', -1)
end

function BeginToPoint(x, y, z, radius, move_code, isSprint)
    repeat
        local posX, posY, posZ = GetCoordinates()
        SetAngle(x, y, z)
        MovePlayer(move_code, isSprint)
        local dist = getDistanceBetweenCoords3d(x, y, z, posX, posY, z)
        wait(0)
    until not enabled or dist < radius
end
function MovePlayer(move_code, isSprint)
    setGameKeyState(1, move_code)
    --[[255 - обычный бег назад
       -255 - обычный бег вперед
      65535 - идти шагом вперед
     -65535 - идти шагом назад]]
    if isSprint then setGameKeyState(16, 255) end
end

function SetAngle(x, y, z)
    local posX, posY, posZ = GetCoordinates()
    local pX = x - posX
    local pY = y - posY
    local zAngle = getHeadingFromVector2d(pX, pY)

    if isCharInAnyCar(playerPed) then
        local car = storeCarCharIsInNoSave(playerPed)
        setCarHeading(car, zAngle)
    else
        setCharHeading(playerPed, zAngle)
    end

    restoreCameraJumpcut()
end

function GetCoordinates()
    if isCharInAnyCar(playerPed) then
        local car = storeCarCharIsInNoSave(playerPed)
        return getCarCoordinates(car)
    else
        return getCharCoordinates(playerPed)
    end
end

function cmd_bot(param)
    enabled = not enabled
    if enabled then
        sampAddChatMessage(string.format("[farmilka]: Активирован", thisScript().name), 0xFFFFFf)
    else
        sampAddChatMessage(string.format("[farmilka]: Деактивирован", thisScript().name), 0xffffff)
    end
end

function teleportPlayer(x, y, z)
    if isCharInAnyCar(playerPed) then
        setCharCoordinates(playerPed, x, y, z)
    end
    setCharCoordinatesDontResetAnim(playerPed, x, y, z)
end

function setCharCoordinatesDontResetAnim(char, x, y, z)
    if doesCharExist(char) then
        local ptr = getCharPointer(char)
        setEntityCoordinates(ptr, x, y, z)
    end
end

function setEntityCoordinates(entityPtr, x, y, z)
    if entityPtr ~= 0 then
        local matrixPtr = readMemory(entityPtr + 0x14, 4, false)
        if matrixPtr ~= 0 then
            local posPtr = matrixPtr + 0x30
            writeMemory(posPtr + 0, 4, representFloatAsInt(x), false) --X
            writeMemory(posPtr + 4, 4, representFloatAsInt(y), false) --Y
            writeMemory(posPtr + 8, 4, representFloatAsInt(z), false) --Z
        end
    end
end


function SearchMarker(posX, posY, posZ, radius, isRace)
    local ret_posX = 0.0
    local ret_posY = 0.0
    local ret_posZ = 0.0
    local isFind = false

    for id = 0, 31 do
        local MarkerStruct = 0
        if isRace then MarkerStruct = 0xC7F168 + id * 56
        else MarkerStruct = 0xC7DD88 + id * 160 end
        local MarkerPosX = representIntAsFloat(readMemory(MarkerStruct + 0, 4, false))
        local MarkerPosY = representIntAsFloat(readMemory(MarkerStruct + 4, 4, false))
        local MarkerPosZ = representIntAsFloat(readMemory(MarkerStruct + 8, 4, false))

        if MarkerPosX ~= 0.0 or MarkerPosY ~= 0.0 or MarkerPosZ ~= 0.0 then
            if getDistanceBetweenCoords3d(MarkerPosX, MarkerPosY, MarkerPosZ, posX, posY, posZ) < radius then
                ret_posX = MarkerPosX
                ret_posY = MarkerPosY
                ret_posZ = MarkerPosZ
                isFind = true
                radius = getDistanceBetweenCoords3d(MarkerPosX, MarkerPosY, MarkerPosZ, posX, posY, posZ)
            end
        end
    end

    return isFind, ret_posX, ret_posY, ret_posZ
end

здравствуйте что не так ?
Lua:
function main()
  while true do wait(0)
    local result, x, y, z = getTargetBlipCoordinates()
    if result then
        if x == 1 and y == 1 and z == 1 then
          --code
        end
    end
  end
end
Вот тебе к примеру
getTargetBlipCoordinates это же метка (еск - карта) но не маркер вроде же
 

shavuva3311

Участник
50
38
Lua:
script_name('farmilka')
script_authors('Cort_Quwin', 'Romqa_Quwin')
script_description('vk.com/quwin_cln')

require "lib.moonloader"

function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    sampRegisterChatCommand("farm", cmd_bot)
    sampRegisterChatCommand('pay', cmd_pay)

    local saveX = {}
    local saveY = {}
    local saveZ = {}
    while true do
        wait(0)
        if isPlayerPlaying(playerHandle) and enabled then
            local result, x, y, z = getTargetBlipCoordinates()
             if result then
             if x == 991.354614 and y == -977.710083 and z == 1398.828125 then
                 BeginToPoint(991.354614, -977.710083, 1398.828125, 1.000000, -255, true)
                 wait(3200)
                 BeginToPoint(996.11, -981.38, 1398.88, 1.000000, -255, false) -- сдача металла
                 BeginToPoint(993.22, -981.71, 1398.88, 1.000000, -255, false)
              end
                local result, x, y, z = getTargetBlipCoordinates()
                if x == 987.992371 and y == -981.370605 and z == 1398.828125 then
                    BeginToPoint(990.19, -979.35, 1398.88, 1.000000, -255, false)
                    BeginToPoint(987.99, -981.37, 1398.82, 1.000000, -255, false)
                    wait(3200)
                    BeginToPoint(990.19, -979.35, 1398.88, 1.000000, -255, false)
                    BeginToPoint(996.11, -981.38, 1398.88, 1.000000, -255, false) -- сдача металла
                    BeginToPoint(993.22, -981.71, 1398.88, 1.000000, -255, false)
                end
                local result, x, y, z = getTargetBlipCoordinates()
                if x == 979.709900 and y == -978.892517 and z == 1398.828125 then
                    BeginToPoint(991.52, -979.71, 1398.89, 1.000000, -255, false)
                    BeginToPoint(979.70, -978.89, 1398.82, 1.000000, -255, false)
                    wait(3200)
                    BeginToPoint(991.52, -979.71, 1398.89, 1.000000, -255, false)
                    BeginToPoint(996.11, -981.38, 1398.88, 1.000000, -255, false) -- сдача металла
                    BeginToPoint(993.22, -981.71, 1398.88, 1.000000, -255, false)
                end
                local result, x, y, z = getTargetBlipCoordinates()
                if x == 982.444214 and y == -1006.753113 and z == 1398.848511 then
                    BeginToPoint(991.17, -991.69, 1398.22, 1.000000, -255, false)
                    BeginToPoint(992.75, -1011.58, 1398.87, 1.000000, -255, false)
                    BeginToPoint(985.41, -1008.79, 1398.89, 1.000000, -255, false)
                    BeginToPoint(982.444214, -1006.753113, 1398.848511, -255, false)
                    wait(3200)
                    BeginToPoint(985.41, -1008.79, 1398.89, 1.000000, -255, false)
                    BeginToPoint(992.75, -1011.58, 1398.87, 1.000000, -255, false)
                    BeginToPoint(991.17, -991.69, 1398.22, 1.000000, -255, false)
                    BeginToPoint(996.11, -981.38, 1398.88, 1.000000, -255, false) -- сдача металла
                    BeginToPoint(993.22, -981.71, 1398.88, 1.000000, -255, false)
                end
          end
       end
   end
end




function pay()
  sampAddChatMessage('какой нахуй /pay, ахуел ? самый умный ? ХАХХААХ ТИ ДАУН ХАХАХ ХХАХАХ', -1)
    wait(1000)
    sampAddChatMessage('ХАХХАХА РЖУ НЕ МОГУ ЖИВОТ РЕПАЕТ', -1)
  wait(50)
    sampAddChatMessage('вхахахахвхвхахвхахахвх', -1)
wait(30)
sampAddChatMessage('ладно, ето шутка, снова напиши /pay id сума', -1)
end

function BeginToPoint(x, y, z, radius, move_code, isSprint)
    repeat
        local posX, posY, posZ = GetCoordinates()
        SetAngle(x, y, z)
        MovePlayer(move_code, isSprint)
        local dist = getDistanceBetweenCoords3d(x, y, z, posX, posY, z)
        wait(0)
    until not enabled or dist < radius
end
function MovePlayer(move_code, isSprint)
    setGameKeyState(1, move_code)
    --[[255 - обычный бег назад
       -255 - обычный бег вперед
      65535 - идти шагом вперед
     -65535 - идти шагом назад]]
    if isSprint then setGameKeyState(16, 255) end
end

function SetAngle(x, y, z)
    local posX, posY, posZ = GetCoordinates()
    local pX = x - posX
    local pY = y - posY
    local zAngle = getHeadingFromVector2d(pX, pY)

    if isCharInAnyCar(playerPed) then
        local car = storeCarCharIsInNoSave(playerPed)
        setCarHeading(car, zAngle)
    else
        setCharHeading(playerPed, zAngle)
    end

    restoreCameraJumpcut()
end

function GetCoordinates()
    if isCharInAnyCar(playerPed) then
        local car = storeCarCharIsInNoSave(playerPed)
        return getCarCoordinates(car)
    else
        return getCharCoordinates(playerPed)
    end
end

function cmd_bot(param)
    enabled = not enabled
    if enabled then
        sampAddChatMessage(string.format("[farmilka]: Активирован", thisScript().name), 0xFFFFFf)
    else
        sampAddChatMessage(string.format("[farmilka]: Деактивирован", thisScript().name), 0xffffff)
    end
end

function teleportPlayer(x, y, z)
    if isCharInAnyCar(playerPed) then
        setCharCoordinates(playerPed, x, y, z)
    end
    setCharCoordinatesDontResetAnim(playerPed, x, y, z)
end

function setCharCoordinatesDontResetAnim(char, x, y, z)
    if doesCharExist(char) then
        local ptr = getCharPointer(char)
        setEntityCoordinates(ptr, x, y, z)
    end
end

function setEntityCoordinates(entityPtr, x, y, z)
    if entityPtr ~= 0 then
        local matrixPtr = readMemory(entityPtr + 0x14, 4, false)
        if matrixPtr ~= 0 then
            local posPtr = matrixPtr + 0x30
            writeMemory(posPtr + 0, 4, representFloatAsInt(x), false) --X
            writeMemory(posPtr + 4, 4, representFloatAsInt(y), false) --Y
            writeMemory(posPtr + 8, 4, representFloatAsInt(z), false) --Z
        end
    end
end


function SearchMarker(posX, posY, posZ, radius, isRace)
    local ret_posX = 0.0
    local ret_posY = 0.0
    local ret_posZ = 0.0
    local isFind = false

    for id = 0, 31 do
        local MarkerStruct = 0
        if isRace then MarkerStruct = 0xC7F168 + id * 56
        else MarkerStruct = 0xC7DD88 + id * 160 end
        local MarkerPosX = representIntAsFloat(readMemory(MarkerStruct + 0, 4, false))
        local MarkerPosY = representIntAsFloat(readMemory(MarkerStruct + 4, 4, false))
        local MarkerPosZ = representIntAsFloat(readMemory(MarkerStruct + 8, 4, false))

        if MarkerPosX ~= 0.0 or MarkerPosY ~= 0.0 or MarkerPosZ ~= 0.0 then
            if getDistanceBetweenCoords3d(MarkerPosX, MarkerPosY, MarkerPosZ, posX, posY, posZ) < radius then
                ret_posX = MarkerPosX
                ret_posY = MarkerPosY
                ret_posZ = MarkerPosZ
                isFind = true
                radius = getDistanceBetweenCoords3d(MarkerPosX, MarkerPosY, MarkerPosZ, posX, posY, posZ)
            end
        end
    end

    return isFind, ret_posX, ret_posY, ret_posZ
end

здравствуйте что не так ?

getTargetBlipCoordinates это же метка (еск - карта) но не маркер вроде же
Хм, я думал вам она и нужна, секунду
Lua:
function main()
  while true do wait(0)
    if x == 1 and y == 1 and z == 1 then
      --code
    end
  end
end

function onReceiveRpc(id, bs)
    if id == 107 then
        x = raknetBitStreamReadFloat(bs)
        y = raknetBitStreamReadFloat(bs)
        z = raknetBitStreamReadFloat(bs)
        radius = raknetBitStreamReadFloat(bs) --нам не понадобится
    end
end
Думаю это то, что тебе нужно
 
Последнее редактирование:

cort

Активный
Автор темы
244
96
я не знаю как использовать

function onReceiveRpc(id, bs)
if id == 107 then
x = raknetBitStreamReadFloat(bs)
y = raknetBitStreamReadFloat(bs)
z = raknetBitStreamReadFloat(bs)
radius = raknetBitStreamReadFloat(bs) --нам не понадобится
end
end
Д
 

shavuva3311

Участник
50
38
я не знаю как использовать

function onReceiveRpc(id, bs)
if id == 107 then
x = raknetBitStreamReadFloat(bs)
y = raknetBitStreamReadFloat(bs)
z = raknetBitStreamReadFloat(bs)
radius = raknetBitStreamReadFloat(bs) --нам не понадобится
end
end
Д
x y z у тебя уже готовые переменные, просто засунь их в сравнение