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 


any way to set timer for my trainers?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
abhijeet1001
Advanced Cheater
Reputation: 0

Joined: 10 Apr 2013
Posts: 87

PostPosted: Mon May 06, 2013 2:58 am    Post subject: any way to set timer for my trainers? Reply with quote

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
View user's profile Send private message
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Mon May 06, 2013 6:25 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Mon May 06, 2013 7:04 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Mon May 06, 2013 7:37 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
abhijeet1001
Advanced Cheater
Reputation: 0

Joined: 10 Apr 2013
Posts: 87

PostPosted: Mon May 06, 2013 9:17 am    Post subject: Reply with quote

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
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Mon May 06, 2013 11:59 am    Post subject: Reply with quote

@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 Razz

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
View user's profile Send private message MSN Messenger
abhijeet1001
Advanced Cheater
Reputation: 0

Joined: 10 Apr 2013
Posts: 87

PostPosted: Mon May 06, 2013 11:33 pm    Post subject: Reply with quote

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
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Tue May 07, 2013 5:15 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
abhijeet1001
Advanced Cheater
Reputation: 0

Joined: 10 Apr 2013
Posts: 87

PostPosted: Tue May 07, 2013 9:02 am    Post subject: Reply with quote

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
View user's profile Send private message
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Tue May 07, 2013 4:00 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
abhijeet1001
Advanced Cheater
Reputation: 0

Joined: 10 Apr 2013
Posts: 87

PostPosted: Wed May 08, 2013 2:44 am    Post subject: Reply with quote

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
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