Balance problem

  • 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 community!

    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!

Status
Not open for further replies.
Dec 19, 2019
31
2
8
I'm new with script and I wanna learn how to use it.
But when I was trying to make a easy balance system for my server it didn't work.
So now i'm stuck...

My script:

command /bal [<player>]:
aliases: /balance
trigger:
if {balance::%player%} is not set:
set {balance::%player%} to 0
if arg 1 is not set:
message "You have a balance of &a&l%{balance::%player%}%&r dollar."
else:
message "%arg 1% has a balance of &a&l%{balance::%arg 1%}%&r dollar."

command //cc <text> [<player>] [<integer>]:
trigger:
if arg 1 is "pay":
arg 2 is set
arg 3 is set
if {balance::%player%} is greater than or equal to arg 3:
if arg 3 is greater than 0:
subtract arg 3 from {balance::%player%}
add arg 3 to {balance::%arg 2%}
message "It works"
message "It works" to arg 2
else:
message "It works"
else:
message "It works"


Thanks.
 
I see a few problems, first of all do people actually use lists instead of variables?? anyways you put two slashes for the /cc command
 
I'm new with script and I wanna learn how to use it.
But when I was trying to make a easy balance system for my server it didn't work.
So now i'm stuck...

My script:

command /bal [<player>]:
aliases: /balance
trigger:
if {balance::%player%} is not set:
set {balance::%player%} to 0
if arg 1 is not set:
message "You have a balance of &a&l%{balance::%player%}%&r dollar."
else:
message "%arg 1% has a balance of &a&l%{balance::%arg 1%}%&r dollar."

command //cc <text> [<player>] [<integer>]:
trigger:
if arg 1 is "pay":
arg 2 is set
arg 3 is set
if {balance::%player%} is greater than or equal to arg 3:
if arg 3 is greater than 0:
subtract arg 3 from {balance::%player%}
add arg 3 to {balance::%arg 2%}
message "It works"
message "It works" to arg 2
else:
message "It works"
else:
message "It works"


Thanks.

Well ... a while ago I did nothing about skripts. But anyway, I'll try to help you.

First, i recommend that you put the code in the correct format (to make it easier to understand).
As this:
code_language.skript:
command /bal [<player>]:
    aliases: /balance
    trigger:
#...

Second, i think it's easier to write the code this way:

code_language.skript:
command /pay [<player>] [<int>]:
    trigger:
        if arg 1 is set:
            if arg 2 is set:
                if {balance::%player%} >= arg 2:
                    add arg-2 to {balance::%arg 1%}
                    remove arg-2 from {balance::%player%}
                    message "You paid %arg 2% to %arg 1%" to player
                    message "You received %arg 2% from %player%" to arg 1
                else if {balance::%player%} < arg 2:
                    message "You dont have that amount of money." to player
                    stop
 
Status
Not open for further replies.