what is problem with this snippet

Статус
В этой теме нельзя размещать новые ответы.

praiki

Новичок
Автор темы
19
0
Lua:
function is_cp_active()
local handle= loadDynamicLibrary("samp.dll")
local cpmemory = handle + 0x21A10C
cpmemory= readMemory(cpmemory, 4, 0)
cpmemory = cpmemory + 0x24
cpmemory = readMemory(cpmemory, 4, 0)
if cpmemory == true then return true
else
return false
end
freeDynamicLibrary(handle)
end


function get_cp_pos()
local handle =  loadDynamicLibrary("samp.dll")
local cpmemory = handle + 0x21A10C
local X = readMemory(cpmemory, 4, 0)
cpmemory = cpmemory + 0xC
local Y = readMemory(cpmemory, 4, 0)
cpmemory= cpmemory + 0x4
local Z = readMemory(cpmemory, 4, 0)
cpmemory = cpmemory + 0x4
local finalRead = readMemory(cpmemory, 4, 0)
freeDynamicLibrary(handle)
end



--USAGE
if is_cp_active() then
     get_cp_pos(X, Y, Z)
end
 

imring

Ride the Lightning
Всефорумный модератор
2,362
2,548
oh...
Lua:
local memory = require 'memory'

function is_cp_active()
    local res, handle = loadDynamicLibrary("samp.dll")
    if res then
        local misc_info = memory.getuint32(handle + 0x21A10C)
        local cp_enable = memory.getuint32(misc_info + 0x24)
        freeDynamicLibrary(handle)
        return cp_enable == 1
    end
end


function get_cp_pos()
    local res, handle = loadDynamicLibrary("samp.dll")
    if res then
        local misc_info = memory.getuint32(handle + 0x21A10C)
        local x = memory.getfloat(misc_info + 0xC)
        local y = memory.getfloat(misc_info + 0x10)
        local z = memory.getfloat(misc_info + 0x14)
        freeDynamicLibrary(handle)
        return x, y, z
    end
end



--USAGE
if is_cp_active() then
    local X, Y, Z = get_cp_pos()
end
 
  • Нравится
Реакции: praiki

praiki

Новичок
Автор темы
19
0
oh...
Lua:
local memory = require 'memory'

function is_cp_active()
    local res, handle = loadDynamicLibrary("samp.dll")
    if res then
        local misc_info = memory.getuint32(handle + 0x21A10C)
        local cp_enable = memory.getuint32(misc_info + 0x24)
        freeDynamicLibrary(handle)
        return cp_enable == 1
    end
end


function get_cp_pos()
    local res, handle = loadDynamicLibrary("samp.dll")
    if res then
        local misc_info = memory.getuint32(handle + 0x21A10C)
        local x = memory.getfloat(misc_info + 0xC)
        local y = memory.getfloat(misc_info + 0x10)
        local z = memory.getfloat(misc_info + 0x14)
        freeDynamicLibrary(handle)
        return x, y, z
    end
end



--USAGE
if is_cp_active() then
    local X, Y, Z = get_cp_pos()
end

thank you bro, it works perfectly. what i did wrong in my snippet?
 
Статус
В этой теме нельзя размещать новые ответы.