| View previous topic :: View next topic |
| Author |
Message |
abhijeet1001 Advanced Cheater
Reputation: 0
Joined: 10 Apr 2013 Posts: 87
|
Posted: Mon May 06, 2013 2:58 am Post subject: any way to set timer for my trainers? |
|
|
| hello can anybody help i am looking to make a timer for my trainer like i want that my trainer to only work for 4 days and then get inactive so users cant use it after 4days . please help |
|
| Back to top |
|
 |
daspamer Grandmaster Cheater Supreme
Reputation: 54
Joined: 13 Sep 2011 Posts: 1588
|
Posted: Mon May 06, 2013 6:25 am Post subject: |
|
|
| Code: | http = require("socket.http")
local ServerTime = http.request("http://worldtimeengine.com/function/sync")
local CurTime = tonumber(ServerTime:sub(21,-6))
local MaxTime = os.time{year=2013, month=5, day=10, hour=23, min=59, sec=59}
if MaxTime<=CurTime then closeCE() else end |
But you'll need LuaSocket. _________________
I'm rusty and getting older, help me re-learn lua. |
|
| Back to top |
|
 |
mgr.inz.Player I post too much
Reputation: 222
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Mon May 06, 2013 7:04 am Post subject: |
|
|
and if you want timezones to be taken into account, like this:
| Code: | http = require("socket.http")
function timeZone()
local now = os.time()
return os.difftime(now, os.time(os.date('!*t',now)))
end
local ServerTime = http.request("http://worldtimeengine.com/function/sync")
local CurTime = tonumber(ServerTime:sub(21,-6))
local MaxTime = os.time{year=2013, month=5, day=10, hour=23, min=59, sec=59, isdst=false} + timeZone()
if MaxTime<=CurTime then closeCE() else end |
_________________
|
|
| Back to top |
|
 |
daspamer Grandmaster Cheater Supreme
Reputation: 54
Joined: 13 Sep 2011 Posts: 1588
|
Posted: Mon May 06, 2013 7:37 am Post subject: |
|
|
mgr.inz.player, is the http://worldtimeengine.com/function/sync GMT+2 (my region timezone), because it equals to my timezone.
| Code: | http = require("socket.http")
local ServerTime = http.request("http://worldtimeengine.com/function/sync")
local CurTime = tonumber(ServerTime:sub(21,-6))
print(os.date("%c", CurTime))
print(os.date("%c"))
|
which returned me this
| Code: |
05/06/13 15:59:21 -- The worldtimeengine response.
05/06/13 15:59:16 -- My machine time
|
_________________
I'm rusty and getting older, help me re-learn lua. |
|
| Back to top |
|
 |
abhijeet1001 Advanced Cheater
Reputation: 0
Joined: 10 Apr 2013 Posts: 87
|
Posted: Mon May 06, 2013 9:17 am Post subject: |
|
|
| Flash hacker wrote: | | Code: | http = require("socket.http")
local ServerTime = http.request("http://worldtimeengine.com/function/sync")
local CurTime = tonumber(ServerTime:sub(21,-6))
local MaxTime = os.time{year=2013, month=5, day=10, hour=23, min=59, sec=59}
if MaxTime<=CurTime then closeCE() else end |
But you'll need LuaSocket. |
where can i get luasocket ? |
|
| Back to top |
|
 |
mgr.inz.Player I post too much
Reputation: 222
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Mon May 06, 2013 11:59 am Post subject: |
|
|
@Flash hacker
http://worldtimeengine.com/function/sync
Probably this site check your IP, so you always get right time.
Btw. I'm not using TimeZone correction for CurTime, I'm using it for EndTime:
os.time{year=2013, month=5, day=10, hour=23, min=59, sec=59, isdst=false} + timeZone()
I learned that from "Don't Starve" game, there are many interesting functions inside *.lua files
Don't Starve tells you when next update will be released:
gamedir\data\scripts\screens\mainscreen.lua
line 157:
| Code: | local function get_timezone()
local now = os.time()
return os.difftime(now, os.time(os.date("!*t", now)))
end
|
line 163: function GetDaysToUpdate()
Don's Starve is a golden mine...
@abhijeet1001
http://forum.cheatengine.org/viewtopic.php?p=5319284#5319284 _________________
|
|
| Back to top |
|
 |
abhijeet1001 Advanced Cheater
Reputation: 0
Joined: 10 Apr 2013 Posts: 87
|
Posted: Mon May 06, 2013 11:33 pm Post subject: |
|
|
| hi there tried the scripts and also placed filex in lua socket in ce folder CT wrked ok but when i compiled a trainer and run it poped with lua engine and tons of errors saving files not found |
|
| Back to top |
|
 |
mgr.inz.Player I post too much
Reputation: 222
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Tue May 07, 2013 5:15 am Post subject: |
|
|
When you compile a trainer, you must add those folders:
C:\Program Files\Cheat Engine 6\lua
C:\Program Files\Cheat Engine 6\mime
C:\Program Files\Cheat Engine 6\socket _________________
|
|
| Back to top |
|
 |
abhijeet1001 Advanced Cheater
Reputation: 0
Joined: 10 Apr 2013 Posts: 87
|
Posted: Tue May 07, 2013 9:02 am Post subject: |
|
|
| mgr.inz.Player wrote: | When you compile a trainer, you must add those folders:
C:\Program Files\Cheat Engine 6\lua
C:\Program Files\Cheat Engine 6\mime
C:\Program Files\Cheat Engine 6\socket |
ok i did that and it strted to work now i can open my trainer after saving it as .exe and it is also just working fine
but when i tried to check my trainer time security and changed the time the trainer still was working i can still open this is the code that i used in my test trainer i made to test my timer thing
| Code: | http = require("socket.http")
function timeZone()
local now = os.time()
return os.difftime(now, os.time(os.date('!*t',now)))
end
local ServerTime = http.request("http://worldtimeengine.com/function/sync")
local CurTime = tonumber(ServerTime:sub(21,-6))
local MaxTime = os.time{year=2013, month=5, day=7, hour=22, min=32, sec=59, isdst=false} + timeZone()
if MaxTime<=CurTime then closeCE() else end |
but even after the time changed to 22: 50 i could easily open my trainer |
|
| Back to top |
|
 |
daspamer Grandmaster Cheater Supreme
Reputation: 54
Joined: 13 Sep 2011 Posts: 1588
|
Posted: Tue May 07, 2013 4:00 pm Post subject: |
|
|
it uses online server to do so , prevents changing PC time to forward/backward in order to bypass it. _________________
I'm rusty and getting older, help me re-learn lua. |
|
| Back to top |
|
 |
abhijeet1001 Advanced Cheater
Reputation: 0
Joined: 10 Apr 2013 Posts: 87
|
Posted: Wed May 08, 2013 2:44 am Post subject: |
|
|
| Flash hacker wrote: | | it uses online server to do so , prevents changing PC time to forward/backward in order to bypass it. | http=require
("socket.http")
functiontimeZone()
localnow=
os.time()
return
os.difftime(now,
os.time(os.date('!
*t',now)))
end
localServerTime=
http.request
("http://
worldtimeengine.com/
function/sync")
localCurTime=
tonumber
(ServerTime:sub
(21,-6))
localMaxTime=
os.time{year=2013,
month=5,day=7,
hour=22,min=32,
sec=59,
isdst=false}+
timeZone()
ifMaxTime<=CurTime
thencloseCE()else
end ok i saved my trainer .exe with folowing yesterday and i am still able to run it any idea why its 8 th may today |
|
| Back to top |
|
 |
|