Lua Get memory 0.3.7 0.3DL

horacy

Известный
Автор темы
102
92
Версия SA-MP
  1. 0.3.7 (R1)
  2. 0.3DL
Get memory - is a script with which you can get a hexadecimal memory address that you can use in lua. Now all you have to do is get the pointer in the cheat engine e.g. life values and rewrite the module, base address and offset to the function and then you will get a memory address such as permanent gta memory addresses. Remember to use the "valueadr" variable in your script because the address changes when the game is restarted.

you have two versions of the script to choose from, the first one is to activate it with a function call, e.g. 'getmem (' gta_sa.exe ', 0x76F3B8, 0x540, false)'. The second version is saved in the function that the main function activates.


(the most important descriptions are in squares)


address.png

Get memory - это сценарий, с помощью которого вы можете получить шестнадцатеричный адрес памяти, который вы можете использовать в lua. Теперь все, что вам нужно сделать, это получить указатель в чит-движке, например, жизненные значения, и переписать модуль, базовый адрес и смещение функции, а затем вы получите адрес памяти, такой как постоянные адреса памяти GTA. Не забудьте использовать в скрипте переменную valueadr, потому что адрес меняется при перезапуске игры.

у вас есть две версии скрипта на выбор, первая - активировать его, вызвав функцию, например, getmem ('gta_sa.exe', 0x76F3B8, 0x540, false) '. Вторая версия хранится в функции, которую активирует основная функция.



(важнейшие описания в квадратах)

address.png


full codes in the attachment
I allow any use provided that the authorship is preserved!
любое использование скрипта, пока моя подпись в скрипте!


Function 0.3.7:
--Getmem by: Horacy
--Discord: Thorus#3048
local memory = require 'memory'
local hex = ('%x'):format(0)
local valueadr = 0 --result

--[[Now use getmem('base module', base hex part module, offset, bool protected, type value)
typev
1 float
2 double
3 int8
4 int32
5 int16
6 int64
7 uint8
8 uint16
9 uint32
10 uint64

example: getmem('gta_sa.exe', 0x38E50, 0x0, false, 1)
]]

function  test()
getmem('gta_sa.exe', 0x76F3B8, 0x540, false, 1)
end

function getmem(baseadr, baseadr1, hexpointer, protect, typev)
modulehandle = getModuleHandle(baseadr)
fulladr = memory.getint32(modulehandle + baseadr1)
hex = '0x'..dec_to_hex(fulladr)
if typev == 1 then
valueadr = memory.getfloat(hex + hexpointer, protect)
elseif typev == 2 then
valueadr = memory.getdouble(hex + hexpointer, protect)
elseif typev == 3 then
valueadr = memory.getint8(hex + hexpointer, protect)
elseif typev == 4 then
valueadr = memory.getint32(hex + hexpointer, protect)
elseif typev == 5 then
valueadr = memory.getint16(hex + hexpointer, protect)
elseif typev == 6 then
valueadr = memory.getint64(hex + hexpointer, protect)
elseif typev == 7 then
valueadr = memory.getuint8(hex + hexpointer, protect)
elseif typev == 8 then
valueadr = memory.getuint16(hex + hexpointer, protect)
elseif typev == 9 then
valueadr = memory.getuint32(hex + hexpointer, protect)
elseif typev == 10 then
valueadr = memory.getuint64(hex + hexpointer, protect)
else
sampAddChatMessage('{0400ff}[Getmem] Invalid type', -1)
state = false
end
sampAddChatMessage('')
sampAddChatMessage('{0400ff}[Getmem] MODULE name: {FFFFFF}'..baseadr, -1)
sampAddChatMessage('{0400ff}[Getmem] MODULE handle: {FFFFFF}'..modulehandle, -1)
sampAddChatMessage('{0400ff}[Getmem] DEC base adr: {FFFFFF}'..fulladr, -1)
sampAddChatMessage('{0400ff}[Getmem] HEX base adr: {FFFFFF}'..hex, -1)

