Я нуждаюсь в помощи с читом.

Runbu73

Участник
Автор темы
123
5
У меня есть чит Lua в формате mimgui, всё работает, но телепортация к контрольной точке иногда не происходит в нужное место. Например, он телепортирует меня на стадионный контрольный пункт, а мне этого не нужно. Я хочу, чтобы он телепортировался на отмеченную контрольную точку. Если кто-то может исправить это, я буду признателен и счастлив. Вот исходный код.






Lua:
require("lib.moonloader")
local imgui = require("mimgui")
local vKeys = require('vKeys')
local inicfg = require("inicfg")
local sampfuncs = require "sampfuncs"
local ffi = require "ffi"
local sW, sH = getScreenResolution()
local memory = require("memory")
local faicons = require("fAwesome5")
local events = require 'lib.samp.events'
local hack = require 'lib.samp.events'
local sampev = require 'samp.events'
local encoding = require("encoding")
local var_0_6 = require("ffi")
encoding.default = 'CP1251'
local u8 = encoding.UTF8

require 'lib.sampfuncs'

local getBonePosition = ffi.cast("int (__thiscall*)(void*, float*, int, bool)", 0x5E4280)

local font = renderCreateFont("Arial", 11, 15)

local aim = {
    renderWindow = {
        renderWindow = imgui.new.bool()
    },
    CheckBox = {
        antistun = imgui.new.bool(),
        teste11 = imgui.new.bool(),
        teste12 = imgui.new.bool(),
        teste13 = imgui.new.bool(),
        teste14 = imgui.new.bool(),
        teste15 = imgui.new.bool(),
        teste16 = imgui.new.bool(),
        teste17 = imgui.new.bool(),
        teste18 = imgui.new.bool(),
        teste19 = imgui.new.bool(),
        teste20 = imgui.new.bool(),
        
        
    },
}

function main()
    repeat wait(0) until isSampAvailable()
    wait(1000)
    sampAddChatMessage("{006400}[Farm Money | Scarllet SAMP]: {ffffff}Carregado! cmd /scarlletmoney", 0x0066ff)
    iniLoad()

    sampRegisterChatCommand("scarlletmoney", function()
        aim.renderWindow.renderWindow[0] = not aim.renderWindow.renderWindow[0]
    end)

    while true do
        wait(0)

        if res and time ~= nil then
            sampDisconnectWithReason("quit")
            wait(time * 1000)
            sampSetGamestate(1)
            res = false
        elseif res and time == nil then
            sampDisconnectWithReason("quit")
            wait(15500)
            sampSetGamestate(1)
            res = false
        end
        
        
if aim.CheckBox.teste18[0] then
    local vector3d = require("vector3d")
    local result, position = (function(position, radius, isRace)
        local result, isFind = vector3d(0, 0, 0), false
        for id = 0, 31 do
            local address = isRace and (0xC7F168 + id * 56) or (0xC7DD88 + id * 160)
            local marker = vector3d(
                representIntAsFloat(readMemory(address + 0, 4, false)),
                representIntAsFloat(readMemory(address + 4, 4, false)),
                representIntAsFloat(readMemory(address + 8, 4, false))
            )
            if marker.x ~= 0 and marker.y ~= 0 and marker.z ~= 0 then
                local distance = (marker - position):length()
                if distance < radius then
                    result = marker
                    isFind = true
                    radius = distance
                end
            end
        end
        return isFind, result
    end)(vector3d(getCharCoordinates(playerPed)), 20000, false)
    
    if result then
        setCharCoordinates(playerPed, position.x, position.y, position.z)
        sampSendChat("/mcadaver") -- Comando para marcar o corpo
        -- Teleportar para o checkpoint
        -- Substitua 'position.x', 'position.y', 'position.z' pelos valores do checkpoint se necessário
        -- setCharCoordinates(playerPed, checkpoint_x, checkpoint_y, checkpoint_z)
    end
end

            if aim.CheckBox.teste20[0] then
                 end
      

            if aim.CheckBox.teste19[0] then
    local vector3d = require("vector3d")
    local result, position = (function(position, radius, isRace)
        local result, isFind = vector3d(0, 0, 0), false
        for id = 0, 31 do
            local address = isRace and (0xC7F168 + id * 56) or (0xC7DD88 + id * 160)
            local marker = vector3d(
                representIntAsFloat(readMemory(address + 0, 4, false)),
                representIntAsFloat(readMemory(address + 4, 4, false)),
                representIntAsFloat(readMemory(address + 8, 4, false))
            )
            if marker.x ~= 0 and marker.y ~= 0 and marker.z ~= 0 then
                local distance = (marker - position):length()
                if distance < radius then
                    result = marker
                    isFind = true
                    radius = distance
                end
            end
        end
        return isFind, result
    end)(vector3d(getCharCoordinates(playerPed)), 20000, false)
    
    if result then
        setCharCoordinates(playerPed, position.x, position.y, position.z)
        sampSendChat("/embalarcadaver") -- Comando para marcar o corpo
    end
end


    if aim.CheckBox.teste17[0] then
    local vector3d = require("vector3d")

    local position = vector3d(getCharCoordinates(playerPed))
    local result, finalPosition = (function(position, radius, isRace)
        local result, isFind = vector3d(0, 0, 0), false
        for id = 0, 31 do
            local address = isRace and (0xC7F168 + id * 56) or (0xC7DD88 + id * 160)
            local marker = vector3d(
                representIntAsFloat(readMemory(address + 0, 4, false)),
                representIntAsFloat(readMemory(address + 4, 4, false)),
                representIntAsFloat(readMemory(address + 8, 4, false))
            )
            if marker.x ~= 0 and marker.y ~= 0 and marker.z ~= 0 then
                local distance = (marker - position):length()
                if distance < radius then
                    result = marker
                    isFind = true
                    radius = distance
                end
            end
        end
        return isFind, result
    end)(position, 20000, true)

    if result then
        setCharCoordinates(playerPed, finalPosition.x, finalPosition.y, finalPosition.z)
    end

    wait(100) -- Espera 100 milissegundos antes de continuar com a próxima iteração
end

   if aim.CheckBox.teste14[0] then
    local vector3d = require("vector3d")
    local result, position = (function(position, radius, isRace)
        local result, isFind = vector3d(0, 0, 0), false
        for id = 0, 31 do
            local address = isRace and (0xC7F168 + id * 56) or (0xC7DD88 + id * 160)
            local marker = vector3d(
                representIntAsFloat(readMemory(address + 0, 4, false)),
                representIntAsFloat(readMemory(address + 4, 4, false)),
                representIntAsFloat(readMemory(address + 8, 4, false))
            )
            if marker.x ~= 0 and marker.y ~= 0 and marker.z ~= 0 then
                local distance = (marker - position):length()
                if distance < radius then
                    result = marker
                    isFind = true
                    radius = distance -- Esta linha estava sobrescrevendo o raio aqui, isso estava causando um problema
                end
            end
        end
        return isFind, result
    end)(vector3d(getCharCoordinates(playerPed)), 20000, false)
    if result then
        setCharCoordinates(playerPed, position.x, position.y, position.z)
    end
end
wait(1000) -- Espera 100 milissegundos antes de continuar com a próxima iteração


            
            
             if aim.CheckBox.teste13[0] then
    result,x,y,z = getTargetBlipCoordinates()
        x2 = ("%.3f"):format(x)
        y2 = ("%.3f"):format(y)
        z2 = ("%.3f"):format(z)
        if not result then
            check = false
            x1, y1, z1 = x, y, z
        end
        if result then
            if check == false then
                 setCharCoordinates(PLAYER_PED,x,y,z)
                 check = true
                 wait(300)
                 sampAddChatMessage("Teleportando para "..x2..", "..y2..", "..z2.."", -1)
            end
        end
        
        if x ~= x1 and y ~= y1 and z ~= z1 then
            setCharCoordinates(PLAYER_PED,x, y, z)
            x1, y1, z1 = x, y, z
            wait(300)
            sampAddChatMessage("Teleportando para "..x2..", "..y2..", "..z2.."", -1)
        end
