View previous topic :: View next topic |
Author |
Message |
iGuzmonJ How do I cheat? Reputation: 0
Joined: 24 Oct 2014 Posts: 9
|
Posted: Thu Apr 09, 2015 10:36 pm Post subject: Trial Version |
|
|
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 |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8516 Location: 127.0.0.1
|
Posted: Fri Apr 10, 2015 1:08 am Post subject: |
|
|
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 |
|
|
iGuzmonJ How do I cheat? Reputation: 0
Joined: 24 Oct 2014 Posts: 9
|
Posted: Fri Apr 10, 2015 2:58 pm Post subject: |
|
|
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 |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Fri Apr 10, 2015 3:15 pm Post subject: |
|
|
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 |
|
|
iGuzmonJ How do I cheat? Reputation: 0
Joined: 24 Oct 2014 Posts: 9
|
Posted: Wed Apr 15, 2015 1:08 am Post subject: |
|
|
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 |
|
|
hondafrik Advanced Cheater Reputation: 0
Joined: 15 Jan 2014 Posts: 60 Location: Croatia
|
Posted: Mon Sep 21, 2015 1:13 am Post subject: |
|
|
How i can make to script stop work for example on year 2015,month 9 , day 21 and 12:00 pm ?
|
|
Back to top |
|
|
STN I post too much Reputation: 42
Joined: 09 Nov 2005 Posts: 2672
|
Posted: Mon Sep 21, 2015 4:35 am Post subject: |
|
|
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
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 ?
_________________
|
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Mon Sep 21, 2015 5:36 am Post subject: |
|
|
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 |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
|
Back to top |
|
|
|