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 


Trainer deactivated on Date

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Twistedfate
Expert Cheater
Reputation: 1

Joined: 11 Mar 2016
Posts: 231

PostPosted: Sun Jan 29, 2017 5:22 pm    Post subject: Trainer deactivated on Date Reply with quote

Is that possible to make the trainer deactivated on specific date ?
- I want the trainer read the date from internet then deactivaed if above or equal .
- ex : If the date above 30/1/2017 then close CE
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Sun Jan 29, 2017 5:50 pm    Post subject: This post has 2 review(s) Reply with quote

Code:
local url = "http://free.timeanddate.com/clock/i5khbhkc/tt1/tw0/tm3/td2"
local http = getInternet()
local response = http.getURL(url)
http.destroy()
local month, day, year = response:match("<span id=t1>(.-)/(.-)/(.-)</span>")
local now = os.time({year=tonumber(year),month=tonumber(month),day=tonumber(day)})
local max = os.time({year=2017,month=1,day=28})
if now > max then
  closeCE()
end
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Sun Jan 29, 2017 6:43 pm    Post subject: Reply with quote

By my experienced, sometimes, user change their computer date to manipulating os.time() and by pass time trial period given.

Code:
--- My old script for TIME TRIAL TRAINER to avoid user change their os.time() to bypass trial
--- Set Time Trial
--- Define your time trial period ----
--- Example for 3 days, start from 26/07/2016 and will end at 31/07/2016

UDF1.hide()
------------------------------- Define time trial variables
time_start = 1469509200    ---- EPOCH Number for date 26/07/2016
time_end = 1469941200      ---- EPOCH Number for data 31/07/2016
time_trial_check=tonumber(os.time())  ---- Convert user computer date to number

------------------------------- Below this line is a function to check valid dates
if time_trial_check < time_start or time_trial_check > time_end then

------------------------------- Show a message if time trial was ended. Or do something
showMessage("Sorry, Trial Over. Contact WHITE HOUSE or FBI")
return
closeCE()
else

------------------------------- If time trial period is valid then show trainer or do something
UDF1.show()
end
Back to top
View user's profile Send private message
dario3star
Newbie cheater
Reputation: 0

Joined: 14 Dec 2020
Posts: 23

PostPosted: Sat Dec 26, 2020 12:16 pm    Post subject: Reply with quote

Zanzer wrote:
Code:
local url = "xxxx//free.timexxxxxcom/clock/i5khbhkc/tt1/tw0/tm3/td2"
local http = getInternet()
local response = http.getURL(url)
http.destroy()
local month, day, year = response:match("<span id=t1>(.-)/(.-)/(.-)</span>")
local now = os.time({year=tonumber(year),month=tonumber(month),day=tonumber(day)})
local max = os.time({year=2017,month=1,day=28})
if now > max then
  closeCE()
end


This actually worked, i tested it on my pc. But the problem is when i disconnect my internet. This picture below shows the error and obviously showing that the code is running on lua (in the second error below), how to remove the error message? and show my custom text error message when/while i disconnect my internet. Thanks.



Capture.JPG
 Description:
 Filesize:  63.1 KB
 Viewed:  2499 Time(s)

Capture.JPG


Back to top
View user's profile Send private message AIM Address
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Sat Dec 26, 2020 1:58 pm    Post subject: This post has 1 review(s) Reply with quote

Add after
Code:
local response = http.getURL(url)

this script

Code:
if (response == nil) then
   showMessage('Internet connection is required!');
   -- return closeCE() -- closes cheat engine;
end

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
dario3star
Newbie cheater
Reputation: 0

Joined: 14 Dec 2020
Posts: 23

PostPosted: Sat Dec 26, 2020 8:37 pm    Post subject: Reply with quote

DaSpamer wrote:
Add after
Code:
local response = http.getURL(url)

this script

Code:
if (response == nil) then
   showMessage('Internet connection is required!');
   -- return closeCE() -- closes cheat engine;
end


Thanks! This worked too, the error message hides the real error. Thumbs up!
Back to top
View user's profile Send private message AIM Address
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