if  typev == 1 then
sampAddChatMessage('{0400ff}[Getmem] float: {FFFFFF}'..valueadr, -1)
elseif typev == 2 then
sampAddChatMessage('{0400ff}[Getmem] double: {FFFFFF}'..valueadr, -1)
elseif typev == 3 then
sampAddChatMessage('{0400ff}[Getmem] int8: {FFFFFF}'..valueadr, -1)
elseif typev == 4 then
sampAddChatMessage('{0400ff}[Getmem] int32: {FFFFFF}'..valueadr, -1)
elseif typev == 5 then
sampAddChatMessage('{0400ff}[Getmem] int16: {FFFFFF}'..valueadr, -1)
elseif typev == 6 then
sampAddChatMessage('{0400ff}[Getmem] int64: {FFFFFF}'..valueadr, -1)
elseif typev == 7 then
sampAddChatMessage('{0400ff}[Getmem] uint8: {FFFFFF}'..valueadr, -1)
elseif typev == 8 then
sampAddChatMessage('{0400ff}[Getmem] uint16: {FFFFFF}'..valueadr, -1)
elseif typev == 9 then
sampAddChatMessage('{0400ff}[Getmem] uint32: {FFFFFF}'..valueadr, -1)
elseif typev == 10 then
sampAddChatMessage('{0400ff}[Getmem] uint64: {FFFFFF}'..valueadr, -1)
else
sampAddChatMessage('{0400ff}[Getmem] Invalid type', -1)
state = false
end
sampAddChatMessage('')
end

function dec_to_hex(dec)
--source https://www.blast.hk/threads/13380/post-548435
  if type(dec) ~= "number" then
    sampAddChatMessage("[Ошибка]: {FFFFFF}Тип значения не числовой.", 0xFF0000)
  end
  if dec - math.floor(dec) > 0 then
    sampAddChatMessage("[Ошибка]: {FFFFFF}Попытка применить побитовую операцию к нецелому числу.", 0xFF0000)
  end
  if dec < 0 then
    dec = bit.tobits(bit.bnot(math.abs(dec)) + 1)
    dec = bit.tonumb(dec)
  end
  local hex_tbl = {'A', 'B', 'C', 'D', 'E', 'F'}
  local hex = ""
  while dec ~= 0 do
    last = math.fmod(dec, 16)
    if last < 10 then
      hex = tostring(last) .. hex
    else
      hex = hex_tbl[last - 10 + 1] .. hex
    end
    dec = math.floor(dec / 16)
  end
  if hex == "" then
    hex = "0"
  end
  return hex
end

Function 0.3DL:
--Getmem by: Horacy
--Discord: Thorus#3048
local dl = require "lib.SA-MP API.init"
local memory = require 'memory'
local hex = ('%x'):format(0)
local valueadr = 0 --result

--[[Now use getmem('base module', base hex part module, offset, bool protected, type value)
typev
1 float
2 double
3 int8
4 int32
5 int16
6 int64
7 uint8
8 uint16
9 uint32
10 uint64

example: getmem('gta_sa.exe', 0x38E50, 0x0, false, 1)
]]

function  test()
getmem('gta_sa.exe', 0x76F3B8, 0x540, false, 1)
end

