local memory = require("memory")
local CDialog, CDXUTDialog = 0, 0
-- Parts of the code taken from here: https://www.blast.hk/threads/81316/
function main()
while not isSampAvailable() do wait(0) end
CDialog = sampGetDialogInfoPtr()
CDXUTDialog = memory.getuint32(CDialog + 0x1C) -- R1/R3 offset --
wait(-1)
end
function onWindowMessage(msg, wparam, lparam)
if msg == 261 or msg == 0x0100 and wparam == 13 or wparam == 0x78 or wparam == 0x5B or wparam == 0x4D or wparam == 0x4C or wparam == 0x5B or wparam == 0x1B then
if sampIsDialogActive() then
sampSetDialogPos(sampGetDialogPos())
end
end
end
function sampGetDialogPos()
return memory.getint32(CDialog + 0x04, true),
memory.getint32(CDialog + 0x08, true)
end
function sampSetDialogPos(x, y)
memory.setint32(CDialog + 0x04, x, true)
memory.setint32(CDialog + 0x08, y, true)
memory.setint32(CDXUTDialog + 0x116, x, true)
memory.setint32(CDXUTDialog + 0x11A, y, true)
end