end


    
             if aim.CheckBox.teste12[0] then
    local vector3d = require("vector3d")
    local result, position = (function(position, radius, isRace)
        local result, isFind = vector3d(0, 0, 0), false
        for id = 0, 31 do
            local address = isRace and (0xC7F168 + id * 56) or (0xC7DD88 + id * 160)
            local marker = vector3d(
                representIntAsFloat(readMemory(address + 0, 4, false)),
                representIntAsFloat(readMemory(address + 4, 4, false)),
                representIntAsFloat(readMemory(address + 8, 4, false))
            )
            if marker.x ~= 0 and marker.y ~= 0 and marker.z ~= 0 then
                local distance = (marker - position):length()
                if distance < radius then
                    result = marker
                    isFind = true
                    radius = distance
                end
            end
        end
        return isFind, result
    end)(vector3d(getCharCoordinates(playerPed)), 20000, false)
    if result then
        setCharCoordinates(playerPed, position.x, position.y, position.z)
    end
end


            
            
        if aim.CheckBox.antistun[0] then
            for _, v in pairs(getAllObjects()) do
                if isObjectOnScreen(v) then
                    local result, oX, oY, oZ = getObjectCoordinates(v)
                    local x1, y1 = convert3DCoordsToScreen(oX,oY,oZ)
                    local objmodel = getObjectModel(v)
                    local x2,y2,z2 = getCharCoordinates(PLAYER_PED)
                    local x10, y10 = convert3DCoordsToScreen(x2,y2,z2)
                    distance = string.format("%.0f", getDistanceBetweenCoords3d(oX,oY,oZ, x2, y2, z2))
                    if objmodel == 19057 then renderDrawLine(x10, y10, x1, y1, 1.1, 0xFFD00000) renderFontDrawText(font,"Caixa Platina!\n{ff0000}Distancia: "..distance, x1, y1, -1) end
                end
            end
        end
    end
end

