Updates system bug
#1

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 ?
Reply
#2

I suggest using revctrl instead of file.
Reply
#3

Quote:
Originally Posted by iLearner
Посмотреть сообщение
I suggest using revctrl instead of file.
I prefer this, got a clue why it doesn't work ?
Reply
#4

Anyone ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)