Skip to content

Instantly share code, notes, and snippets.

@LinZap
Last active March 4, 2019 03:34
Show Gist options
  • Save LinZap/e1f4b05deee475c2df792635c16e598f to your computer and use it in GitHub Desktop.
Save LinZap/e1f4b05deee475c2df792635c16e598f to your computer and use it in GitHub Desktop.
Teleport to Waypoint
{$lua}
-- 地圖標記
-- BlipPTR = aobscanmodule(BlipPTR,GTA5.exe,4C 8D 05 ? ? ? ? 0F B7 C1)
local a = getAddress("BlipPTR")
-- 掃描 0~2000
for i = 2000, 1, -1
do
-- 1 byte = 8 bit
-- 取得記憶體位置以8為倍數掃描 BlipPTR + (i * 8)
local n = readPointer(a + (i * 8))
-- 如果記憶體位置 +64 數值是 8,記憶體位置 +72 數值是 84,就表示抓到儲存地圖標記的記憶體位置
if (n & 0) and (8 == readInteger(n + 0x40)) and (84 == readInteger(n + 0x48))
then
-- 取得地圖標記座標
-- 記憶體位置 + 16 的位置存放 X 座標
local x = readFloat(n + 0x10)
-- 記憶體位置 + 20 的位置存放 Y 座標
local y = readFloat(n + 0x14)
-- 取得人物當前座標
-- WorldPTR = aobscanmodule(WorldPTR,GTA5.exe,48 8B 05 ? ? ? ? 45 ? ? ? ? 48 8B 48 08 48 85 C9 74 07)
-- 人物的記憶體位置,存放於 (WorldPTR 位置 + 8) 的 位置
local p = readPointer(readPointer(getAddress("WorldPTR")) + 8)
-- 如果該位置 + 5224 的數值是 2,表示抓到
if (2 == readInteger(p + 0x1468))
then
-- 人物所在位置 記憶體位置 存放於 該位置 + 3368 位置的數值中
p = readPointer(p + 0xD28)
end
-- 攝影機則存在該位置 + 48 的記憶體位置中
local v = readPointer(p + 0x30)
-- 攝影機 X 座標 + 80 的位置中,寫入地圖標記的 X 位置
writeFloat(v + 0x50, x)
-- 攝影機 Y 座標 + 84 的位置中,寫入地圖標記的 Y 位置
writeFloat(v + 0x54, y)
-- 攝影機 Z 座標 + 88 的位置中,寫入地圖標記的 Z 位置 (統一給 -210)
writeFloat(v + 0x58, -210)
-- 人物 X 座標 + 80 的位置中,寫入地圖標記的 X 位置
writeFloat(p + 0x90, x)
-- 人物 Y 座標 + 84 的位置中,寫入地圖標記的 Y 位置
writeFloat(p + 0x94, y)
-- 人物 Z 座標 + 88 的位置中,寫入地圖標記的 Z 位置 (統一給 -210)
writeFloat(p + 0x98, -210)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment