AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   loadnig float data from SQL (https://forums.alliedmods.net/showthread.php?t=196613)

kyriuch 09-23-2012 09:53

loadnig float data from SQL
 
Hi I got code:
PHP Code:

new Float:g_PlayerPoints[33];


Somewhere in the plugin:

ReadResult(Query1g_PlayerPoints[id]) 

where 1 is the column with 'points' which is a float value in SQL Base. The problem is when I set in base value on 55.5 and connect to server it loads 55 instead of 55.5. What am I doing wrong ?

jimaway 09-23-2012 12:28

Re: loadnig float data from SQL
 
looks correct, it should fill the cell with a float value, maybe the value gets changed to 55 somewhere else in your code?

kyriuch 09-23-2012 12:57

Re: loadnig float data from SQL
 
I got only this:
PHP Code:

new Float:g_PlayerPoints[33];


Somewhere in the plugin:

ReadResult(Query1g_PlayerPoints[id]) 

and priting it with:

PHP Code:

%.1fg_PlayerPoints[id]) 

When I save my data (at disonnecting) there are 55 in base instead of 55.5 ;/

saving with:

PHP Code:

`points`='%.1f'g_PlayerPoints[id

</span></span>

kyriuch 09-23-2012 15:35

Re: loadnig float data from SQL
 
Please help me, people tell me that linux has problems with reading float values ;/

matsi 09-23-2012 16:07

Re: loadnig float data from SQL
 
Showing more code would probably help us solve your problem. http://kznt.clanservers.com/thinking.gif

f55z55p 09-23-2012 16:41

Re: loadnig float data from SQL
 
try to send/get float as string
and then convert string to float ( Float:floatstr(const string[]) )

kyriuch 09-24-2012 14:23

Re: loadnig float data from SQL
 
Changed float to int in base, *10 all values in base and while printing in on cs just /10 it ;) thanks anyway


All times are GMT -4. The time now is 08:21.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.