Jump to content

BetterBalance - A Free Advanced Economy System Skript


_Mr_Puppy_

Recommended Posts

Hello everyone!
This post is regarding a skirpt im am releasing named "BetterBalance!"

This skirpt will contain a few features to help enhance your server.

Credits:
    -EWS on skunity forums (https://forums.skunity.com/threads/useful-vanilla-skript-functions.7000/) for a number sorting function
    -nicholxs (https://forums.minehut.com/profile/125084-nicholxs/) baltop skirpt

Features For Operators

Spoiler
Fully Customizable Banknotes.
Take money directly from a players balance.
Give players money directly from your balance.
Remove any amount money from players balance.
Add any amount of money to a players balance.
Reset a players balance.
Set a players balance.
Editable balance top showings.
Configurable server name message.

 

Features For Everybody

Spoiler
Check the balance top.
Check your balance.
Check any players balance, online or offline.
Redeem Banknotes.

 

Commands For Operators

Note: when using these command don't include the [] symbols in the message.

Spoiler
/banknote [money] [amount]
Gives the executor the set amount of banknotes that each reward the set amount of money to the redeemer of the banknotes.

/bal [player] help
/balance [player] help
/money [player] help
/$ [player] help
Shows the executor the help text for the balance.

/bal [player] take [amount]
/balance [player] take [amount]
/money [player] take [amount]
/$ [player] take [amount]
Removes the set amount from the set player's balance and adds it to the executors balance.

/bal [player] give [amount]
/balance [player] give [amount]
/money [player] give [amount]
/$ [player] give [amount]
Removes the set amount from the executors balance and adds it to the set player's balance.

/bal [player] remove [amount]
/balance [player] remove [amount]
/money [player] remove [amount]
/$ [player] remove [amount]
Removes the set amount from the set player's balance.

/bal [player] add [amount]
/balance [player] add [amount]
/money [player] add [amount]
/$ [player] add [amount]
Adds the set amount from the set player's balance.

/bal [player] reset
/balance [player] reset
/money [player] reset
/$ [player] reset
Resets the set player's balance back to $0.

/bal [player] set [amount]
/balance [player] set [amount]
/money [player] set [amount]
/$ [player] set [amount]
Sets the set player's balance to the set amount.

 

Commands For All Players

Note: when using these command don't include the [] symbols in the message.

Spoiler
/bal
/balance
/money
/$
Shows the executor their current balance.

/bal [player]
/balance [player]
/money [player]
/$ [player]
Shows the executor the set player's current balance.

/baltop
/balancetop
/$top
/cashtop
/moneytop
Shows the executor the balance of the top 10 players (top 10 is default, with access to this skript you can change this.)

 

THE ACTUAL CODE!
You can either download the code as a .sk file, .txt file, or just copy and paste in from below!

Spoiler
on skript load:
	loop all players where [input has permission "op"]:
		send " " to loop-player
		send "&aSuccessfully loaded &a&lBetterBalance&r&a by rhthebest AKA _Mr_Puppy_. DM rhthebestⵌ8215 on discord with any bug reports!" to loop-player
		send " " to loop-player

on first join:
	set {cash::%player's uuid%} to 0

on join:
	if {cash::%player's uuid%} is not set:
		set {cash::%player's uuid%} to 0


command /banknote [<number>] [<number>]:
	permission: op
	trigger:
		if arg-1 is set:
			if arg-2 is set:
				send "&aBanknote Created!" to player
				set {reward} to arg-1
				{reward} > 999:
					loop arg-2 times:
						give player 1 paper named "&l&fBanknote" with lore "&2Right Click To Recive Money!", and "&2Gives You &a$%{reward}% (%format({reward})%)", and "&7Must Be Unstacked To Use!"
				else:
					loop arg-2 times:
						give player 1 paper named "&l&fBanknote" with lore "&2Right Click To Recive Money!", and "&2Gives You &a$%{reward}%", and "&7Must Be Unstacked To Use!"
			if arg-2 is not set:
				send "&aBanknote Created!" to player
				set {reward} to arg-1
				give player 1 paper named "&l&fBanknote" with lore "&2Right Click To Recive Money!", and "&2Gives You &a$%{reward}%", and "&7Must Be Unstacked To Use!"

on right click:
	if player's held item is paper named "&l&fBanknote":
		if lore of player's held item contains "&2Right Click To Recive Money!":
			set player's held item to air
			add {reward} to {cash::%player's uuid%}
			send action bar "&a+$%{reward}%" to player
			send "&aBalance: &c$%{cash::%player's uuid%}%" to player
command /bal [<offline player>] [<text>] [<number>]:
	aliases: money, balance, $
	trigger:
		if arg-1 is set:
			if arg-2 is not set:
				{cash::%arg-1's uuid%} > 999:
					send "&a%arg-1%'s Balance: &c$%{cash::%arg-1's uuid%}% (%format({cash::%arg-1's uuid%})%)" to player
				else:
					send "&a%arg-1%'s Balance: &c$%{cash::%arg-1's uuid%}%" to player
		if arg-1 is not set:
			{cash::%player's uuid%} > 999:
				send "&aBalance: &c$%{cash::%player's uuid%}% (%format({cash::%player's uuid%})%)" to player
			else:
				send "&aBalance: &c$%{cash::%player's uuid%}%" to player
		if arg-1 is set:
			if player has permission "op":
				if arg-2 is "set":
					if arg-3 > -1:
						set {cash::%arg-1's uuid%} to arg-3
						{cash::%arg-1's uuid%} > 999:
							send "&aYour Balance Has Been Set To &c$%arg-3%! (%format({cash::%arg-1's uuid%})%)" to arg-1
							if arg-1 is not player:
								send "&a%arg-1%'s Balance Has Been Set To &c$%arg-3%! (%format({cash::%arg-1's uuid%})%)" to player
						else:
							send "&aYour Balance Has Been Set To &c$%arg-3%!" to arg-1
							if arg-1 is not player:
								send "&a%arg-1%'s Balance Has Been Set To &c$%arg-3%!" to player
				if arg-2 is "add":
					if arg-3 > 0:
						add arg-3 to {cash::%arg-1's uuid%}
						if arg-3 > 999:
							send "&c$%arg-3%&a Has Been Added Your Balance! (%format(arg-3)%)" to arg-1
							if arg-1 is not player:
								send "&c$%arg-3%&a Has Been Added To %arg-1%'s Balance! (%format(arg-3)%)" to player
						else:
							send "&c$%arg-3%&a Has Been Added Your Balance!" to arg-1
							if arg-1 is not player:
								send "&c$%arg-3%&a Has Been Added To %arg-1%'s Balance!" to player
				if arg-2 is "reset":
					set {cash::%arg-1's uuid%} to 0
					send "&aYour Balance Has Been Reset!" to arg-1
					if arg-1 is not player:
						send "&a%arg-1%'s Balance Has Been Reset!" to player
				if arg-2 is "remove":
					if arg-3 > 0:
						remove arg-3 from {cash::%arg-1's uuid%}
						if arg-3 > 999:
							send "&c$%arg-3%&a Was Taken Away From Your Balance! (%format(arg-3)%)" to arg-1
							if arg-1 is not player:
								send "&c$%arg-3%&a Was Taken Away From %arg-1%'s Balance! (%format(arg-3)%)" to player
						else:
							send "&c$%arg-3%&a Was Taken Away From Your Balance!" to arg-1
							if arg-1 is not player:
								send "&c$%arg-3%&a Was Taken Away From %arg-1%'s Balance!" to player
				if arg-2 is "take":
					if arg-3 > 0:
						remove arg-3 from {cash::%arg-1's uuid%}
						add arg-3 to {cash::%player's uuid%}
						if arg-3 > 999:
							send "&a%player% Took &c$%arg-3% (%format(arg-3)%)&a From Your Balance!" to arg-1
							if arg-1 is not player:
								send "&c$%arg-3% (%format(arg-3)%)&a Has Been Taked From$%arg-1%'s Balance!" to player
							else:
								send "&aYou Just Took &c$%arg-3% (%format(arg-3)%)&a From Yourself, And Then Gave It Back To Yourself!" to player
						else:
							send "&a%player% Took &c$%arg-3%&a From Your Balance!" to arg-1
							if arg-1 is not player:
								send "&c$%arg-3%&a Has Been Taked From$%arg-1%'s Balance!" to player
							if arg-1 is player:
								send "&aYou Just Took &c$%arg-3%&a From Yourself, And Then Gave It Back To Yourself!" to player
				if arg-2 is "give":
					if arg-3 > 0:
						remove arg-3 from {cash::%player's uuid%}
						add arg-3 to {cash::%arg-1's uuid%}
						if arg-3 > 999:
							send "&a%player% Gave You &c$%arg-3% (%format(arg-3)%)!" to arg-1
							if arg-1 is not player:
								send "&c$%arg-3% (%format(arg-3)%)&a Has Been Given To %arg-1%!" to arg-1
							else:
								send "&aYou Just Took &c$%arg-3% (%format(arg-3)%)&a From Yourself, And Then Gave It Back To Yourself!" to player
						else:
							send "&a%player% Gave You &c$%arg-3%!" to arg-1
							if arg-1 is not player:
								send "&c$%arg-3%&a Has Been Given To %arg-1%!" to arg-1
							else:
								send "&aYou Just Took &c$%arg-3%&a From Yourself, And Then Gave It Back To Yourself!" to player
				if arg-2 is "help":
					send "&aUsage: &c/[bal/balance/money] [player] [help/take/give/remove/reset/add/set] [amount]" to player

#Credit to nicholxs (https://forums.minehut.com/profile/125084-nicholxs/) for this baltop skirpt, it has been tampered with to fit this economy:
options:
	ServerName: &3&lYour &9&lServer
command /baltop:
  aliases: balancetop, $top, cashtop, moneytop
  trigger:
    loop {cash::*}:
      add 1 to {_size}
      if {_low.to.high.list::%loop-value%} is not set:
        set {_low.to.high.list::%loop-value%} to loop-index
      else:
        set {_n} to 0
        loop {_size} times:
          set {_n} to {_n}+1
          {_low.to.high.list::%loop-value-1%.%{_n}%} is not set
          set {_low.to.high.list::%loop-value-1%.%{_n}%} to loop-index
          stop loop
    wait 1 tick
    set {_n} to size of {_low.to.high.list::*}
    loop {_low.to.high.list::*}:
      set {_high.to.low.list::%{_n}%} to loop-value
      set {_n} to {_n}-1
    wait 1 tick
    set {_i} to 0
    send ""
    send "{ServerName} Baltop"
    loop {_high.to.low.list::*}:
      add 1 to {_topnumber}
      set {_player} to "%loop-value%" parsed as offlineplayer
      send "&2%{_topnumber}% - &a%{_player}% &8» &c$%{cash::%loop-value%}%"
      add 1 to {_i}
      if {_topnumber} > 9: #This means it shows top 10 players
        send ""
        stop

#credit to EWS on skunity forums (https://forums.skunity.com/threads/useful-vanilla-skript-functions.7000/) for this function:
function format(n: number) :: text:
	set {_data} to "Qi,18|Qa,15|Tril,12|Bil,9|Mil,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}%"
	

 

 

BetterBalance.sk BetterBalance.txt

Edited by _Mr_Puppy_
Link to comment
Share on other sites

  • _Mr_Puppy_ changed the title to BetterBalance - A Free Advanced Economy System Skript

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...