local newFrame = imgui.OnFrame(
    function() return aim.renderWindow.renderWindow[0] end,
    function(player)
        local sizeX, sizeY = getScreenResolution()
        imgui.SetNextWindowPos(imgui.ImVec2(sizeX / 2, sizeY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(360, 520), imgui.Cond.FirstUseEver)

        imgui.Begin('Checkpoint Teleport', menuShowing)   
        imgui.ToggleButton(u8"Teleporte Checkpoint ", aim.CheckBox.teste12)
                


        imgui.ToggleButton(u8"Teleporte Marca", aim.CheckBox.teste13)
        imgui.ToggleButton(u8"Auto TP Checkpoint", aim.CheckBox.teste14)
        imgui.ToggleButton(u8"Auto TP Corrida", aim.CheckBox.teste17)
        if imgui.ToggleButton(u8' Setar Posicao', aim.CheckBox.teste15) then
                if aim.CheckBox.teste15 then
                    posX, posY, posZ = getCharCoordinates(PLAYER_PED)
                end   
            end
        if imgui.ToggleButton(u8' Teleportar para Posicao', aim.CheckBox.teste16) then
                if aim.CheckBox.teste16 then
                    setCharCoordinates(playerPed, posX, posY, posZ)
                end
            end
        imgui.Separator()
            
        imgui.Text(u8"                        --EMPREGO COVEIRO BPS--")
        
        imgui.Separator()
        
        imgui.ToggleButton(u8"Marcar Cadaver", aim.CheckBox.teste18)
        imgui.ToggleButton(u8"Embalar Cadaver", aim.CheckBox.teste19)
        imgui.Separator()
        imgui.Text(u8"                        --TELEPORTES--")
                imgui.Separator()

        if imgui.ToggleButton(u8"Prefeitura", aim.CheckBox.teste20) then
    setCharCoordinates(1, 1478.1964111328, -1768.5966796875, 18.795742034912)
end



                imgui.Separator()
        imgui.SameLine(160)
        imgui.End()
    end
)

function fix(angle)
    if angle > math.pi then
        angle = angle - (math.pi * 2)
    elseif angle < -math.pi then
        angle = angle + (math.pi * 2)
    end
    return angle
end

function sendKey(key)
    local _, myId = sampGetPlayerIdByCharHandle(PLAYER_PED)
    local data = allocateMemory(68)
    sampStorePlayerOnfootData(myId, data)
    setStructElement(data, 4, 2, key, false)
    sampSendOnfootData(data)
    freeMemory(data)
end
function GetBodyPartCoordinates(id, handle)
    local pedptr = getCharPointer(handle)
    local vec = ffi.new("float[3]")
    getBonePosition(ffi.cast("void*", pedptr), vec, id, true)
    return vec[0], vec[1], vec[2]
end
local getBonePosition = ffi.cast("int (__thiscall*)(void*, float*, int, bool)", 0x5E4280)
local bones = {{42, {}}, {52, {}}, {23, {}}, {33, {}}, {3, {}}, {22, {}}, {32, {}}, {8, {}}}

function GetBodyPartCoordinates(id, handle)
    if doesCharExist(handle) then
        local pedptr = getCharPointer(handle)
        local vec = ffi.new("float[3]")
        getBonePosition(ffi.cast("void*", pedptr), vec, id, true)
        return vec[0], vec[1], vec[2]
    end
end

function iniLoad()
    mainIni = inicfg.load(nil, "Aim-Assist by Scar.ini")
    if mainIni == nil then
        iniReset()
    else
        if mainIni.CheckBoxs.antistun ~= nil then
            aim.CheckBox.antistun[0] = mainIni.CheckBoxs.antistun
        end
        
        if mainIni.CheckBoxs.teste19 ~= nil then
            aim.CheckBox.teste19[0] = mainIni.CheckBoxs.teste19
        end
        
        if mainIni.CheckBoxs.pm4 ~= nil then
            aim.CheckBox.pm4[0] = mainIni.CheckBoxs.pm4
        end
        
        if mainIni.CheckBoxs.p9m ~= nil then
            aim.CheckBox.p9m[0] = mainIni.CheckBoxs.p9m
        end
        
        if mainIni.CheckBoxs.pdoze ~= nil then
            aim.CheckBox.pdoze[0] = mainIni.CheckBoxs.pdoze
        end
        
        if mainIni.CheckBoxs.pespingarda ~= nil then
            aim.CheckBox.pespingarda[0] = mainIni.CheckBoxs.pespingarda
        end
        
        if mainIni.CheckBoxs.psniper ~= nil then
            aim.CheckBox.psniper[0] = mainIni.CheckBoxs.psniper
        end
        
        if mainIni.CheckBoxs.pak ~= nil then
            aim.CheckBox.pak[0] = mainIni.CheckBoxs.pak
        end
        
        if mainIni.CheckBoxs.pdesert ~= nil then
            aim.CheckBox.pdesert[0] = mainIni.CheckBoxs.pdesert
        end
        
        if mainIni.CheckBoxs.pmp5 ~= nil then
            aim.CheckBox.pmp5[0] = mainIni.CheckBoxs.pmp5
        end
        
        if mainIni.CheckBoxs.nreset ~= nil then
            aim.CheckBox.nreset[0] = mainIni.CheckBoxs.nreset
        end
        
        if mainIni.CheckBoxs.darma ~= nil then
            aim.CheckBox.darma[0] = mainIni.CheckBoxs.darma
        end
        
        if mainIni.CheckBoxs.sp1 ~= nil then
            aim.CheckBox.sp1[0] = mainIni.CheckBoxs.sp1
        end
        
        if mainIni.CheckBoxs.aej ~= nil then
            aim.CheckBox.aej[0] = mainIni.CheckBoxs.aej
        end
        
        for i = 2, 17 do
            local testName = "teste" .. i
            if mainIni.CheckBoxs[testName] ~= nil then
                aim.CheckBox[testName][0] = mainIni.CheckBoxs[testName]
            end
        end

        for i = 20, 40 do
            local testName = "teste" .. i
            if mainIni.CheckBoxs[testName] ~= nil then
                aim.CheckBox[testName][0] = mainIni.CheckBoxs[testName]
            end
        end

        if mainIni.CheckBoxs.teste1 ~= nil then
            aim.CheckBox.teste1[0] = mainIni.CheckBoxs.teste1
        end
    end
end



function iniSave()
    inicfg.save({
        Sliders = {
        }, CheckBoxs = {
            antistun = aim.CheckBox.antistun[0],
            teste11 = aim.CheckBox.teste11[0],
            teste12 = aim.CheckBox.teste12[0],
            teste13 = aim.CheckBox.teste13[0],
            teste14 = aim.CheckBox.teste14[0],
            teste15 = aim.CheckBox.teste15[0],
            teste16 = aim.CheckBox.teste16[0],
            teste17 = aim.CheckBox.teste17[0],
            teste18 = aim.CheckBox.teste18[0],
            teste19 = aim.CheckBox.teste19[0],
            teste20 = aim.CheckBox.teste20[0],
        }
    }, "Aim-Assist by Scar.ini")
end

function iniReset()
    inicfg.save({
        Sliders = {
        }, CheckBoxs = {
            antistun = false,
            teste1 = false,
            teste2 = false,
        }
    }, "Aim-Assist by Scar.ini")
end
local getBonePosition = ffi.cast("int (__thiscall*)(void*, float*, int, bool)", 0x5E4280)


font = renderCreateFont('Tahoma', 11)

function GetBodyPartCoordinates(id, handle)
    local pedptr = getCharPointer(handle)
    local vec = ffi.new("float[3]")
    getBonePosition(ffi.cast("void*", pedptr), vec, id, true)
    return vec[0], vec[1], vec[2]
end
function getBodyPartCoordinates(id, handle)
  local pedptr = getCharPointer(handle)
  local vec = ffi.new("float[3]")
  getBonePosition(ffi.cast("void*", pedptr), vec, id, true)
  return vec[0], vec[1], vec[2]
end
function samp_create_sync_data(sync_type, copy_from_player)
    local ffi = require 'ffi'
    local sampfuncs = require 'sampfuncs'
    -- from SAMP.Lua
    local raknet = require 'samp.raknet'
    require 'samp.synchronization'

    copy_from_player = copy_from_player or true
    local sync_traits = {
        player = {'PlayerSyncData', raknet.PACKET.PLAYER_SYNC, sampStorePlayerOnfootData},
        vehicle = {'VehicleSyncData', raknet.PACKET.VEHICLE_SYNC, sampStorePlayerIncarData},
        passenger = {'PassengerSyncData', raknet.PACKET.PASSENGER_SYNC, sampStorePlayerPassengerData},
        aim = {'AimSyncData', raknet.PACKET.AIM_SYNC, sampStorePlayerAimData},
        trailer = {'TrailerSyncData', raknet.PACKET.TRAILER_SYNC, sampStorePlayerTrailerData},
        unoccupied = {'UnoccupiedSyncData', raknet.PACKET.UNOCCUPIED_SYNC, nil},
        bullet = {'BulletSyncData', raknet.PACKET.BULLET_SYNC, nil},
        spectator = {'SpectatorSyncData', raknet.PACKET.SPECTATOR_SYNC, nil}
    }
    local sync_info = sync_traits[sync_type]
    local data_type = 'struct ' .. sync_info[1]
    local data = ffi.new(data_type, {})
    local raw_data_ptr = tonumber(ffi.cast('uintptr_t', ffi.new(data_type .. '*', data)))
    -- copy player's sync data to the allocated memory
    if copy_from_player then
        local copy_func = sync_info[3]
        if copy_func then
            local _, player_id
            if copy_from_player == true then
                _, player_id = sampGetPlayerIdByCharHandle(PLAYER_PED)
            else
                player_id = tonumber(copy_from_player)
            end
            copy_func(player_id, raw_data_ptr)
        end
    end
    -- function to send packet
    local func_send = function()
        local bs = raknetNewBitStream()
        raknetBitStreamWriteInt8(bs, sync_info[2])
        raknetBitStreamWriteBuffer(bs, raw_data_ptr, ffi.sizeof(data))
        raknetSendBitStreamEx(bs, sampfuncs.HIGH_PRIORITY, sampfuncs.UNRELIABLE_SEQUENCED, 1)
        raknetDeleteBitStream(bs)
    end
    -- metatable to access sync data and 'send' function
    local mt = {
        __index = function(t, index)
            return data[index]
        end,
        __newindex = function(t, index, value)
            data[index] = value
        end
    }
    return setmetatable({send = func_send}, mt)
end
sampev.onSetCheckpoint = function(position, radius)
    if aim.CheckBox.teste12[0] then
        setCharCoordinates(PLAYER_PED, position.x, position.y, position.z)
    end
end
function drawBar(posX, posY, sizeX, sizeY, color1, color2, borderThickness, font, value)
    renderDrawBoxWithBorder(posX, posY, sizeX, sizeY, color2, borderThickness, 0xFF000000)
    renderDrawBox(posX + borderThickness, posY + borderThickness, sizeX / 100 * value - (borderThickness * 2), sizeY - (2 * borderThickness), color1)
    local textLenght = renderGetFontDrawTextLength(font, tostring(value))
    local textHeight = renderGetFontDrawHeight(font)
    renderFontDrawText(font, tostring(value), posX + (sizeX / 2) - (textLenght / 2), posY + (sizeY / 2) - (textHeight / 2), 0xFFFFFFFF)
end
local coord_master = false
function imgui.TextQuestion(text)
    imgui.TextDisabled('(?)')
    if imgui.IsItemHovered() then
        imgui.BeginTooltip()
        imgui.PushTextWrapPos(450)
        imgui.TextUnformatted(text)
        imgui.PopTextWrapPos()
        imgui.EndTooltip()
    end
end
function imgui.ToggleButton(str_id, bool)
    local rBool = false

    if LastActiveTime == nil then
        LastActiveTime = {}
    end
    if LastActive == nil then
        LastActive = {}
    end

    local function ImSaturate(f)
        return f < 0.0 and 0.0 or (f > 1.0 and 1.0 or f)
    end

    local p = imgui.GetCursorScreenPos()
    local dl = imgui.GetWindowDrawList()

    local height = imgui.GetTextLineHeightWithSpacing()
    local width = height * 1.70
    local radius = height * 0.50
    local ANIM_SPEED = type == 2 and 0.10 or 0.15
    local butPos = imgui.GetCursorPos()

    if imgui.InvisibleButton(str_id, imgui.ImVec2(width, height)) then
        bool[0] = not bool[0]
        rBool = true
        LastActiveTime[tostring(str_id)] = os.clock()
        LastActive[tostring(str_id)] = true
    end

    imgui.SetCursorPos(imgui.ImVec2(butPos.x + width + 8, butPos.y + 2.5))
    imgui.Text( str_id:gsub('##.+', '') )

    local t = bool[0] and 1.0 or 0.0

    if LastActive[tostring(str_id)] then
        local time = os.clock() - LastActiveTime[tostring(str_id)]
        if time <= ANIM_SPEED then
            local t_anim = ImSaturate(time / ANIM_SPEED)
            t = bool[0] and t_anim or 1.0 - t_anim
        else
            LastActive[tostring(str_id)] = false
        end
    end

    local col_circle = bool[0] and imgui.ColorConvertFloat4ToU32(imgui.ImVec4(imgui.GetStyle().Colors[imgui.Col.ButtonActive])) or imgui.ColorConvertFloat4ToU32(imgui.ImVec4(imgui.GetStyle().Colors[imgui.Col.TextDisabled]))
    dl:AddRectFilled(p, imgui.ImVec2(p.x + width, p.y + height), imgui.ColorConvertFloat4ToU32(imgui.GetStyle().Colors[imgui.Col.FrameBg]), height * 0.5)
    dl:AddCircleFilled(imgui.ImVec2(p.x + radius + t * (width - radius * 2.0), p.y + radius), radius - 1.5, col_circle, 30)
    return rBool
end
function getweaponname(weapon)
  local names = {
  [0] = "Fist",
  [1] = "Brass Knuckles",
  [2] = "Golf Club",
  [3] = "Nightstick",
  [4] = "Knife",
  [5] = "Baseball Bat",
  [6] = "Shovel",
  [7] = "Pool Cue",
  [8] = "Katana",
  [9] = "Chainsaw",
  [10] = "Purple Dildo",
  [11] = "Dildo",
  [12] = "Vibrator",
  [13] = "Silver Vibrator",
  [14] = "Flowers",
  [15] = "Cane",
  [16] = "Grenade",
  [17] = "Tear Gas",
  [18] = "Molotov Cocktail",
  [22] = "9mm",
  [23] = "Silenced 9mm",
  [24] = "Desert Eagle",
  [25] = "Shotgun",
  [26] = "Sawnoff Shotgun",
  [27] = "Combat Shotgun",
  [28] = "Micro SMG/Uzi",
  [29] = "MP5",
  [30] = "AK-47",
  [31] = "M4",
  [32] = "Tec-9",
  [33] = "Country Rifle",
  [34] = "Sniper Rifle",
  [35] = "RPG",
  [36] = "HS Rocket",
  [37] = "Flamethrower",
  [38] = "Minigun",
  [39] = "Satchel Charge",
  [40] = "Detonator",
  [41] = "Spraycan",
  [42] = "Fire Extinguisher",
  [43] = "Camera",
  [44] = "Night Vis Goggles",
  [45] = "Thermal Goggles",
  [46] = "Parachute" }
  return names[weapon]
end
function onSendPacket(id)
    if id == PACKET_VEHICLE_SYNC and tpres then
        return false
  end
end


function atp()
  tpres = true
end
function imgui.Link(label)

    local size = imgui.CalcTextSize(label)
    local p = imgui.GetCursorScreenPos()
    local p2 = imgui.GetCursorPos()
    local result = imgui.InvisibleButton(label, size)

    imgui.SetCursorPos(p2)

    if imgui.IsItemHovered() then

        imgui.TextColored(imgui.ImVec4(0, 1, 1, 1), label)
        imgui.GetWindowDrawList():AddLine(imgui.ImVec2(p.x, p.y + size.y), imgui.ImVec2(p.x + size.x, p.y + size.y), imgui.GetColorU32(0, 1, 0, 1))
    else
        imgui.TextColored(imgui.ImVec4(1, 0.15, 0.2, 1), label)
    end

    return result
end


imgui.OnInitialize(function()
    imgui.GetIO().IniFilename = nil
    theme()
end)

function theme()
    imgui.SwitchContext()
    local style = imgui.GetStyle()
    local colors = style.Colors
    local clr = imgui.Col
    local ImVec4 = imgui.ImVec4

    imgui.GetStyle().WindowPadding = imgui.ImVec2(5, 5)
    imgui.GetStyle().FramePadding = imgui.ImVec2(5, 5)
    imgui.GetStyle().ItemSpacing = imgui.ImVec2(5, 5)
    imgui.GetStyle().ItemInnerSpacing = imgui.ImVec2(2, 2)
    imgui.GetStyle().TouchExtraPadding = imgui.ImVec2(0, 0)
    imgui.GetStyle().IndentSpacing = 0
    imgui.GetStyle().ScrollbarSize = 10
    imgui.GetStyle().GrabMinSize = 10

    --==[ BORDER ]==--
    imgui.GetStyle().WindowBorderSize = 1
    imgui.GetStyle().ChildBorderSize = 1
    imgui.GetStyle().PopupBorderSize = 1
    imgui.GetStyle().FrameBorderSize = 1
    imgui.GetStyle().TabBorderSize = 1

    --==[ ROUNDING ]==--
    imgui.GetStyle().WindowRounding = 8
    imgui.GetStyle().ChildRounding = 8
    imgui.GetStyle().FrameRounding = 8
    imgui.GetStyle().PopupRounding = 8
    imgui.GetStyle().ScrollbarRounding = 8
    imgui.GetStyle().GrabRounding = 8
    imgui.GetStyle().TabRounding = 8

    colors[clr.FrameBg]                = ImVec4(0.16, 0.48, 0.42, 0.54)
    colors[clr.FrameBgHovered]         = ImVec4(0.26, 0.98, 0.85, 0.40)
    colors[clr.FrameBgActive]          = ImVec4(0.26, 0.98, 0.85, 0.67)
    colors[clr.TitleBg]                = ImVec4(0.04, 0.04, 0.04, 1.00)
    colors[clr.TitleBgActive]          = ImVec4(0.16, 0.48, 0.42, 1.00)
    colors[clr.TitleBgCollapsed]       = ImVec4(0.00, 0.00, 0.00, 0.51)
    colors[clr.CheckMark]              = ImVec4(0.26, 0.98, 0.85, 1.00)
    colors[clr.SliderGrab]             = ImVec4(0.24, 0.88, 0.77, 1.00)
    colors[clr.SliderGrabActive]       = ImVec4(0.26, 0.98, 0.85, 1.00)
    colors[clr.Button]                 = ImVec4(0.26, 0.98, 0.85, 0.40)
    colors[clr.ButtonHovered]          = ImVec4(0.26, 0.98, 0.85, 1.00)
    colors[clr.ButtonActive]           = ImVec4(0.06, 0.98, 0.82, 1.00)
    colors[clr.Header]                 = ImVec4(0.26, 0.98, 0.85, 0.31)
    colors[clr.HeaderHovered]          = ImVec4(0.26, 0.98, 0.85, 0.80)
    colors[clr.HeaderActive]           = ImVec4(0.26, 0.98, 0.85, 1.00)
    colors[clr.Separator]              = colors[clr.Border]
    colors[clr.SeparatorHovered]       = ImVec4(0.10, 0.75, 0.63, 0.78)
    colors[clr.SeparatorActive]        = ImVec4(0.10, 0.75, 0.63, 1.00)
    colors[clr.ResizeGrip]             = ImVec4(0.26, 0.98, 0.85, 0.25)
    colors[clr.ResizeGripHovered]      = ImVec4(0.26, 0.98, 0.85, 0.67)
    colors[clr.ResizeGripActive]       = ImVec4(0.26, 0.98, 0.85, 0.95)
    colors[clr.PlotLines]              = ImVec4(0.61, 0.61, 0.61, 1.00)
    colors[clr.PlotLinesHovered]       = ImVec4(1.00, 0.81, 0.35, 1.00)
    colors[clr.TextSelectedBg]         = ImVec4(0.26, 0.98, 0.85, 0.35)
    colors[clr.Text]                   = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.TextDisabled]           = ImVec4(0.50, 0.50, 0.50, 1.00)
    colors[clr.WindowBg]               = ImVec4(0.06, 0.06, 0.06, 0.94)
    colors[clr.ChildBg]          = ImVec4(1.00, 1.00, 1.00, 0.00)
    colors[clr.PopupBg]                = ImVec4(0.08, 0.08, 0.08, 0.94)
    colors[clr.Border]                 = ImVec4(0.43, 0.43, 0.50, 0.50)
    colors[clr.BorderShadow]           = ImVec4(0.00, 0.00, 0.00, 0.00)
    colors[clr.MenuBarBg]              = ImVec4(0.14, 0.14, 0.14, 1.00)
    colors[clr.ScrollbarBg]            = ImVec4(0.02, 0.02, 0.02, 0.53)
    colors[clr.ScrollbarGrab]          = ImVec4(0.31, 0.31, 0.31, 1.00)
    colors[clr.ScrollbarGrabHovered]   = ImVec4(0.41, 0.41, 0.41, 1.00)
    colors[clr.ScrollbarGrabActive]    = ImVec4(0.51, 0.51, 0.51, 1.00)
    colors[clr.PlotHistogram]          = ImVec4(0.90, 0.70, 0.00, 1.00)
    colors[clr.PlotHistogramHovered]   = ImVec4(1.00, 0.60, 0.00, 1.00)
