Code:
public CheckFile()
{
new dir[33]
get_configsdir(dir,charsmax(dir))
new FILE[65]
format(FILE,charsmax(FILE),"%s/LaLeaganeGather.txt",dir)
if(!file_exists(FILE))
{
write_file(FILE,"; Exemplu adaugare data: 08/01/2019",0)
write_file(FILE,"; Pentru a adauga un interval orar, scrie doar ora inceperii gather-ului.",1)
write_file(FILE,"; Exemplu: Linia 1 08/01/2019 Linia 2 19:30",2)
write_file(FILE,"; Echipa LaLeagane va ureaza distractie placuta tuturor!")
log_amx("Nu am gasit fisierul pentru Gather, asa ca am creat noi unul!")
return PLUGIN_HANDLED
}
new ReadData = 0
new Dataitem = 0
new Houritem = 0
new f = fopen(FILE,"r")
while(!feof(f))
{
new szLine[17]
fgets(f,szLine,charsmax(szLine))
if(!szLine[0] || szLine[0] == ';')
{
continue;
}
if(Dataitem > 2 || Houritem > 2)
{
log_amx("Ai introdus mai mult de 3 dati in fisierul LaLeaganeGather")
}
if(ReadData == 0)
{
format(GatherData[Dataitem],16,"%s",szLine)
Dataitem += 1
ReadData = 1
}
else
{
format(GatherOra[Houritem],16,"%s",szLine)
Houritem += 1
ReadData = 0
}
}
// DEBUG
for(new i = 0; i < 3; i++)
{
log_amx("%s - Data",GatherData[i])
log_amx("%s - Ora",GatherOra[i])
}
return PLUGIN_HANDLED
}
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()
{
new DataCurenta[16]
get_time("%d/%m/%Y",DataCurenta,charsmax(DataCurenta))
log_amx("%s",DataCurenta)
for(new i = 0; i < 3; i++)
{
log_amx("%s - %d",GatherData[i],i)
if(strcmp(GatherData[i],DataCurenta) == 0)
{
log_amx("1")
}
else
{
log_amx("0")
}
}
}
Here is the file:
Code:
07/01/2019
5995:4000
09/01/2019
6000