AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Convert a flot number to the entire inmediate number? (https://forums.alliedmods.net/showthread.php?t=91922)

_lol_ 05-07-2009 13:19

Convert a flot number to the entire inmediate number?
 
how to show in my print an entire numbre?example:

PHP Code:

new idontknow 11
New Floatfloat
float 
idontknow*1.2

client_print
(idprint_center"the number is %d"float

Yeah, it will show in the print 13.2 (i think)but i dont want 13.2 i want 14.

how to do it?lol

SnoW 05-07-2009 13:30

Re: Convert a flot number to the entire inmediate number?
 
Quote:

Originally Posted by _lol_ (Post 823012)
how to show in my print an entire numbre?

PHP Code:

new Floatfloat_f 0.00213;
client_print(idprint_chat"Float here: %f"float_f); 

Quote:

Originally Posted by _lol_ (Post 823012)
but i dont want 13.2 i want 14.

PHP Code:

new Floatfloat_f 0.00213;
client_print(idprint_chat"Integer here: %d"floatround(float_f2)); 

There's also different flags in floatround, you may want check them out.
http://www.amxmodx.org/doc/index.htm...floatround.htm

SchlumPF* 05-07-2009 13:37

Re: Convert a flot number to the entire inmediate number?
 
dont use ints as params, use the constant!
floatround_floor - 4.9 -> 4.0 (round down)
floatround_round - 4.4 -> 4.0, 4.5 -> 5.0 (round to the nearest int)
floatround_ceil - 4.1 -> 5.0 (round up)

Dores 05-07-2009 14:03

Re: Convert a flot number to the entire inmediate number?
 
Quote:

Originally Posted by SchlumPF* (Post 823024)
dont use ints as params, use the constant!

I hope you mean unless the ints are not known...

SchlumPF* 05-07-2009 18:43

Re: Convert a flot number to the entire inmediate number?
 
Quote:

Originally Posted by Dores (Post 823045)
I hope you mean unless the ints are not known...

ofc i meant that, you should have known what i mean but for beginners i expressed myself wrong :X

YamiKaitou 05-07-2009 23:13

Re: Convert a flot number to the entire inmediate number?
 
Quote:

Originally Posted by Dores (Post 823045)
I hope you mean unless the ints are not known...

Even if they are known, using the constants provide easier reading for everybody.

Dores 05-08-2009 08:25

Re: Convert a flot number to the entire inmediate number?
 
Quote:

Originally Posted by YamiKaitou (Post 823285)
Even if they are known, using the constants provide easier reading for everybody.

That doesn't conflict with what I said.

SnoW 05-08-2009 10:33

Re: Convert a flot number to the entire inmediate number?
 
Hiz guys. Aye, somehow I just remembered the int better than the constant lolz.


All times are GMT -4. The time now is 01:27.

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