end
 

Вложения

  • Farm Money.lua
    27.2 KB · Просмотры: 14

shuzaru

Активный
229
63
У меня есть чит Lua в формате mimgui, всё работает, но телепортация к контрольной точке иногда не происходит в нужное место. Например, он телепортирует меня на стадионный контрольный пункт, а мне этого не нужно. Я хочу, чтобы он телепортировался на отмеченную контрольную точку. Если кто-то может исправить это, я буду признателен и счастлив. Вот исходный код.






Lua:
require("lib.moonloader")
local imgui = require("mimgui")
local vKeys = require('vKeys')
local inicfg = require("inicfg")
local sampfuncs = require "sampfuncs"
local ffi = require "ffi"
local sW, sH = getScreenResolution()
local memory = require("memory")
local faicons = require("fAwesome5")
local events = require 'lib.samp.events'
local hack = require 'lib.samp.events'
local sampev = require 'samp.events'
local encoding = require("encoding")
local var_0_6 = require("ffi")
encoding.default = 'CP1251'
local u8 = encoding.UTF8

require 'lib.sampfuncs'

local getBonePosition = ffi.cast("int (__thiscall*)(void*, float*, int, bool)", 0x5E4280)

local font = renderCreateFont("Arial", 11, 15)

local aim = {
    renderWindow = {
        renderWindow = imgui.new.bool()
    },
    CheckBox = {
        antistun = imgui.new.bool(),
        teste11 = imgui.new.bool(),
        teste12 = imgui.new.bool(),
        teste13 = imgui.new.bool(),
        teste14 = imgui.new.bool(),
        teste15 = imgui.new.bool(),
        teste16 = imgui.new.bool(),
        teste17 = imgui.new.bool(),
        teste18 = imgui.new.bool(),
        teste19 = imgui.new.bool(),
        teste20 = imgui.new.bool(),
      
      
    },
}

