Raised This Month: $32 Target: $400
 8% 

Need quick help float problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ratchetx
Member
Join Date: Aug 2008
Location: Lithuania
Old 06-10-2009 , 07:56   Need quick help float problem
Reply With Quote #1

Never had this problem but suddenly i started getting this.

Anyone knows whats wrong with this?

Code:
 decl Float:Woot[33];
 Woot[Client] = Intrate[Client] / 10;
 PrintToChat(Client, "%d", Woot[Client]);
 
 //Return:
 return Plugin_Handled;


Intrate is 1


PS
Forgot to mention that instead of 0.1 im getting very large number.

Last edited by ratchetx; 06-10-2009 at 07:57. Reason: Forgot to mention
ratchetx is offline
Send a message via Skype™ to ratchetx
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 06-10-2009 , 09:18   Re: Need quick help float problem
Reply With Quote #2

Quote:
Originally Posted by ratchetx View Post
Never had this problem but suddenly i started getting this.

Anyone knows whats wrong with this?

Code:
 decl Float:Woot[33];
 Woot[Client] = Intrate[Client] / 10;
 PrintToChat(Client, "%d", Woot[Client]);
 
 //Return:
 return Plugin_Handled;


Intrate is 1


PS
Forgot to mention that instead of 0.1 im getting very large number.
Its because youre printing the float as an integer.
PHP Code:
PrintToChat(Client"%f"Woot[Client]); 
Also worth noting: if you divide an integer with an integer, it returns an integer. 1 / 10 would get you 0.
__________________
plop
p3tsin is offline
ratchetx
Member
Join Date: Aug 2008
Location: Lithuania
Old 06-10-2009 , 10:06   Re: Need quick help float problem
Reply With Quote #3

%d gives right number because i use it to add i just added that for checking what number

and nevermind i found another way how to do it

oh and it used to work it just started messing up today
ratchetx is offline
Send a message via Skype™ to ratchetx
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

Forum Jump


All times are GMT -4. The time now is 07:43.


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