Updates system bug - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Updates system bug (
/showthread.php?tid=620468)
Updates system bug -
NeXoR - 30.10.2016
Hello there fellow scripters, I have some bug in my system
I have 4 types of updates:
Код:
Type 0: Implemented
Type 1: BugFix
Type 2: Required GMX
Type 3: Update
Now I tried to do that when I start the server, it turns all GMX Required to Implemented automatically
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);
}
Updates CMD:
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;
}
The bug is the update is just removed from /Updates.
Anyone a clue ?
Re: Updates system bug - iLearner - 30.10.2016
I suggest using revctrl instead of file.
Re: Updates system bug -
NeXoR - 30.10.2016
Quote:
Originally Posted by iLearner
I suggest using revctrl instead of file.
|
I prefer this, got a clue why it doesn't work ?
Re: Updates system bug -
NeXoR - 31.10.2016
Anyone ?