Raised This Month: $ Target: $400
 0% 

Float stuff


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 04-03-2006 , 07:06   Float stuff
Reply With Quote #1

Code:
stock Float:cs_get_user_ratio(id) {     new deaths = cs_get_user_deaths(id);     new frags = get_user_frags(id);     new Float:ratio = float(frags) / float(deaths);     //gaben_to_float(ratio);     return ratio; } stock Float:gaben_to_float(Float:fnum) {     new buffer[21];     format(buffer , 20 , "%.2f" , fnum);     str_to_float(buffer);     return; }

I'm trying to turn a number like 1.000000000 into 1.00 and that doesn't seem to be working too well.

Maybe I could put letter or something after it like this?
Code:
format(buffer , 20 , "%.2f+" , fnum);

Help would be appreciated. Thanks.

Edit: Here's the function I'm working with now.
Code:
stock Float:cs_get_user_ratio(id) {     new deaths = cs_get_user_deaths(id);     new frags = get_user_frags(id);     new Float:ratio = float(frags) / float(deaths);     new buffer[21];     format(buffer , 20 , "%.2f" , ratio);     str_to_float(buffer);     return Float:buffer; }
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
T(+)rget
Senior Member
Join Date: Mar 2004
Old 04-03-2006 , 07:26  
Reply With Quote #2

%0.2f
T(+)rget 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 16:37.


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