![]() |
rounding plz?
I have made a shop where you can buy axe's and go chop some trees down.
then you can come back and sell your wood for a random amount of the day(well not exactly) here is my script: PHP Code:
I sold 5 wood for 13.457252421932 bucks! cause thats just redonculous(re-donk-u-lus :D) |
player.chat = "I sold 5 wood for "@int(this.num)@" bucks!";
|
Quote:
|
Integer.
|
Quote:
|
No, it just removes the floating point(everything right of the decimal), and leaves you with the whole number.
If you want it to round, you'll have to make it do so yourself... I dunno why there isn't something that does so already, but ah well. |
Down, it will just strip everything after the decimal point.
If you want it to round up or down you can do this: PHP Code:
|
You guys all act like rounding is so hard.
Just do int(this.num + 0.5) |
Quote:
Looks like you're learning GS2, good job! One thing I would like to point out however. You used PHP Code:
PHP Code:
|
Quote:
Make "this.num = random(3,20);" into "this.num = int(random(3,20));" and all should be fine... |
Quote:
addWeapon(Axe); works just fine with out the quotes, so is it adding the weapon by fluke? |
Quote:
|
Quote:
findplayer("Twinny").addweapon(name); Whatever :) |
Quote:
PHP Code:
|
| All times are GMT +2. The time now is 04:30 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.