Jump to content

I was wondering how to get suffixes for large variable numbers...


Meow_Squad

Recommended Posts

Hi once again, I was trying to do more skript on my server but then I realized with a money variable it would be a bit hard to count exactly how much money you have if the numbers are written like 10000000000 (10 billion). So I was wondering if there was a way to get suffixes for large sums of money; for example 1-999 would be normal but 1,000 to 999,999 would be written like 3.47k (3,470) or 539.21k (539,210), and so on like 12.37M (12,370,000).

 

Thanks you for your time.

Link to comment
Share on other sites

function formatNumber(n: number) :: text:
   set {_data} to "QT,18|Q,15|T,12|B,9|M,6|k,3"
   loop split {_data} at "|":
      set {_s::*} to split loop-value at ","
      {_n} >= 10 ^ {_s::2} parsed as number
      return "%{_n} / 10 ^ {_s::2} parsed as number%%{_s::1}%"
   return "%{_n}%"

if u wanna add higher numbers like septillion, add "SP,24|" to the beginning of setting the data local variable. the number after the comma is how many 0's it has in it
to format variables, instead of writing "%{variable::%player's uuid%}%" you write: "%formatNumber({variable::%player's uuid%})%"

Vip: 20/12/2021

Skript is fun, I am currently working on SkChat and making stuff for market rank!

| NEWEST VERSION |

https://forums.minehut.com/topic/51451-skchat-v11-release/

1335430724_SkChatLogo.jpg.8d5d2c23ac226fcb4cd300eccd8f07c3.jpg

Link to comment
Share on other sites

can i have a skript that is for bounty hunting but only applies to griefers. if the person finds out they got griefed by <griefer>

format of skript:

/bountyhunt <griefer> <amount of ingame currency>

and i need a skript for currency the skript is a npc that you trade ingame money to for crate keys. skript format: /summon keytrader (coordinates)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...