AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Math? (https://forums.alliedmods.net/showthread.php?t=282139)

Syturi0 04-29-2016 23:15

Math?
 
- 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


siriusmd99 04-30-2016 02:54

Re: Math?
 
No, post the problem and solution if you created topic.

HamletEagle 04-30-2016 03:23

Re: Math?
 
Post restored.

Black Rose 04-30-2016 07:09

Re: Math?
 
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.

Syturi0 04-30-2016 11:42

Re: Math?
 
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.


All times are GMT -4. The time now is 18:35.

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