#Numbers like 1k instead of 1000 with variables

1 messages · Page 1 of 1 (latest)

peak folio
#

Replace all "K" in {_var} with "000"

pallid sorrel
#

hey

#

im curious how do u make it so it shows the code in grey

#

because i dont know

peak folio
#

With backticks you mean?

#

this?

pallid sorrel
#

yes

peak folio
pallid sorrel
#

this

peak folio
#

backticks are on the top left corner on a keyboard where ~ is

pallid sorrel
#
    if {money::%player's uuid%} is not set:
        set {money::%player's uuid%} to 0
    if {money::%player's uuid%} is set:
        send "&aYou currently have &2%{money::%player's uuid%}%&a Money!"

command /balance [<player>]:
    usage: &a/Balance [<player name>]
    trigger:
        if arg-1 is set:
            send "&a%arg-1% currently has &2%{money::%arg-1's uuid %}%&a Amount of money!"
        else:
            send "&aYou currently have &2%{money::%player's uuid%}%&a Amount of money!"

command /setbalance <string> [<player>]:
    aliases: /setbal
    usage: &a/setbalance <amount of mone> [<player name>]
    trigger:
        if arg-1 is not set:
            if arg-2 is not set:
                send "&4Incorrect Argument(s)" to player
                send "&4Please try &a/setbalance <amount of mone> [<player name>]" to player
        if arg-1 is set:
            set {money::%player's uuid%} to arg-1
            send "&aSuccesfully Set your money to %{money::%player's uuid%}%!"
        if arg-1 is set:
            if arg-2 is set:
                set {money::%arg-2's uuid%} to arg-1
                send "&aSuccesfully set %arg-2%'s Money to %{money::%arg-2's uuid%}%!"```
#

this is the code

#

i want to make a economy skript and the problem is when i for example set my balance to 1000 or more like 1'000'000 then it will show the full number e.x "1000" instead of "1k" how do i fix that?

tiny mantle
#

theres many number formatting scripts in #skript-snippets

pallid sorrel
#

i dont rlly understand all of that stuff

boreal heron
#

if you understand CTRL C CTRL V you can use it

tiny mantle
#

just call the function with a number in it, and tada

tiny mantle
#

Calling a function means using it

#

Basically just stick a number in it and it’ll output the abbreviation

steep vortex
#

hi

peak folio
#

This isn't #general 🤨

pallid sorrel
tiny mantle
#

you just put it in the ()

#

like this: broadcast "1000 -> %formatNumber(1000)%"
will broadcast "1000 -> 1k"

pallid sorrel
#

oh

#

still confusing xd

tiny mantle
#

theres a functions pin in #skript-help-2

pallid sorrel
#

what do i do now?

#

i think i got it