function getmem(baseadr, baseadr1, hexpointer, protect, typev)
modulehandle = getModuleHandle(baseadr)
fulladr = memory.getint32(modulehandle + baseadr1)
hex = '0x'..dec_to_hex(fulladr)
if typev == 1 then
valueadr = memory.getfloat(hex + hexpointer, protect)
elseif typev == 2 then
valueadr = memory.getdouble(hex + hexpointer, protect)
elseif typev == 3 then
valueadr = memory.getint8(hex + hexpointer, protect)
elseif typev == 4 then
valueadr = memory.getint32(hex + hexpointer, protect)
elseif typev == 5 then
valueadr = memory.getint16(hex + hexpointer, protect)
elseif typev == 6 then
valueadr = memory.getint64(hex + hexpointer, protect)
elseif typev == 7 then
valueadr = memory.getuint8(hex + hexpointer, protect)
elseif typev == 8 then
valueadr = memory.getuint16(hex + hexpointer, protect)
elseif typev == 9 then
valueadr = memory.getuint32(hex + hexpointer, protect)
elseif typev == 10 then
valueadr = memory.getuint64(hex + hexpointer, protect)
else
dl.AddMessageToChat(4, "[Getmem] Invalid type", "", 0xFFFFFF, 0x0400ff)
state = false
end
dl.AddMessageToChat(4, "", "", 0x000000, 0xFFFFFF)
dl.AddMessageToChat(2, ""..baseadr, "[Getmem] Module name:", 0xFFFFFF, 0x0400ff)
dl.AddMessageToChat(2, ""..modulehandle, "[Getmem] MODULE handle:", 0xFFFFFF, 0x0400ff)
dl.AddMessageToChat(2, ""..fulladr, "[Getmem] DEC base adr:", 0xFFFFFF, 0x0400ff)
dl.AddMessageToChat(2, ""..hex, "[Getmem] HEX base adr:", 0xFFFFFF, 0x0400ff)
if  typev == 1 then
dl.AddMessageToChat(2, ""..valueadr, "[Getmem] float:", 0xFFFFFF, 0x0400ff)
elseif typev == 2 then
dl.AddMessageToChat(2, ""..valueadr, "[Getmem] double:", 0xFFFFFF, 0x0400ff)
elseif typev == 3 then
dl.AddMessageToChat(2, ""..valueadr, "[Getmem] int8:", 0xFFFFFF, 0x0400ff)
elseif typev == 4 then
dl.AddMessageToChat(2, ""..valueadr, "[Getmem] int32:", 0xFFFFFF, 0x0400ff)
elseif typev == 5 then
dl.AddMessageToChat(2, ""..valueadr, "[Getmem] int16:", 0xFFFFFF, 0x0400ff)
elseif typev == 6 then
dl.AddMessageToChat(2, ""..valueadr, "[Getmem] int64:", 0xFFFFFF, 0x0400ff)
elseif typev == 7 then
dl.AddMessageToChat(2, ""..valueadr, "[Getmem] uint8:", 0xFFFFFF, 0x0400ff)
elseif typev == 8 then
dl.AddMessageToChat(2, ""..valueadr, "[Getmem] uint16:", 0xFFFFFF, 0x0400ff)
elseif typev == 9 then
dl.AddMessageToChat(2, ""..valueadr, "[Getmem] uint32:", 0xFFFFFF, 0x0400ff)
elseif typev == 10 then
dl.AddMessageToChat(2, ""..valueadr, "[Getmem] uint64:", 0xFFFFFF, 0x0400ff)
else
dl.AddMessageToChat(4, "[Getmem] Invalid type", "", 0xFFFFFF, 0x0400ff)
state = false
end
dl.AddMessageToChat(4, " ", "", 0x000000, 0xFFFFFF)
end


function dec_to_hex(dec)
--source https://www.blast.hk/threads/13380/post-548435
  if type(dec) ~= "number" then
    --sampAddChatMessage("[Ошибка]: {FFFFFF}Тип значения не числовой.", 0xFF0000)
  end
  if dec - math.floor(dec) > 0 then
    --sampAddChatMessage("[Ошибка]: {FFFFFF}Попытка применить побитовую операцию к нецелому числу.", 0xFF0000)
  end
  if dec < 0 then
    dec = bit.tobits(bit.bnot(math.abs(dec)) + 1)
    dec = bit.tonumb(dec)
  end
  local hex_tbl = {'A', 'B', 'C', 'D', 'E', 'F'}
  local hex = ""
  while dec ~= 0 do
    last = math.fmod(dec, 16)
    if last < 10 then
      hex = tostring(last) .. hex
    else
      hex = hex_tbl[last - 10 + 1] .. hex
    end
    dec = math.floor(dec / 16)
  end
  if hex == "" then
    hex = "0"
  end
  return hex
end
0.3DL Requires: https://www.blast.hk/threads/43706/
 

Вложения

  • getmemory.lua
    6.5 KB · Просмотры: 62
  • getmem03dl.lua
    6.9 KB · Просмотры: 23
Последнее редактирование:

kin4stat

mq-team · kin4@naebalovo.team
Всефорумный модератор
2,743
4,804
What if my memory address contains double or uint8?
Useless script
Спойлер: Source DEC to HEX function
Lua:
function dec_to_hex(dec)
    return string.format("%x", dec)
end
 
  • Нравится
Реакции: Smeruxa

horacy

Известный
Автор темы
102
92
What if my memory address contains double or uint8?
Useless script

Lua:
function dec_to_hex(dec)
    return string.format("%x", dec)
