Jump to content

Need help with skript


Annoying_Brother

Recommended Posts

variables:
	{money} = 0

command /balance:
	aliases: /bal
	trigger:
		send "&aYou have %{money}% &ain your bank!"
command /pay <player> <integer>:
	trigger:
		if {money} >= arg-integer:
			subtract arg-integer from {uuid::%player%::money}
			add arg-integer to  {uuid::%arg-player%::money}
		else:
			send "You don't have enough money!" to player
every 1 second:
	loop all players:
		add 1 to {{uuid::%loop-player%}::money}

This doesn't work at all as all the money is the same as 1 person and it doesn't give any money at all! Please help. Thank you!

Link to comment
Share on other sites

variables:
  {%player%.balance} = 0 # Starting balance

command /balance:
  aliases: /bal
  trigger:
    send "&7Balance: &2$&a%{%player%.balance}%"

command /pay <player> <integer>:
  trigger:
    if {%player%.balance} >= arg-2:
      remove arg-2 from {%player%.balance}
      add arg-2 to {%arg-1%.balance}
      send "&7You sent &2$&a%arg-2% &7to &a%arg-1%" to player
      send "&7You received &2$&a%arg-2% &7from &a%player%" to %arg-1%
    else:
      send "&7You don't have enough money." to player

every second:
  loop all players:
    add 1 to {%loop-player%.balance}

I didn't test it but hopefully it works, by the way you can use Vault instead of creating a variable for player's balance.

It would be much easier:

add 1 to player's balance / remove 1 to player's balance / if player's balance >= x:

  • Like 1
Link to comment
Share on other sites

5 hours ago, Annoying_Brother said:

variables:
	{money} = 0

command /balance:
	aliases: /bal
	trigger:
		send "&aYou have %{money}% &ain your bank!"
command /pay <player> <integer>:
	trigger:
		if {money} >= arg-integer:
			subtract arg-integer from {uuid::%player%::money}
			add arg-integer to  {uuid::%arg-player%::money}
		else:
			send "You don't have enough money!" to player
every 1 second:
	loop all players:
		add 1 to {{uuid::%loop-player%}::money}

This doesn't work at all as all the money is the same as 1 person and it doesn't give any money at all! Please help. Thank you!

you are setting your {money} variable as the whole server. you would need to change it to a player variable. for example, {money.%player%}. This is also used as attacker and victim for damage and death events, like so. {money.%victim%} and {money.%attacker%} Another reminder, when variables are going in text like in line 7, you need to put percent signs before and after the variable, like this. %{money.%player%}%

 

 

image.png.bc433d6489d70ad831075fe76809b993.png
 

Lifestealed | Minecraft Servers
 

OG [VIP] 12/26/20 - 10/27/2021
OG [PRO] 12/27/21 - 11/18/2022
OG [LEGEND] 11/18/2022 - 3/14/2023
[DEFAULT] 3/14/2023 - Present

 

Link to comment
Share on other sites

  • 3 weeks later...

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