Jump to content
  • 0

Please help me with the issue of expiry date and comparing file contents


NguyenVinh
 Share

Question

Hi everybody. (I use translator to translate into English)
I'm learning script writing for the game Guardian as well as LUA programming.
I have some questions that I hope someone can answer and help me with.
Problem 1: I have a paragraph like this

Date = "20240730"
date = os.date("%Y%m%d")
if date >= Date then
 print([[⚠ SCRIPT EXPIRED ⚠]])
 return
 end
gg.alert("WELCOME")

In principle, it will expire at 00:00 on July 30, 2024. But if at 23:58 . Jul 29, 2024 I'm running a script, will it exit on the 30th or will the script continue?

problem 2:
Please help me write a scripts to view files and compare file contents. If the file content is different from the content I specified in the scripts, access to the script will be denied.
-- For example:
I have file read.txt
with content: <gameoffline = "offline" gameonline = "online">
In scripts I want to specify
If gameoffline = "offline" gameonline = "online" then continue, otherwise the scripts will exit

I hope everyone can help me with the 2 issues above.
Thank you very much.

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0
On 7/28/2024 at 8:47 PM, NguyenVinh said:

Hi everybody. (I use translator to translate into English)
I'm learning script writing for the game Guardian as well as LUA programming.
I have some questions that I hope someone can answer and help me with.
Problem 1: I have a paragraph like this

Date = "20240730"
date = os.date("%Y%m%d")
if date >= Date then
 print([[⚠ SCRIPT EXPIRED ⚠]])
 return
 end
gg.alert("WELCOME")

In principle, it will expire at 00:00 on July 30, 2024. But if at 23:58 . Jul 29, 2024 I'm running a script, will it exit on the 30th or will the script continue?

problem 2:
Please help me write a scripts to view files and compare file contents. If the file content is different from the content I specified in the scripts, access to the script will be denied.
-- For example:
I have file read.txt
with content: <gameoffline = "offline" gameonline = "online">
In scripts I want to specify
If gameoffline = "offline" gameonline = "online" then continue, otherwise the scripts will exit

I hope everyone can help me with the 2 issues above.
Thank you very much.

1. Script will exit when u launch again(in 07/30), but if u launch 07;29 in 23:58 and will play with script all this time, then when will 07/30 in 00:00 ur script not exit automatically, only when u launch script again 07/30, but maybe u mean something other, idk

2. Idk what u mean

Edited by BloodMoonScript
Link to comment
Share on other sites

  • 0
Posted (edited)
26 phút trước, BloodMoonScript đã nói:

1. Tập lệnh sẽ thoát khi bạn khởi động lại (vào lúc 30/07), nhưng nếu bạn khởi chạy lúc 07;29 lúc 23:58 và sẽ chạy tập lệnh trong suốt thời gian này thì khi nào 07/30 lúc 00 :00 script của bạn sẽ không tự động thoát, chỉ khi bạn khởi chạy lại script vào lúc 30/07, nhưng bạn có thể muốn nói điều gì khác không, tôi không biết.

2. Tôi không biết ý bạn là gì

First of all, I would like to thank you for your reply.
- problem 1 I understood.

- problem 2:
 For example: .
- I have a file (name.lua) in memory. content: -- GameOffline
- In my Script file there is the following condition (I don't know how to present it)
i = GameOffline
If the content of file name.lua is different from (i), it will exit and vice versa.

Edited by NguyenVinh
Link to comment
Share on other sites

  • 0
14 hours ago, NguyenVinh said:

First of all, I would like to thank you for your reply.
- problem 1 I understood.

- problem 2:
 For example: .
- I have a file (name.lua) in memory. content: -- GameOffline
- In my Script file there is the following condition (I don't know how to present it)
i = GameOffline
If the content of file name.lua is different from (i), it will exit and vice versa.

U want make anti rename script?

8 hours ago, HEROGAMEOfficial said:

It's too complicated, it has to be 00:00, use os.time 3600 = 1 day

Better use server time check

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.