SA-MP Forums Archive
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 1string[128];
        while(
fread(filestring))
           {
            if(
strfind(string"type:2") != -1)
            {
                
fdeleteline("updates.cfg"idx);
                
strdel(stringstrlen(string) - 8strlen(string));
                
strins(string"type:0"strlen(string), sizeof(string));
                
fwrite(filestring);
            }
            
idx++;
           }
           
fclose(file);
    } 
Updates CMD:
PHP код:
CMD:updates(playerid)
{
    new 
string[128], typestring[8], File:file fopen("updates.cfg"io_read), idx=1;
    
SendClientMessage(playeridCOLOR_LIME"______________ Military VS Terrorists Updates _____________");
       new 
typeName[][] =
    {
        
"[{00AA44}Implemented{FFFFFF}]",
        
"[{FFFF00}BugFix{FFFFFF}]",
        
"[{FF0000}GMX Required{FFFFFF}]",
        
"[{6BFF00}Update{FFFFFF}]"
    
};
     while(
fread(filestring))
       {
        for(new 
04i++)
        {
            
format(typestringsizeof(typestring), "type:%d"i);
            if(
strfind(stringtypestring) != -1)
            {
                
strdel(stringstrlen(string) - 8strlen(string));
                   
format(stringsizeof(string), "%d) %s %s"idxtypeName[i], string);
                   
SendClientMessage(playeridCOLOR_WHITEstring);
                   
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 ?