function main()
    repeat wait(0) until isSampAvailable()
    wait(1000)
    sampAddChatMessage("{006400}[Farm Money | Scarllet SAMP]: {ffffff}Carregado! cmd /scarlletmoney", 0x0066ff)
    iniLoad()

    sampRegisterChatCommand("scarlletmoney", function()
        aim.renderWindow.renderWindow[0] = not aim.renderWindow.renderWindow[0]
    end)

    while true do
        wait(0)

        if res and time ~= nil then
            sampDisconnectWithReason("quit")
            wait(time * 1000)
            sampSetGamestate(1)
            res = false
        elseif res and time == nil then
            sampDisconnectWithReason("quit")
            wait(15500)
            sampSetGamestate(1)
            res = false
        end
      
      
if aim.CheckBox.teste18[0] then
    local vector3d = require("vector3d")
    local result, position = (function(position, radius, isRace)
        local result, isFind = vector3d(0, 0, 0), false
        for id = 0, 31 do
            local address = isRace and (0xC7F168 + id * 56) or (0xC7DD88 + id * 160)
            local marker = vector3d(
                representIntAsFloat(readMemory(address + 0, 4, false)),
                representIntAsFloat(readMemory(address + 4, 4, false)),
                representIntAsFloat(readMemory(address + 8, 4, false))
            )
            if marker.x ~= 0 and marker.y ~= 0 and marker.z ~= 0 then
                local distance = (marker - position):length()
                if distance < radius then
                    result = marker
                    isFind = true
                    radius = distance
                end
            end
        end
        return isFind, result
    end)(vector3d(getCharCoordinates(playerPed)), 20000, false)
  
    if result then
        setCharCoordinates(playerPed, position.x, position.y, position.z)
        sampSendChat("/mcadaver") -- Comando para marcar o corpo
        -- Teleportar para o checkpoint
        -- Substitua 'position.x', 'position.y', 'position.z' pelos valores do checkpoint se necessário
        -- setCharCoordinates(playerPed, checkpoint_x, checkpoint_y, checkpoint_z)
    end
end

            if aim.CheckBox.teste20[0] then
                 end
    

            if aim.CheckBox.teste19[0] then
    local vector3d = require("vector3d")
    local result, position = (function(position, radius, isRace)
        local result, isFind = vector3d(0, 0, 0), false
        for id = 0, 31 do
            local address = isRace and (0xC7F168 + id * 56) or (0xC7DD88 + id * 160)
            local marker = vector3d(
                representIntAsFloat(readMemory(address + 0, 4, false)),
                representIntAsFloat(readMemory(address + 4, 4, false)),
                representIntAsFloat(readMemory(address + 8, 4, false))
            )
            if marker.x ~= 0 and marker.y ~= 0 and marker.z ~= 0 then
                local distance = (marker - position):length()
                if distance < radius then
                    result = marker
                    isFind = true
                    radius = distance
                end
            end
        end
        return isFind, result
    end)(vector3d(getCharCoordinates(playerPed)), 20000, false)
  
    if result then
        setCharCoordinates(playerPed, position.x, position.y, position.z)
        sampSendChat("/embalarcadaver") -- Comando para marcar o corpo
    end
end


    if aim.CheckBox.teste17[0] then
    local vector3d = require("vector3d")

    local position = vector3d(getCharCoordinates(playerPed))
    local result, finalPosition = (function(position, radius, isRace)
        local result, isFind = vector3d(0, 0, 0), false
        for id = 0, 31 do
            local address = isRace and (0xC7F168 + id * 56) or (0xC7DD88 + id * 160)
            local marker = vector3d(
                representIntAsFloat(readMemory(address + 0, 4, false)),
                representIntAsFloat(readMemory(address + 4, 4, false)),
                representIntAsFloat(readMemory(address + 8, 4, false))
            )
            if marker.x ~= 0 and marker.y ~= 0 and marker.z ~= 0 then
                local distance = (marker - position):length()
                if distance < radius then
                    result = marker
                    isFind = true
                    radius = distance
                end
            end
        end
        return isFind, result
    end)(position, 20000, true)

    if result then
        setCharCoordinates(playerPed, finalPosition.x, finalPosition.y, finalPosition.z)
    end

    wait(100) -- Espera 100 milissegundos antes de continuar com a próxima iteração
end

   if aim.CheckBox.teste14[0] then
    local vector3d = require("vector3d")
    local result, position = (function(position, radius, isRace)
        local result, isFind = vector3d(0, 0, 0), false
        for id = 0, 31 do
            local address = isRace and (0xC7F168 + id * 56) or (0xC7DD88 + id * 160)
            local marker = vector3d(
                representIntAsFloat(readMemory(address + 0, 4, false)),
                representIntAsFloat(readMemory(address + 4, 4, false)),
                representIntAsFloat(readMemory(address + 8, 4, false))
            )
            if marker.x ~= 0 and marker.y ~= 0 and marker.z ~= 0 then
                local distance = (marker - position):length()
                if distance < radius then
                    result = marker
                    isFind = true
                    radius = distance -- Esta linha estava sobrescrevendo o raio aqui, isso estava causando um problema
                end
            end
        end
        return isFind, result
    end)(vector3d(getCharCoordinates(playerPed)), 20000, false)
    if result then
        setCharCoordinates(playerPed, position.x, position.y, position.z)
    end
end
wait(1000) -- Espera 100 milissegundos antes de continuar com a próxima iteração


          
          
             if aim.CheckBox.teste13[0] then
    result,x,y,z = getTargetBlipCoordinates()
        x2 = ("%.3f"):format(x)
        y2 = ("%.3f"):format(y)
        z2 = ("%.3f"):format(z)
        if not result then
            check = false
            x1, y1, z1 = x, y, z
        end
        if result then
            if check == false then
                 setCharCoordinates(PLAYER_PED,x,y,z)
                 check = true
                 wait(300)
                 sampAddChatMessage("Teleportando para "..x2..", "..y2..", "..z2.."", -1)
            end
        end
      
        if x ~= x1 and y ~= y1 and z ~= z1 then
            setCharCoordinates(PLAYER_PED,x, y, z)
            x1, y1, z1 = x, y, z
            wait(300)
            sampAddChatMessage("Teleportando para "..x2..", "..y2..", "..z2.."", -1)
        end
