SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 29/05/2020, 02:53 AM   #1
Electrifying
Big Clucker
 
Join Date: Sep 2018
Location: Pernambuco
Posts: 172
Reputation: 2
Default Y_INI Storing not storing float in OnGameModeInit

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
Electrifying is offline   Reply With Quote
Old 29/05/2020, 08:11 AM   #2
Runn3R
Huge Clucker
 
Runn3R's Avatar
 
Join Date: Dec 2013
Location: Croatia, Split
Posts: 420
Reputation: 36
Default Re: Y_INI Storing not storing float in OnGameModeInit

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.
Runn3R is offline   Reply With Quote
Old 29/05/2020, 07:23 PM   #3
Electrifying
Big Clucker
 
Join Date: Sep 2018
Location: Pernambuco
Posts: 172
Reputation: 2
Default Re: Y_INI Storing not storing float in OnGameModeInit

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]
Electrifying is offline   Reply With Quote
Old 29/05/2020, 09:36 PM   #4
Electrifying
Big Clucker
 
Join Date: Sep 2018
Location: Pernambuco
Posts: 172
Reputation: 2
Default Re: Y_INI Storing not storing float in OnGameModeInit

Anyone?
Electrifying is offline   Reply With Quote
Old 29/05/2020, 10:16 PM   #5
xRadical3
Gangsta
 
Join Date: May 2017
Location: Iran
Posts: 684
Reputation: 63
Default Re: Y_INI Storing not storing float in OnGameModeInit

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);
xRadical3 is online now   Reply With Quote
Old 29/05/2020, 10:46 PM   #6
Electrifying
Big Clucker
 
Join Date: Sep 2018
Location: Pernambuco
Posts: 172
Reputation: 2
Default Re: Y_INI Storing not storing float in OnGameModeInit

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
Electrifying is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Storing a value in .ini with Y_INI Emsaic Scripting Help 0 20/02/2017 01:00 AM
Storing a value. StrikerZ Scripting Help 4 08/10/2016 09:59 AM
storing data? NicholasA Scripting Help 2 27/12/2012 09:29 AM
MySQL storing float numbers? Toni Help Archive 0 18/08/2010 09:25 PM
Storing name. TheFailFactor Help Archive 1 07/10/2009 06:14 PM


All times are GMT. The time now is 08:13 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.