Solved round up / round down in a skript

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

zaved

Member
Sep 19, 2022
17
0
1
23
hey guys,

im currently working on a skript where you can send spawners to a virtual moneyfarm, thats all you need to know.

I need help cause if I have for example 10 spawners in my virtual moneyfarm and I want to withdraw spawners to trade them with players theres a problem with rounding up and rounding up.

Example:

If I type the command /ams withdraw 1.5 then I get only 1 spawner and 1 spawner gets removed but in chat there stands "You got 2 spawners"

This is the skript:

JavaScript:
        if arg 1 is "withdraw":
            if arg 2 is greater than or equal to 1:
                if {spawner.%player%} is more than 0:
                    {spawner.%player%} is greater than or equal to arg 2:
                        if arg 2 is a number:
                            remove arg-2 from {spawner.%player%}
                            add arg-2 of mob spawner to player's inventory
                            send "&6&lHydopia&c&lAMS &8» &7You &asuccessfully&7 withdrawed &e%arg-2%&b Spawner&7(&bs&7) from your &4AMS&7 into your &eInventory&8."
                            stop
                        else:
                            send "&6&lHydopia&c&lAMS &8» &7You can only withdraw &enatural numbers &7(&e1&7, &e2&7, &e3...&7) from your &4AMS&8."
                            stop
                    else:
                        send "&6&lHydopia&c&lAMS &8» &7You don't have &e%arg-2%&b Spawner&7(&bs&7) in your &4AMS&8."
                        stop
                else:
                    send "&6&lHydopia&c&lAMS &8» &7You don't have &bSpawners &7in your &4AMS&8."
            else:
                send "&6&lHydopia&c&lAMS &8» &e%arg-2%&7 is not a valid Amount of&b Spawners&8."