Problems with saving Ini file
#1

Errors
Код:
D:\San Andreas Life Roleplay\gamemodes\SAL-RP_script.PWN(340) : error 010: invalid function or declaration
D:\San Andreas Life Roleplay\gamemodes\SAL-RP_script.PWN(11900) : error 017: undefined symbol "ini_CurrentFile"
D:\San Andreas Life Roleplay\gamemodes\SAL-RP_script.PWN(11901) : error 017: undefined symbol "ini_CurrentFile"
D:\San Andreas Life Roleplay\gamemodes\SAL-RP_script.PWN(11930) : error 017: undefined symbol "ini_CurrentFile"
D:\San Andreas Life Roleplay\gamemodes\SAL-RP_script.PWN(11937) : error 017: undefined symbol "ini_CurrentFile"
D:\San Andreas Life Roleplay\gamemodes\SAL-RP_script.PWN(11939) : error 017: undefined symbol "ini_Temp"
D:\San Andreas Life Roleplay\gamemodes\SAL-RP_script.PWN(11941) : error 017: undefined symbol "ini_Temp"
D:\San Andreas Life Roleplay\gamemodes\SAL-RP_script.PWN(11944) : error 017: undefined symbol "ini_Temp"
D:\San Andreas Life Roleplay\gamemodes\SAL-RP_script.PWN(11948) : error 017: undefined symbol "ini_KeyData"
D:\San Andreas Life Roleplay\gamemodes\SAL-RP_script.PWN(11948) : error 029: invalid expression, assumed zero
D:\San Andreas Life Roleplay\gamemodes\SAL-RP_script.PWN(11948) : error 029: invalid expression, assumed zero
D:\San Andreas Life Roleplay\gamemodes\SAL-RP_script.PWN(11948) : fatal error 107: too many error messages on one line
PHP код:
#define MAX_TIME_TO_WAIT 20000 //Max time to wait 20"
#define __isnull(%0)        (%0[0] == 0||(%0[0] == 1&&%0[1] == 0))
#define __strcpy(%0,%1,%2)  strcat((%0[0] = '\0', %0), %1, %2)
#define file_IncVal(%1,%2)  file_SetVal(%1, file_GetVal(%1) + %2)
File:    ini_CurrentFile// 340
        
ini_Temp[MAX_RECORD_LENGTH],
        
ini_OsLineEndLen 2,
        
ini_OsLineEndChar[5],
bool:    ini_FileOpen,
        
ini_KeyData[MAX_RECORDS][MAX_KEY_LENGTH],
        
ini_ValData[MAX_RECORDS][MAX_VAL_LENGTH]; 
PHP код:
stock file_Create(filename[])
{
    if(
fexist(filename))
    {
        
printf("ERROR CREATING FILE : '%s' : FILE ALREADY EXISTS"filename);
        return 
0;
    }
    
ini_CurrentFile fopen(filenameio_write); // 11930
    
fclose(ini_CurrentFile); // 11931
    
return 1;
}
stock file_Delete(filename[])
{
    
fremove(filename);
    return 
1;
}
/*==============================================================================
    Open and Close
==============================================================================*/
stock file_Open(filename[])
{
    if(!
fexist(filename))
    {
        
printf("ERROR: file_Open: File '%s' not found."filename);
        return 
0;
    }
    else
    {
        
ini_CurrentFile fopen(filenameio_read); // 11930
    
}
    new
        
i,
        
delim;
    while(
fread(ini_CurrentFileini_Temp) && (MAX_RECORDS)) // 11937
    
{
        if(
strlen(ini_Temp) && strfind(ini_Tempini_OsLineEndChar) != -1// 11939
        
{
            
strdel(ini_Tempstrlen(ini_Temp) - ini_OsLineEndLenstrlen(ini_Temp)); // 11941
        
}
        
delim strfind(ini_Temp"="); // 11944
        
if(delim != -1)
        {
            
__strcpy(ini_KeyData[i], ini_Tempdelim 1); // 11948
            
__strcpy(ini_ValData[i], ini_Temp[delim 1], MAX_VAL_LENGTH); 
HELP PLEASE!
Reply
#2

You need to use new to declare a variable.

new VARIABLE_NAME = VALUE;
new VARIABLE_NAME;

You must any of the formats mentioned above.

If you are new to variables, check this.

PHP код:
new File:    ini_CurrentFile// 340
        
ini_Temp[MAX_RECORD_LENGTH],
        
ini_OsLineEndLen 2,
        
ini_OsLineEndChar[5],
bool:    ini_FileOpen,
        
ini_KeyData[MAX_RECORDS][MAX_KEY_LENGTH],
        
ini_ValData[MAX_RECORDS][MAX_VAL_LENGTH]; 
Reply
#3

Explain me more please. I don't understand.
Reply
#4

To declare a variable you need to use the following code

new File: some_file,some_integer;

In your code you are doing File: some_file directly.The compiler will think that some_file is already declared and will search for it.Since you are making a new variable you need to prefix it with new.

Replace this
Код:
File:    ini_CurrentFile, // 340
        ini_Temp[MAX_RECORD_LENGTH],
        ini_OsLineEndLen = 2,
        ini_OsLineEndChar[5],
bool:    ini_FileOpen,
        ini_KeyData[MAX_RECORDS][MAX_KEY_LENGTH],
        ini_ValData[MAX_RECORDS][MAX_VAL_LENGTH];
With

Код:
new File:    ini_CurrentFile, // 340
        ini_Temp[MAX_RECORD_LENGTH],
        ini_OsLineEndLen = 2,
        ini_OsLineEndChar[5],
bool:    ini_FileOpen,
        ini_KeyData[MAX_RECORDS][MAX_KEY_LENGTH],
        ini_ValData[MAX_RECORDS][MAX_VAL_LENGTH];
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)