Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Cheat engine Trainer with limit user/usage/expiration

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
pepperasd
How do I cheat?
Reputation: 0

Joined: 28 Nov 2020
Posts: 2
Location: NONE

PostPosted: Sat Nov 28, 2020 6:16 am    Post subject: Cheat engine Trainer with limit user/usage/expiration Reply with quote

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
_________________
JHINZXCULTIMATE
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Sat Nov 28, 2020 7:35 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message Visit poster's website
ByTransient
Expert Cheater
Reputation: 5

Joined: 05 Sep 2020
Posts: 240

PostPosted: Sat Nov 28, 2020 11:32 am    Post subject: Reply with quote

Change the version number or remove the member's vip code from the list whenever you want.

https://forum.cheatengine.org/viewtopic.php?t=613418
Back to top
View user's profile Send private message
pepperasd
How do I cheat?
Reputation: 0

Joined: 28 Nov 2020
Posts: 2
Location: NONE

PostPosted: Sun Nov 29, 2020 2:53 am    Post subject: Reply with quote

Thank you will try now.
_________________
JHINZXCULTIMATE
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites