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 


Trial Version

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

Joined: 24 Oct 2014
Posts: 9

PostPosted: Thu Apr 09, 2015 10:36 pm    Post subject: Trial Version Reply with quote

All I want to know is what coding would I need to put in at the beginning of my script that checks to see what the date is for when someone uses my tool, and if it's pass the day the trial is supposed to be ended, it will leave a message and terminate. Idk if this is possible but I really need this. And if this is possible too, the way the date is checked, can it be checked through some server thing so when someone changes the date in the computer settings, they can't still use the trial version? Sorry if I'm asking for a bit too much.
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8516
Location: 127.0.0.1

PostPosted: Fri Apr 10, 2015 1:08 am    Post subject: Reply with quote

Lua exposes the system date through:
os.date()

You can read more about it from the Lua website here:
http://www.lua.org/pil/22.1.html

And yes you can do web server checks using LuaSocket. There are some threads about LuaSocket around the forums here that you should be able to find with examples and such of using a website etc.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
iGuzmonJ
How do I cheat?
Reputation: 0

Joined: 24 Oct 2014
Posts: 9

PostPosted: Fri Apr 10, 2015 2:58 pm    Post subject: Reply with quote

This didn't help me out what so ever. All I want to know is how would I turn my trainer into a trial based trainer. Meaning once it's a certain date that the trial is suppose to end, it won't let them use the trainer. No complicated answers.
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Fri Apr 10, 2015 3:15 pm    Post subject: Reply with quote

Answers are only complicated when you don't know what you're doing.

Code:
TRIAL_TIME = os.time{year=2015, month=4, day=11}
if os.time() > TRIAL_TIME then
  return
end
print("working")


You'll need to connect to some server to give you the actual time instead of relying on os.time() inside the if statement.
Back to top
View user's profile Send private message
iGuzmonJ
How do I cheat?
Reputation: 0

Joined: 24 Oct 2014
Posts: 9

PostPosted: Wed Apr 15, 2015 1:08 am    Post subject: Reply with quote

Thanks dude I really appreciate it. I can find another way to make it so changing the date won't do anything.
Back to top
View user's profile Send private message
hondafrik
Advanced Cheater
Reputation: 0

Joined: 15 Jan 2014
Posts: 60
Location: Croatia

PostPosted: Mon Sep 21, 2015 1:13 am    Post subject: Reply with quote

How i can make to script stop work for example on year 2015,month 9 , day 21 and 12:00 pm ?
Back to top
View user's profile Send private message
STN
I post too much
Reputation: 42

Joined: 09 Nov 2005
Posts: 2672

PostPosted: Mon Sep 21, 2015 4:35 am    Post subject: Reply with quote

http://www.lua.org/pil/22.1.html

Look at the examples

-- obs: 10800 = 3*60*60 (3 hours)
print(os.time{year=1970, month=1, day=1, hour=0})
--> 10800

To produce a date table, we use the format string "*t". For instance, the following code

temp = os.date("*t", 906000490)
produces the table
{year = 1998, month = 9, day = 16, yday = 259, wday = 4,
hour = 23, min = 48, sec = 10, isdst = false}


Convert that to the desired date for you and compare if that day reaches. When it does stop the trainer working

EDIT: nvm look at Zanzer post...Sigh Rolling Eyes

TRIAL_TIME = os.time{year=2015, month=4, day=11}
if os.time() > TRIAL_TIME then
return
end
print("working")

You seriously can't figure out how to make trial time to be your desired time ?

_________________
Cheat Requests/Tables- Fearless Cheat Engine
https://fearlessrevolution.com
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Mon Sep 21, 2015 5:36 am    Post subject: Reply with quote

Zanzer :
Code:

Answers are only complicated when you don't know what you're doing.

Code:   
TRIAL_TIME = os.time{year=2015, month=4, day=11}
if os.time() > TRIAL_TIME then
  return
end
print("working")   


You'll need to connect to some server to give you the actual time instead of relying on os.time() inside the if statement.


Here functions to get actual time mentioned by Zanzer

Code:

The following function portably returns a timezone string in the form +hhmm or -hhmm.
One cannot use os.date("%z") as the format of its return value is non-portable;
in particular, Windows systems don't use the C99 semantics for strftime().

The following code should portably produce a timezone string for the current local time.
NOTE: the following only computes the timezone offset for "now", which differs from os.date("%z")
which can handle  times in the past or future, taking daylight savings time into account.

Alternatively, you can use get_timezone_anystamp(ts) below



-- Compute the difference in seconds between local time and UTC.
local function get_timezone()
  local now = os.time()
  return os.difftime(now, os.time(os.date("!*t", now)))
end
timezone = get_timezone()

-- Return a timezone string in ISO 8601:2000 standard form (+hhmm or -hhmm)
local function get_tzoffset(timezone)
  local h, m = math.modf(timezone / 3600)
  return string.format("%+.4d", 100 * h + 60 * m)
end
tzoffset = get_tzoffset(timezone)


--[[ debugging
for _, tz in ipairs(arg) do
  if tz == '-' then
    tz = timezone
  else
    tz = 0 + tz
  end
  print(tz, get_tzoffset(tz))
end
--]]


-- return the timezone offset in seconds, as it was on the time given by ts
local function get_timezone_offset(ts)
   local utcdate   = os.date("!*t", ts)
   local localdate = os.date("*t", ts)
   localdate.isdst = false -- this is the trick
   return os.difftime(os.time(localdate), os.time(utcdate))
end
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Tue Sep 22, 2015 10:52 pm    Post subject: Reply with quote

Or see this

http://forum.cheatengine.org/viewtopic.php?t=584342
Back to top
View user's profile Send private message
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