SA-MP Forums Archive
y_ini errors - 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: y_ini errors (/showthread.php?tid=472864)



y_ini errors - Tagathron - 31.10.2013

Код:
new string[128];
	new
	INI:ini = INI_Open("testi.ini");
	INI:testi.ini[TESTINGTAG](name[], value[]) // LINE 21
	{
	    INI_String("EXAMPLESTRING", string, sizeof(string));
	}
	printf("%s", string);
Compiler errors
Код:
error 029: invalid expression, assumed zero
error 017: undefined symbol "@INI_testi"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
All of the errors are at line 21

I'm trying to read the value from the file,and i'm reading from the y_ini topic : https://sampforum.blast.hk/showthread.php?tid=175565


Re: y_ini errors - Konstantinos - 31.10.2013

It should be outside of any callback. An example:
pawn Код:
new sz_String[128];

main( )
{
    /*
    new
        INI:ini = INI_Open("testi.ini")
    ;
    INI_SetTag(ini, "TESTINGTAG");
    INI_WriteString(ini, "EXAMPLESTRING", "Hello Tagathron!");
    INI_Close(ini);
    */


    INI_Load("testi.ini");
   
    printf( "EXAMPLESTRING: \"%s\"", sz_String );
}

INI:testi[TESTINGTAG](name[], value[])
{
    INI_String("EXAMPLESTRING", sz_String, sizeof(sz_String));
    return 0;
}
pawn Код:
// OUTPUT:
[12:42:08] EXAMPLESTRING: "Hello Tagathron!"



Re: y_ini errors - Tagathron - 31.10.2013

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
It should be outside of any callback. An example:
pawn Код:
new sz_String[128];

main( )
{
    /*
    new
        INI:ini = INI_Open("testi.ini")
    ;
    INI_SetTag(ini, "TESTINGTAG");
    INI_WriteString(ini, "EXAMPLESTRING", "Hello Tagathron!");
    INI_Close(ini);
    */


    INI_Load("testi.ini");
   
    printf( "EXAMPLESTRING: \"%s\"", sz_String );
}

INI:testi[TESTINGTAG](name[], value[])
{
    INI_String("EXAMPLESTRING", sz_String, sizeof(sz_String));
    return 0;
}
pawn Код:
// OUTPUT:
[12:42:08] EXAMPLESTRING: "Hello Tagathron!"
So if i want to use it under a callback,i would do testi[TESTINGTAG] (name[], value[]); .... ?


Re: y_ini errors - Konstantinos - 31.10.2013

No, the INI:testi[TESTINGTAG](name[], value[]) thing should not be inside any callback. However, you can use INI_Load("testi.ini"); anywhere else.


Re: y_ini errors - Tagathron - 31.10.2013

But what if i want to for example,when player enters a car, i load the car ID from the file,and using a loop print which car he enter depending on the ID from the file?
I can't use it in callback?Why would i use it just in main?


Re: y_ini errors - Konstantinos - 31.10.2013

Quote:
Originally Posted by Tagathron
Посмотреть сообщение
But what if i want to for example,when player enters a car, i load the car ID from the file,and using a loop print which car he enter depending on the ID from the file?
I can't use it in callback?Why would i use it just in main?
You misread my post, I never mentioned main.

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
[..] However, you can use INI_Load("testi.ini"); anywhere else.
INI_Load can be used anywhere else, it's not obligatory in main (it was just an example!).


Re: y_ini errors - Tagathron - 31.10.2013

Alright i understand it perfectly now.
Thanks for helping.