-
Notifications
You must be signed in to change notification settings - Fork 0
/
SaveSwapper.lua
103 lines (94 loc) · 3.12 KB
/
SaveSwapper.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
local file = io.open("swapper.ini", "r")
local repalcevalue
local searchLine
if file then
file:read("*line")
searchLine = file:read("*line")
searchvalue = string.gsub(searchLine, "%s", "")
file:read("*line")
repalcevalue = file:read("*line")
repalcevalue = string.gsub(repalcevalue, "%s", "")
file:close()
else
searchvalue = inputQuery("Value Prompt", "Current XUID (decimal)", "")
repalcevalue = inputQuery("Value Prompt", "Save XUID (decimal)", "")
file = io.open("swapper.ini", "w")
file:write("[AccountXUID]\n" .. searchvalue .. "\n[SaveXUID]\n" .. repalcevalue)
file:close()
end
PROCESS_NAME = "ForzaHorizon5.exe"
local autoAttachTimer = nil
local autoAttachTimerInterval = 100
local autoAttachTimerTicks = 0
local autoAttachTimerTickMax = 5000
local function autoAttachTimer_tick(timer)
if getProcessIDFromProcessName(PROCESS_NAME) ~= nil then
-- Main script ends here
timer.destroy()
openProcess(PROCESS_NAME)
-- Main script starts here
local memscan = createMemScan()
memscan.firstScan(
soExactValue,
vtQword,
rtRounded,
searchvalue,
"",
0,
0xffffffffffffffff,
"+W-X-C",
fsmAligned,
"8",
false,
false,
false,
false
)
memscan.waitTillDone()
local foundlist = createFoundList(memscan)
foundlist.initialize()
if foundlist.Count > 0 then
for i = 0, foundlist.Count - 1 do
local address = foundlist.Address[i]
writeQword(address, repalcevalue)
end
local confirm =
messageDialog("Continue?, Make sure your in menu before pressing Yes", mtConfirmation, mbYesNo)
if confirm == mrYes then
memscan.firstScan(
soExactValue,
vtQword,
rtRounded,
repalcevalue,
"",
0,
0xffffffffffffffff,
"+W-X-C",
fsmAligned,
"8",
false,
false,
false,
false
)
memscan.waitTillDone()
local newfoundlist = createFoundList(memscan)
newfoundlist.initialize()
for i = 0, newfoundlist.Count - 1 do
local address = newfoundlist.Address[i]
writeQword(address, searchvalue)
end
newfoundlist.destroy()
messageDialog("Done", mtInformation, mbYes)
end
end
foundlist.destroy()
memscan.destroy()
elseif autoAttachTimerTickMax > 0 and autoAttachTimerTicks >= autoAttachTimerTickMax then
timer.destroy()
end
autoAttachTimerTicks = autoAttachTimerTicks + 1
end
autoAttachTimer = createTimer(MainForm)
autoAttachTimer.Interval = autoAttachTimerInterval
autoAttachTimer.OnTimer = autoAttachTimer_tick