03.11.2016, 21:17
Hey guys, I am improving my updates system, so here's my bug:
I can add GMX Required/Implemented/Update/BugFix as a new update using /addupdate, now I wanted to do that once the game mode starts, every GMX Required turns to Implemented automatically
I am parsing the updates to their types using a "type:%d" parameter
type:1 = implemented
type:2 = bugfix and so on
The problem is that, the update gets removed, but it's not re-written as Implemented
Here is the code:
Thanks in advance.
I can add GMX Required/Implemented/Update/BugFix as a new update using /addupdate, now I wanted to do that once the game mode starts, every GMX Required turns to Implemented automatically
I am parsing the updates to their types using a "type:%d" parameter
type:1 = implemented
type:2 = bugfix and so on
The problem is that, the update gets removed, but it's not re-written as Implemented
Here is the code:
PHP код:
if(!fexist("updates.cfg"))
{
new File:handle = fopen("updates.cfg", io_readwrite);
fclose(handle);
}
else
{
new File:file = fopen("updates.cfg", io_readwrite), idx = 1, string[128];
while(fread(file, string))
{
if(strfind(string, "type:2") != -1)
{
fdeleteline("updates.cfg", idx);
strdel(string, strlen(string) - 8, strlen(string));
strins(string, "type:0", strlen(string), sizeof(string));
fwrite(file, string);
}
idx++;
}
fclose(file);
}