Y_INI Storing not storing float in OnGameModeInit
#1

I'm trying to store positions of an A/D Arena into a .ini file to load after it

The thing is Y_INI is saving the float as "0.00000000000000000000000000000000000000000000000 000000000000000"
but not the value passed on the script

Code:
	new INI:AD_FILE = INI_Open("ADArenas/AmmuLS.ini");	
	if(AD_FILE != INI_NO_FILE){
		INI_SetTag(AD_FILE, "AD_ATTACKER");
		INI_WriteFloat(AD_FILE, "A_X", 1267.2345);
		INI_WriteFloat(AD_FILE, "A_Y", -1411.1877);
		INI_WriteFloat(AD_FILE, "A_Z", 12.8666);
		INI_SetTag(AD_FILE, "AD_DEENDER");
		INI_WriteFloat(AD_FILE, "D_X", 1259.3921);
		INI_WriteFloat(AD_FILE, "D_Y", -1403.4626);
		INI_WriteFloat(AD_FILE, "D_Z", 13.0036);
		INI_SetTag(AD_FILE, "CHECKPOINT");
		INI_WriteFloat(AD_FILE, "CP_X", 1267.2631);
		INI_WriteFloat(AD_FILE, "CP_Y", -1265.8411);
		INI_WriteFloat(AD_FILE, "CP_Z", 13.3806);
		INI_Close(AD_FILE);
	}
The File:
Code:
[CHECKPOINT]
CP_Z=0.00000000000000000000000000000000000000000000000000000000000000
CP_Y=0.000000
CP_X=0.00000000000000000000000000000000000000000000000000000000000000
[AD_DEENDER]
D_Z=0.00000000000000000000000000000000000000000000000000000000000000
D_Y=0.000000
D_X=0.00000000000000000000000000000000000000000000000000000000000000
[AD_ATTACKER]
A_Z=0.00000000000000000000000000000000000000000000000000000000000000
A_Y=0.000000
A_X=0.00000000000000000000000000000000000000000000000000000000000000
You can see the tags are out of order either
Reply
#2

It's out of order cause your appending to a file aka adding to the file the bottom of the file is your first line.

Try making a new variable then assign the value to it rather than just typing it in inside the WriteFloat.
Reply
#3

Quote:
Originally Posted by Runn3R
View Post
It's out of order cause your appending to a file aka adding to the file the bottom of the file is your first line.

Try making a new variable then assign the value to it rather than just typing it in inside the WriteFloat.
Yeah, I've tried this, no solution

I did something like this

PHP Code:
new Float:AmmuLs_attacker[3] = {float0float1float2}; 
and I've placed AmmuLs_attacker[0], AmmuLs_attacker[1], AmmuLs_attacker[2]
Reply
#4

Anyone?
Reply
#5

Store coords as string and try.
See this example:
pawn Code:
INI_Write(AD_FILE, "CP_XYZ", "1267.2631,-1265.8411,13.3806");

//get coords from string with sscanf
new dest[64], Float:x, Float:y, Float:z;
INI_Get(AD_FILE, "CP_XYZ", dest);
sscanf(dest, "p<,>fff", x, y, z);
Reply
#6

Quote:
Originally Posted by xRadical3
View Post
Store coords as string and try.
See this example:
pawn Code:
INI_Write(AD_FILE, "CP_XYZ", "1267.2631,-1265.8411,13.3806");

//get coords from string with sscanf
new dest[64], Float:x, Float:y, Float:z;
INI_Get(AD_FILE, "CP_XYZ", dest);
sscanf(dest, "p<,>fff", x, y, z);
Yes, saving as String is working, thanks. Looks like there's something wrong with WriteFloat
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)