Raised This Month: $ Target: $400
 0% 

loadnig float data from SQL


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kyriuch
Member
Join Date: Jul 2010
Old 09-23-2012 , 09:53   loadnig float data from SQL
Reply With Quote #1

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 ?

Last edited by kyriuch; 09-23-2012 at 10:18.
kyriuch is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 09-23-2012 , 12:28   Re: loadnig float data from SQL
Reply With Quote #2

looks correct, it should fill the cell with a float value, maybe the value gets changed to 55 somewhere else in your code?
jimaway is offline
kyriuch
Member
Join Date: Jul 2010
Old 09-23-2012 , 12:57   Re: loadnig float data from SQL
Reply With Quote #3

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 is offline
kyriuch
Member
Join Date: Jul 2010
Old 09-23-2012 , 15:35   Re: loadnig float data from SQL
Reply With Quote #4

Please help me, people tell me that linux has problems with reading float values ;/
kyriuch is offline
matsi
Thinkosaur
Join Date: Sep 2006
Old 09-23-2012 , 16:07   Re: loadnig float data from SQL
Reply With Quote #5

Showing more code would probably help us solve your problem.
__________________

Accepting all kinds of requests via private message.
matsi is offline
f55z55p
BANNED
Join Date: Sep 2012
Old 09-23-2012 , 16:41   Re: loadnig float data from SQL
Reply With Quote #6

try to send/get float as string
and then convert string to float ( Float:floatstr(const string[]) )
f55z55p is offline
kyriuch
Member
Join Date: Jul 2010
Old 09-24-2012 , 14:23   Re: loadnig float data from SQL
Reply With Quote #7

Changed float to int in base, *10 all values in base and while printing in on cs just /10 it ;) thanks anyway
kyriuch is offline
Reply



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

Forum Jump


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


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