Help reading file and date
Hi! I want to read more dates from a file, and then check if that date is today.
I don't really have a code now, idk if that is a problem... I was tasked with this today, and i am trying to figure out how to read multiple lines and check the date. If i need a code first, sorry. |
Re: Help reading file and date
What do you mean that you were "tasked with this today"? Is this some sort of homework?
If not, then you should try to do it and post the code that you tried so that we can give you advice. |
Re: Help reading file and date
No, it's not like a homework, it is for a server in my comunity...
|
Re: Help reading file and date
Check what date? Where is the date? Give an example of how the lines in the file look like. We can't use crystal balls here.
|
Re: Help reading file and date
Code:
public CheckFile()here is the File i have, this part works, but i don't know how to take current server date... EDIT: Here is the code that is checking the dates, but, somehow, it says that the strings don't match... Code:
public CheckDateAndTime()Code:
07/01/2019 |
Re: Help reading file and date
Provide the GatherData[] array declaration. Your code looks overly complicated for what I think you're trying to do. Can you explain more what your intending to do (do not explain in code).
Also, you could store the time/date as a 4-byte unix timestamp and simplify this: 1546903919 = 01/07/2019 @ 11 : 31pm |
Re: Help reading file and date
Code:
new GatherData[3][17]So, i want to read a date from a file (MAX is 3) and if that date is today, the plugin should do something. |
Re: Help reading file and date
Quote:
Also it would be better if you could translate that code. At least we can know what plugin you want to make ... |
Re: Help reading file and date
Work with timestamps. Read the date from file and use parse_time on it, this will return the corresponding timestamp. Then, use get_systime to get the current time stamp and compare this two.
|
Re: Help reading file and date
Quote:
Edit: It still doesn't work. Here is the full plugin: Code:
#include <amxmodx> |
| All times are GMT -4. The time now is 07:34. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.