Page 1 of 1

Why does it keep crashing?

Posted: Thu Oct 17, 2024 12:35 pm
by DavideDil
Hello everyone, I wanted to create a trainer in EXE format to mod the FOV of this game, but when I do it on the CE compiler there are no problems. As soon as I export it, it's impossible to use. Could you help me? I was also thinking of finding a way to launch it together with the game so I don’t have to set it up every time. If anyone can give me advice, I would be really happy.

local PROCESS_NAME = 'SparkingZERO-Win64-Shipping.exe'
local DEFAULT_FOV = 100.0

-- Function to set the permanent FOV
local function setPermanentFOV(fovValue)
local address = readPointer(getAddress(PROCESS_NAME .. "+081D4130"))
if address then
address = readPointer(address + 0x0) -- Kept as you had it
if address then
writeFloat(address + 0x2ac, fovValue) -- Write the new FOV value
print(string.format("FOV set to: %.2f", fovValue))
else
print("Invalid memory address.")
end
else
print("Base address not found.")
end
end

-- Main function
local function main()
-- Prompt the user to enter the FOV value
local userInput = inputQuery("Set FOV", "Enter the FOV value:", tostring(DEFAULT_FOV))

-- Check if the user has entered a value
if userInput then
local newFOV = tonumber(userInput) -- Convert the input to a number

-- Check if the value is a valid number
if newFOV then
setPermanentFOV(newFOV) -- Set the permanent FOV
else
print("Invalid value entered. Please make sure to enter a number.")
end
else
print("Input canceled.")
end
end

-- Run the main function
main()