Posted: Sat Nov 28, 2020 6:16 am Post subject: Cheat engine Trainer with limit user/usage/expiration
Hello, I want to know how to create a Cheat engine trainer with a limit for a single user/ can only be used for a couple of times or has an expiration date. I want to give some cheats to my friends but I don't want then to abuse it anyone can tell me how to do that ? I'm not pro I'm just a newbie . TIA _________________
To limit by user, well you may try to show a window with password or something like that only users with given password may access it, otherwise you will have to set up some sort of a database and authenticate users.
To limit by time or by usage here's some examples.
Code:
-- Limit from registry;
r = getSettings('trainer');
remainingUsage = tonumber(r.nUsed);
if (not remainingUsage) then
r.nUsed = 3;
else
if (remainingUsage <= 0) then
return showMessage('Access denied');
end
r.nUsed = remainingUsage - 1;
end
remainingUsage = tonumber(r.nUsed); -- update number for message popup
showMessage(remainingUsage <= 0 and 'Last time you may use this trainer'
or ('You may use only for additional %d times'):format(remainingUsage)); -- if else end ..
-- limit by time;
maxTS = os.time({year = 2020, month=11, day = 30})
curTS = os.time(); -- can be bypassed by changing local time backwards
--[[ -- uncomment this to use internet and fetch timestamp from some website
int = getInternet();
response = int.getURL('http://worldtimeapi.org/api/ip');
if (response) then
curTS = tonumber(response:match('unixtime":(%d+),"'))
else
-- error...
end
--]]
dTS = maxTS - curTS; -- delta between end time and current time;
if (dTS <= 0) then -- time exceeded
showMessage('Access denied');
end
local thrs = dTS / 3600 -- convert from seconds to hours;
local days = dTS // 86400;
local hours = dTS % 86400 / 3600;
if (days > 0) then
showMessage(('You have %d days and %.2f hours left'):format(days,hours));
else
showMessage(('You have %.2f hours left'):format(hours));
end
_________________
I'm rusty and getting older, help me re-learn lua.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum