Raised This Month: $ Target: $400
 0% 

Math?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Syturi0
Veteran Member
Join Date: Aug 2014
Location: Your mom house -Portugal
Old 04-29-2016 , 23:15   Math?
Reply With Quote #1

- sDonativo is a number.

I want to make: 0,74 x sDonativo.
Example: 0,74 x 3 = 2,22

Then i want to print the result on chat.



What iam doing wrong?
PHP Code:
new Float:teste = (74 100) * sDonativo
colorchat
(0id"%f"teste

Last edited by Syturi0; 04-30-2016 at 11:44. Reason: Don't empty your post.
Syturi0 is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 04-30-2016 , 02:54   Re: Math?
Reply With Quote #2

No, post the problem and solution if you created topic.
siriusmd99 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 04-30-2016 , 03:23   Re: Math?
Reply With Quote #3

Post restored.
__________________
HamletEagle is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 04-30-2016 , 07:09   Re: Math?
Reply With Quote #4

Solution for anyone interested:
Code:
new Float:sDonativo = 3.0 new Float:teste = sDonativo * 74 / 100 colorchat(0, id, "%.2f", teste)
Start the equation with a float, otherwise it will calculate 74 / 100 as integers, which will return 0.
And 0 * anything = 0.
__________________
Black Rose is offline
Syturi0
Veteran Member
Join Date: Aug 2014
Location: Your mom house -Portugal
Old 04-30-2016 , 11:42   Re: Math?
Reply With Quote #5

This was the final result that i came up with 30 seconds after posting this thread:
PHP Code:
colorchat(0id"%2.2f"0.74 sDonativo
It was so simple thats why i decided to remove the post, sorry.

Last edited by Syturi0; 04-30-2016 at 11:45.
Syturi0 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 18:35.


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