end
what's the problem to add a memory reading the kind of number we need?
just change the memory read type of the valueadr variable, example on the money memory address.
////////////////
Updated script, now it is possible to select all possible value types. The next update will be to rewrite the script to 0.3DL if it succeeds.
///////////////
mem.png



Код:
local memory = require 'memory'
local hex = ('%x'):format(0)
--local valueadr = 0
state = false


function main()
    repeat wait(0) until isSampAvailable()
sampAddChatMessage('{0400ff}[Getmem] by: {ffffff}Horacy')
sampAddChatMessage('{0400ff}[Getmem] Discord: {ffffff}Thorus#3048')
    sampRegisterChatCommand('getmem', function()
        state = not state
        if state then
            lua_thread.create(function()
                while state do
                    wait(1)
                    get()
                end
            end)
           
        else
           
        end
    end)
    wait(-1)
end


function get()
baseadr = 'gta_sa.exe'
modulehandle = getModuleHandle(baseadr)
fulladr = memory.getint32(modulehandle + 0x38E50)
hex = '0x'..dec_to_hex(fulladr)
valueadr = memory.getfloat(hex + 0x0, false)
double = memory.getdouble(hex + 0x0, false)
uint8 = memory.getuint8(hex + 0x0, false)
int32 = memory.getint32(hex + 0x0, false)
sampAddChatMessage('')
sampAddChatMessage('{0400ff}[Getmem] MODULE name: {FFFFFF}'..baseadr, -1)
sampAddChatMessage('{0400ff}[Getmem] MODULE handle: {FFFFFF}'..modulehandle, -1)
sampAddChatMessage('{0400ff}[Getmem] DEC base adr: {FFFFFF}'..fulladr, -1)
sampAddChatMessage('{0400ff}[Getmem] HEX base adr: {FFFFFF}'..hex, -1)
sampAddChatMessage('{0400ff}[Getmem] float: {FFFFFF}'..valueadr, -1)
sampAddChatMessage('{0400ff}[Getmem] double: {FFFFFF}'..double, -1)
sampAddChatMessage('{0400ff}[Getmem] uint8: {FFFFFF}'..uint8, -1)
sampAddChatMessage('{0400ff}[Getmem] uint32: {FFFFFF}'..int32, -1)
sampAddChatMessage('')
state = false
end

function getmem(baseadr, baseadr1, hexpointer, protect)
modulehandle = getModuleHandle(baseadr)
fulladr = memory.getint32(modulehandle + baseadr1)
hex = '0x'..dec_to_hex(fulladr)
valueadr = memory.getfloat(hex + hexpointer, protect)
sampAddChatMessage('')
sampAddChatMessage('{0400ff}[Getmem] MODULE name: {FFFFFF}'..baseadr, -1)
sampAddChatMessage('{0400ff}[Getmem] MODULE handle: {FFFFFF}'..modulehandle, -1)
sampAddChatMessage('{0400ff}[Getmem] DEC base adr: {FFFFFF}'..fulladr, -1)
sampAddChatMessage('{0400ff}[Getmem] HEX base adr: {FFFFFF}'..hex, -1)
sampAddChatMessage('{0400ff}[Getmem] VALUE base adr + pointer: {FFFFFF}'..valueadr, -1)

sampAddChatMessage('')
end

function dec_to_hex(dec)
--source https://www.blast.hk/threads/13380/post-548435
  if type(dec) ~= "number" then
    sampAddChatMessage("[Ошибка]: {FFFFFF}Тип значения не числовой.", 0xFF0000)
  end
  if dec - math.floor(dec) > 0 then
    sampAddChatMessage("[Ошибка]: {FFFFFF}Попытка применить побитовую операцию к нецелому числу.", 0xFF0000)
  end
  if dec < 0 then
    dec = bit.tobits(bit.bnot(math.abs(dec)) + 1)
    dec = bit.tonumb(dec)
  end
  local hex_tbl = {'A', 'B', 'C', 'D', 'E', 'F'}
  local hex = ""
  while dec ~= 0 do
    last = math.fmod(dec, 16)
    if last < 10 then
      hex = tostring(last) .. hex
    else
      hex = hex_tbl[last - 10 + 1] .. hex
    end
    dec = math.floor(dec / 16)
  end
  if hex == "" then
    hex = "0"
  end
  return hex
end
 
Последнее редактирование: