Raised This Month: $51 Target: $400
 12% 

No decimal code


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Alessandro
Junior Member
Join Date: Feb 2013
Old 08-22-2017 , 10:32   No decimal code
Reply With Quote #1

Hello, with my poor knowledge on scripting I edited the uq_jumpstats plugin but I would like to add something else.
this is the code :
Code:
ColorChat(ids, RED, "[%s] %s %s %.3f units! Strafes: %d Sync: %d ^x01%s ^x01%s",prefix, g_playername[id],Jtype[id], distance[id],strafe_num[id], sync_[id],block_str,pre_type[id]);
I want to add the string for showing the prestrafe the guy had but without deciamals because this is a colorchat print, actually its something like this
PHP Code:
[kzPlayer LongJump'd 240.766 units! Strafes: 7 Sync: 90
but i want to change it and looks like this
[kz] Player LongJump'
d 240.766 unitsStrafes7 Sync90 Pre270 (without decimals
I know the string to do it but what I actually don't know is which code I need to use because there are many, such as %s, %d %.3f.

Last edited by Alessandro; 08-22-2017 at 10:39. Reason: forgot to mention something
Alessandro is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-22-2017 , 21:59   Re: No decimal code
Reply With Quote #2

To show no decimal digits for a floating point value, you use "%.0f".
__________________
fysiks is offline
Alessandro
Junior Member
Join Date: Feb 2013
Old 08-22-2017 , 23:21   Re: No decimal code
Reply With Quote #3

ohh yeah, thanks fysiks , if I want to show only 2 or 1 decimal i can change %.0f to %.1f or 2 right?
Alessandro is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 08-22-2017 , 23:23   Re: No decimal code
Reply With Quote #4

%.0f - 0
%.1f - 0.0
%.2f - 0.00
...
__________________








CrazY. 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 13:59.


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