30.10.2016, 12:57
Hello there fellow scripters, I have some bug in my system
I have 4 types of updates:
Now I tried to do that when I start the server, it turns all GMX Required to Implemented automatically
This is my code:
OnGameModeInit
Updates CMD:
The bug is the update is just removed from /Updates.
Anyone a clue ?
I have 4 types of updates:
Код:
Type 0: Implemented Type 1: BugFix Type 2: Required GMX Type 3: Update
This is my code:
OnGameModeInit
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);
}
PHP код:
CMD:updates(playerid)
{
new string[128], typestring[8], File:file = fopen("updates.cfg", io_read), idx=1;
SendClientMessage(playerid, COLOR_LIME, "______________ Military VS Terrorists Updates _____________");
new typeName[][] =
{
"[{00AA44}Implemented{FFFFFF}]",
"[{FFFF00}BugFix{FFFFFF}]",
"[{FF0000}GMX Required{FFFFFF}]",
"[{6BFF00}Update{FFFFFF}]"
};
while(fread(file, string))
{
for(new i = 0; i < 4; i++)
{
format(typestring, sizeof(typestring), "type:%d", i);
if(strfind(string, typestring) != -1)
{
strdel(string, strlen(string) - 8, strlen(string));
format(string, sizeof(string), "%d) %s %s", idx, typeName[i], string);
SendClientMessage(playerid, COLOR_WHITE, string);
idx ++;
break;
}
}
}
fclose(file);
return 1;
}
Anyone a clue ?