end


  
             if aim.CheckBox.teste12[0] then
    local vector3d = require("vector3d")
    local result, position = (function(position, radius, isRace)
        local result, isFind = vector3d(0, 0, 0), false
        for id = 0, 31 do
            local address = isRace and (0xC7F168 + id * 56) or (0xC7DD88 + id * 160)
            local marker = vector3d(
                representIntAsFloat(readMemory(address + 0, 4, false)),
                representIntAsFloat(readMemory(address + 4, 4, false)),
                representIntAsFloat(readMemory(address + 8, 4, false))
            )
            if marker.x ~= 0 and marker.y ~= 0 and marker.z ~= 0 then
                local distance = (marker - position):length()
                if distance < radius then
                    result = marker
                    isFind = true
                    radius = distance
                end
            end
        end
        return isFind, result
    end)(vector3d(getCharCoordinates(playerPed)), 20000, false)
    if result then
        setCharCoordinates(playerPed, position.x, position.y, position.z)
    end
end


          
          
        if aim.CheckBox.antistun[0] then
            for _, v in pairs(getAllObjects()) do
                if isObjectOnScreen(v) then
                    local result, oX, oY, oZ = getObjectCoordinates(v)
                    local x1, y1 = convert3DCoordsToScreen(oX,oY,oZ)
                    local objmodel = getObjectModel(v)
                    local x2,y2,z2 = getCharCoordinates(PLAYER_PED)
                    local x10, y10 = convert3DCoordsToScreen(x2,y2,z2)
                    distance = string.format("%.0f", getDistanceBetweenCoords3d(oX,oY,oZ, x2, y2, z2))
                    if objmodel == 19057 then renderDrawLine(x10, y10, x1, y1, 1.1, 0xFFD00000) renderFontDrawText(font,"Caixa Platina!\n{ff0000}Distancia: "..distance, x1, y1, -1) end
                end
            end
        end
    end
end

local newFrame = imgui.OnFrame(
    function() return aim.renderWindow.renderWindow[0] end,
    function(player)
        local sizeX, sizeY = getScreenResolution()
        imgui.SetNextWindowPos(imgui.ImVec2(sizeX / 2, sizeY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(360, 520), imgui.Cond.FirstUseEver)

        imgui.Begin('Checkpoint Teleport', menuShowing) 
        imgui.ToggleButton(u8"Teleporte Checkpoint ", aim.CheckBox.teste12)
              


        imgui.ToggleButton(u8"Teleporte Marca", aim.CheckBox.teste13)
        imgui.ToggleButton(u8"Auto TP Checkpoint", aim.CheckBox.teste14)
        imgui.ToggleButton(u8"Auto TP Corrida", aim.CheckBox.teste17)
        if imgui.ToggleButton(u8' Setar Posicao', aim.CheckBox.teste15) then
                if aim.CheckBox.teste15 then
                    posX, posY, posZ = getCharCoordinates(PLAYER_PED)
                end 
            end
        if imgui.ToggleButton(u8' Teleportar para Posicao', aim.CheckBox.teste16) then
                if aim.CheckBox.teste16 then
                    setCharCoordinates(playerPed, posX, posY, posZ)
                end
            end
        imgui.Separator()
          
        imgui.Text(u8"                        --EMPREGO COVEIRO BPS--")
      
        imgui.Separator()
      
        imgui.ToggleButton(u8"Marcar Cadaver", aim.CheckBox.teste18)
        imgui.ToggleButton(u8"Embalar Cadaver", aim.CheckBox.teste19)
        imgui.Separator()
        imgui.Text(u8"                        --TELEPORTES--")
                imgui.Separator()

        if imgui.ToggleButton(u8"Prefeitura", aim.CheckBox.teste20) then
    setCharCoordinates(1, 1478.1964111328, -1768.5966796875, 18.795742034912)
end



                imgui.Separator()
        imgui.SameLine(160)
        imgui.End()
    end
)

function fix(angle)
    if angle > math.pi then
        angle = angle - (math.pi * 2)
    elseif angle < -math.pi then
        angle = angle + (math.pi * 2)
    end
    return angle
end

function sendKey(key)
    local _, myId = sampGetPlayerIdByCharHandle(PLAYER_PED)
    local data = allocateMemory(68)
    sampStorePlayerOnfootData(myId, data)
    setStructElement(data, 4, 2, key, false)
    sampSendOnfootData(data)
    freeMemory(data)
end
function GetBodyPartCoordinates(id, handle)
    local pedptr = getCharPointer(handle)
    local vec = ffi.new("float[3]")
    getBonePosition(ffi.cast("void*", pedptr), vec, id, true)
    return vec[0], vec[1], vec[2]
end
local getBonePosition = ffi.cast("int (__thiscall*)(void*, float*, int, bool)", 0x5E4280)
local bones = {{42, {}}, {52, {}}, {23, {}}, {33, {}}, {3, {}}, {22, {}}, {32, {}}, {8, {}}}

function GetBodyPartCoordinates(id, handle)
    if doesCharExist(handle) then
        local pedptr = getCharPointer(handle)
        local vec = ffi.new("float[3]")
        getBonePosition(ffi.cast("void*", pedptr), vec, id, true)
        return vec[0], vec[1], vec[2]
    end
end

function iniLoad()
    mainIni = inicfg.load(nil, "Aim-Assist by Scar.ini")
    if mainIni == nil then
        iniReset()
    else
        if mainIni.CheckBoxs.antistun ~= nil then
            aim.CheckBox.antistun[0] = mainIni.CheckBoxs.antistun
        end
      
        if mainIni.CheckBoxs.teste19 ~= nil then
            aim.CheckBox.teste19[0] = mainIni.CheckBoxs.teste19
        end
      
        if mainIni.CheckBoxs.pm4 ~= nil then
            aim.CheckBox.pm4[0] = mainIni.CheckBoxs.pm4
        end
      
        if mainIni.CheckBoxs.p9m ~= nil then
            aim.CheckBox.p9m[0] = mainIni.CheckBoxs.p9m
        end
      
        if mainIni.CheckBoxs.pdoze ~= nil then
            aim.CheckBox.pdoze[0] = mainIni.CheckBoxs.pdoze
        end
      
        if mainIni.CheckBoxs.pespingarda ~= nil then
            aim.CheckBox.pespingarda[0] = mainIni.CheckBoxs.pespingarda
        end
      
        if mainIni.CheckBoxs.psniper ~= nil then
            aim.CheckBox.psniper[0] = mainIni.CheckBoxs.psniper
        end
      
        if mainIni.CheckBoxs.pak ~= nil then
            aim.CheckBox.pak[0] = mainIni.CheckBoxs.pak
        end
      
        if mainIni.CheckBoxs.pdesert ~= nil then
            aim.CheckBox.pdesert[0] = mainIni.CheckBoxs.pdesert
        end
      
        if mainIni.CheckBoxs.pmp5 ~= nil then
            aim.CheckBox.pmp5[0] = mainIni.CheckBoxs.pmp5
        end
      
        if mainIni.CheckBoxs.nreset ~= nil then
            aim.CheckBox.nreset[0] = mainIni.CheckBoxs.nreset
        end
      
        if mainIni.CheckBoxs.darma ~= nil then
            aim.CheckBox.darma[0] = mainIni.CheckBoxs.darma
        end
      
        if mainIni.CheckBoxs.sp1 ~= nil then
            aim.CheckBox.sp1[0] = mainIni.CheckBoxs.sp1
        end
      
        if mainIni.CheckBoxs.aej ~= nil then
            aim.CheckBox.aej[0] = mainIni.CheckBoxs.aej
        end
      
        for i = 2, 17 do
            local testName = "teste" .. i
            if mainIni.CheckBoxs[testName] ~= nil then
                aim.CheckBox[testName][0] = mainIni.CheckBoxs[testName]
            end
        end

        for i = 20, 40 do
            local testName = "teste" .. i
            if mainIni.CheckBoxs[testName] ~= nil then
                aim.CheckBox[testName][0] = mainIni.CheckBoxs[testName]
            end
        end

        if mainIni.CheckBoxs.teste1 ~= nil then
            aim.CheckBox.teste1[0] = mainIni.CheckBoxs.teste1
        end
    end
end



function iniSave()
    inicfg.save({
        Sliders = {
        }, CheckBoxs = {
            antistun = aim.CheckBox.antistun[0],
            teste11 = aim.CheckBox.teste11[0],
            teste12 = aim.CheckBox.teste12[0],
            teste13 = aim.CheckBox.teste13[0],
            teste14 = aim.CheckBox.teste14[0],
            teste15 = aim.CheckBox.teste15[0],
            teste16 = aim.CheckBox.teste16[0],
            teste17 = aim.CheckBox.teste17[0],
            teste18 = aim.CheckBox.teste18[0],
            teste19 = aim.CheckBox.teste19[0],
            teste20 = aim.CheckBox.teste20[0],
        }
    }, "Aim-Assist by Scar.ini")
end

function iniReset()
    inicfg.save({
        Sliders = {
        }, CheckBoxs = {
            antistun = false,
            teste1 = false,
            teste2 = false,
        }
    }, "Aim-Assist by Scar.ini")
end
local getBonePosition = ffi.cast("int (__thiscall*)(void*, float*, int, bool)", 0x5E4280)


font = renderCreateFont('Tahoma', 11)

function GetBodyPartCoordinates(id, handle)
    local pedptr = getCharPointer(handle)
    local vec = ffi.new("float[3]")
    getBonePosition(ffi.cast("void*", pedptr), vec, id, true)
    return vec[0], vec[1], vec[2]
end
function getBodyPartCoordinates(id, handle)
  local pedptr = getCharPointer(handle)
  local vec = ffi.new("float[3]")
  getBonePosition(ffi.cast("void*", pedptr), vec, id, true)
  return vec[0], vec[1], vec[2]
end
function samp_create_sync_data(sync_type, copy_from_player)
    local ffi = require 'ffi'
    local sampfuncs = require 'sampfuncs'
    -- from SAMP.Lua
    local raknet = require 'samp.raknet'
    require 'samp.synchronization'

    copy_from_player = copy_from_player or true
    local sync_traits = {
        player = {'PlayerSyncData', raknet.PACKET.PLAYER_SYNC, sampStorePlayerOnfootData},
        vehicle = {'VehicleSyncData', raknet.PACKET.VEHICLE_SYNC, sampStorePlayerIncarData},
        passenger = {'PassengerSyncData', raknet.PACKET.PASSENGER_SYNC, sampStorePlayerPassengerData},
        aim = {'AimSyncData', raknet.PACKET.AIM_SYNC, sampStorePlayerAimData},
        trailer = {'TrailerSyncData', raknet.PACKET.TRAILER_SYNC, sampStorePlayerTrailerData},
        unoccupied = {'UnoccupiedSyncData', raknet.PACKET.UNOCCUPIED_SYNC, nil},
        bullet = {'BulletSyncData', raknet.PACKET.BULLET_SYNC, nil},
        spectator = {'SpectatorSyncData', raknet.PACKET.SPECTATOR_SYNC, nil}
    }
    local sync_info = sync_traits[sync_type]
    local data_type = 'struct ' .. sync_info[1]
    local data = ffi.new(data_type, {})
    local raw_data_ptr = tonumber(ffi.cast('uintptr_t', ffi.new(data_type .. '*', data)))
    -- copy player's sync data to the allocated memory
    if copy_from_player then
        local copy_func = sync_info[3]
        if copy_func then
            local _, player_id
            if copy_from_player == true then
                _, player_id = sampGetPlayerIdByCharHandle(PLAYER_PED)
            else
                player_id = tonumber(copy_from_player)
            end
            copy_func(player_id, raw_data_ptr)
        end
    end
    -- function to send packet
    local func_send = function()
        local bs = raknetNewBitStream()
        raknetBitStreamWriteInt8(bs, sync_info[2])
        raknetBitStreamWriteBuffer(bs, raw_data_ptr, ffi.sizeof(data))
        raknetSendBitStreamEx(bs, sampfuncs.HIGH_PRIORITY, sampfuncs.UNRELIABLE_SEQUENCED, 1)
        raknetDeleteBitStream(bs)
    end
    -- metatable to access sync data and 'send' function
    local mt = {
        __index = function(t, index)
            return data[index]
        end,
        __newindex = function(t, index, value)
            data[index] = value
        end
    }
    return setmetatable({send = func_send}, mt)
end
sampev.onSetCheckpoint = function(position, radius)
    if aim.CheckBox.teste12[0] then
        setCharCoordinates(PLAYER_PED, position.x, position.y, position.z)
    end
end
function drawBar(posX, posY, sizeX, sizeY, color1, color2, borderThickness, font, value)
    renderDrawBoxWithBorder(posX, posY, sizeX, sizeY, color2, borderThickness, 0xFF000000)
    renderDrawBox(posX + borderThickness, posY + borderThickness, sizeX / 100 * value - (borderThickness * 2), sizeY - (2 * borderThickness), color1)
    local textLenght = renderGetFontDrawTextLength(font, tostring(value))
    local textHeight = renderGetFontDrawHeight(font)
    renderFontDrawText(font, tostring(value), posX + (sizeX / 2) - (textLenght / 2), posY + (sizeY / 2) - (textHeight / 2), 0xFFFFFFFF)
end
local coord_master = false
function imgui.TextQuestion(text)
    imgui.TextDisabled('(?)')
    if imgui.IsItemHovered() then
        imgui.BeginTooltip()
        imgui.PushTextWrapPos(450)
        imgui.TextUnformatted(text)
        imgui.PopTextWrapPos()
        imgui.EndTooltip()
    end
end
function imgui.ToggleButton(str_id, bool)
    local rBool = false

    if LastActiveTime == nil then
        LastActiveTime = {}
    end
    if LastActive == nil then
        LastActive = {}
    end

    local function ImSaturate(f)
        return f < 0.0 and 0.0 or (f > 1.0 and 1.0 or f)
    end

    local p = imgui.GetCursorScreenPos()
    local dl = imgui.GetWindowDrawList()

    local height = imgui.GetTextLineHeightWithSpacing()
    local width = height * 1.70
    local radius = height * 0.50
    local ANIM_SPEED = type == 2 and 0.10 or 0.15
    local butPos = imgui.GetCursorPos()

    if imgui.InvisibleButton(str_id, imgui.ImVec2(width, height)) then
        bool[0] = not bool[0]
        rBool = true
        LastActiveTime[tostring(str_id)] = os.clock()
        LastActive[tostring(str_id)] = true
    end

    imgui.SetCursorPos(imgui.ImVec2(butPos.x + width + 8, butPos.y + 2.5))
    imgui.Text( str_id:gsub('##.+', '') )

    local t = bool[0] and 1.0 or 0.0

    if LastActive[tostring(str_id)] then
        local time = os.clock() - LastActiveTime[tostring(str_id)]
        if time <= ANIM_SPEED then
            local t_anim = ImSaturate(time / ANIM_SPEED)
            t = bool[0] and t_anim or 1.0 - t_anim
        else
            LastActive[tostring(str_id)] = false
        end
    end

    local col_circle = bool[0] and imgui.ColorConvertFloat4ToU32(imgui.ImVec4(imgui.GetStyle().Colors[imgui.Col.ButtonActive])) or imgui.ColorConvertFloat4ToU32(imgui.ImVec4(imgui.GetStyle().Colors[imgui.Col.TextDisabled]))
    dl:AddRectFilled(p, imgui.ImVec2(p.x + width, p.y + height), imgui.ColorConvertFloat4ToU32(imgui.GetStyle().Colors[imgui.Col.FrameBg]), height * 0.5)
    dl:AddCircleFilled(imgui.ImVec2(p.x + radius + t * (width - radius * 2.0), p.y + radius), radius - 1.5, col_circle, 30)
    return rBool
end
function getweaponname(weapon)
  local names = {
  [0] = "Fist",
  [1] = "Brass Knuckles",
  [2] = "Golf Club",
  [3] = "Nightstick",
  [4] = "Knife",
  [5] = "Baseball Bat",
  [6] = "Shovel",
  [7] = "Pool Cue",
  [8] = "Katana",
  [9] = "Chainsaw",
  [10] = "Purple Dildo",
  [11] = "Dildo",
  [12] = "Vibrator",
  [13] = "Silver Vibrator",
  [14] = "Flowers",
  [15] = "Cane",
  [16] = "Grenade",
  [17] = "Tear Gas",
  [18] = "Molotov Cocktail",
  [22] = "9mm",
  [23] = "Silenced 9mm",
  [24] = "Desert Eagle",
  [25] = "Shotgun",
  [26] = "Sawnoff Shotgun",
  [27] = "Combat Shotgun",
  [28] = "Micro SMG/Uzi",
  [29] = "MP5",
  [30] = "AK-47",
  [31] = "M4",
  [32] = "Tec-9",
  [33] = "Country Rifle",
  [34] = "Sniper Rifle",
  [35] = "RPG",
  [36] = "HS Rocket",
  [37] = "Flamethrower",
  [38] = "Minigun",
  [39] = "Satchel Charge",
  [40] = "Detonator",
  [41] = "Spraycan",
  [42] = "Fire Extinguisher",
  [43] = "Camera",
  [44] = "Night Vis Goggles",
  [45] = "Thermal Goggles",
  [46] = "Parachute" }
  return names[weapon]
end
function onSendPacket(id)
    if id == PACKET_VEHICLE_SYNC and tpres then
        return false
  end
end


function atp()
  tpres = true
end
function imgui.Link(label)

    local size = imgui.CalcTextSize(label)
    local p = imgui.GetCursorScreenPos()
    local p2 = imgui.GetCursorPos()
    local result = imgui.InvisibleButton(label, size)

    imgui.SetCursorPos(p2)

    if imgui.IsItemHovered() then

        imgui.TextColored(imgui.ImVec4(0, 1, 1, 1), label)
        imgui.GetWindowDrawList():AddLine(imgui.ImVec2(p.x, p.y + size.y), imgui.ImVec2(p.x + size.x, p.y + size.y), imgui.GetColorU32(0, 1, 0, 1))
    else
        imgui.TextColored(imgui.ImVec4(1, 0.15, 0.2, 1), label)
    end

    return result
end


imgui.OnInitialize(function()
    imgui.GetIO().IniFilename = nil
    theme()
end)

function theme()
    imgui.SwitchContext()
    local style = imgui.GetStyle()
    local colors = style.Colors
    local clr = imgui.Col
    local ImVec4 = imgui.ImVec4

    imgui.GetStyle().WindowPadding = imgui.ImVec2(5, 5)
    imgui.GetStyle().FramePadding = imgui.ImVec2(5, 5)
    imgui.GetStyle().ItemSpacing = imgui.ImVec2(5, 5)
    imgui.GetStyle().ItemInnerSpacing = imgui.ImVec2(2, 2)
    imgui.GetStyle().TouchExtraPadding = imgui.ImVec2(0, 0)
    imgui.GetStyle().IndentSpacing = 0
    imgui.GetStyle().ScrollbarSize = 10
    imgui.GetStyle().GrabMinSize = 10

    --==[ BORDER ]==--
    imgui.GetStyle().WindowBorderSize = 1
    imgui.GetStyle().ChildBorderSize = 1
    imgui.GetStyle().PopupBorderSize = 1
    imgui.GetStyle().FrameBorderSize = 1
    imgui.GetStyle().TabBorderSize = 1

    --==[ ROUNDING ]==--
    imgui.GetStyle().WindowRounding = 8
    imgui.GetStyle().ChildRounding = 8
    imgui.GetStyle().FrameRounding = 8
    imgui.GetStyle().PopupRounding = 8
    imgui.GetStyle().ScrollbarRounding = 8
    imgui.GetStyle().GrabRounding = 8
    imgui.GetStyle().TabRounding = 8

    colors[clr.FrameBg]                = ImVec4(0.16, 0.48, 0.42, 0.54)
    colors[clr.FrameBgHovered]         = ImVec4(0.26, 0.98, 0.85, 0.40)
    colors[clr.FrameBgActive]          = ImVec4(0.26, 0.98, 0.85, 0.67)
    colors[clr.TitleBg]                = ImVec4(0.04, 0.04, 0.04, 1.00)
    colors[clr.TitleBgActive]          = ImVec4(0.16, 0.48, 0.42, 1.00)
    colors[clr.TitleBgCollapsed]       = ImVec4(0.00, 0.00, 0.00, 0.51)
    colors[clr.CheckMark]              = ImVec4(0.26, 0.98, 0.85, 1.00)
    colors[clr.SliderGrab]             = ImVec4(0.24, 0.88, 0.77, 1.00)
    colors[clr.SliderGrabActive]       = ImVec4(0.26, 0.98, 0.85, 1.00)
    colors[clr.Button]                 = ImVec4(0.26, 0.98, 0.85, 0.40)
    colors[clr.ButtonHovered]          = ImVec4(0.26, 0.98, 0.85, 1.00)
    colors[clr.ButtonActive]           = ImVec4(0.06, 0.98, 0.82, 1.00)
    colors[clr.Header]                 = ImVec4(0.26, 0.98, 0.85, 0.31)
    colors[clr.HeaderHovered]          = ImVec4(0.26, 0.98, 0.85, 0.80)
    colors[clr.HeaderActive]           = ImVec4(0.26, 0.98, 0.85, 1.00)
    colors[clr.Separator]              = colors[clr.Border]
    colors[clr.SeparatorHovered]       = ImVec4(0.10, 0.75, 0.63, 0.78)
    colors[clr.SeparatorActive]        = ImVec4(0.10, 0.75, 0.63, 1.00)
    colors[clr.ResizeGrip]             = ImVec4(0.26, 0.98, 0.85, 0.25)
    colors[clr.ResizeGripHovered]      = ImVec4(0.26, 0.98, 0.85, 0.67)
    colors[clr.ResizeGripActive]       = ImVec4(0.26, 0.98, 0.85, 0.95)
    colors[clr.PlotLines]              = ImVec4(0.61, 0.61, 0.61, 1.00)
    colors[clr.PlotLinesHovered]       = ImVec4(1.00, 0.81, 0.35, 1.00)
    colors[clr.TextSelectedBg]         = ImVec4(0.26, 0.98, 0.85, 0.35)
    colors[clr.Text]                   = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.TextDisabled]           = ImVec4(0.50, 0.50, 0.50, 1.00)
    colors[clr.WindowBg]               = ImVec4(0.06, 0.06, 0.06, 0.94)
    colors[clr.ChildBg]          = ImVec4(1.00, 1.00, 1.00, 0.00)
    colors[clr.PopupBg]                = ImVec4(0.08, 0.08, 0.08, 0.94)
    colors[clr.Border]                 = ImVec4(0.43, 0.43, 0.50, 0.50)
    colors[clr.BorderShadow]           = ImVec4(0.00, 0.00, 0.00, 0.00)
    colors[clr.MenuBarBg]              = ImVec4(0.14, 0.14, 0.14, 1.00)
    colors[clr.ScrollbarBg]            = ImVec4(0.02, 0.02, 0.02, 0.53)
    colors[clr.ScrollbarGrab]          = ImVec4(0.31, 0.31, 0.31, 1.00)
    colors[clr.ScrollbarGrabHovered]   = ImVec4(0.41, 0.41, 0.41, 1.00)
    colors[clr.ScrollbarGrabActive]    = ImVec4(0.51, 0.51, 0.51, 1.00)
    colors[clr.PlotHistogram]          = ImVec4(0.90, 0.70, 0.00, 1.00)
    colors[clr.PlotHistogramHovered]   = ImVec4(1.00, 0.60, 0.00, 1.00)
end
бро ты слегка разделы перепутал это не для русских Тебе суда
 
  • Эм
  • Bug
Реакции: MLycoris и minxty

AntonAnton123

Активный
172
87
Та не часто, точнее очень редко люди ошибаются темой, а тем более это заграничный гость, могли бы в виде исключения и тут помочь человеку, а то так и останется же тема без ответа
 
  • Нравится
Реакции: stach