Solved How do I fix this?

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

Svennez

New Member
Apr 21, 2017
6
0
0
code_language.skript:
command /tokens [<text>] [<text>]:
    trigger:     
       if arg-1 is "withdraw":
            if arg-2 is set:
                if {tokens.%player%} is smaller than or equal to arg-2:
                    remove arg-2 from {tokens.%player%}
                    execute console command "/give %player% magmacream %arg-2%"
                else:
                    message "invalid funds"

Why does it always message me "invalid funds" even though I have 5 tokens and do /tokens withdraw 4
 
You need to parse it as a integer.
code_language.skript:
command /tokens [<text>] [<text>]:
    trigger:  
       if arg-1 is "withdraw":
            if arg-2 is set:
                set {tokens.%player%} to "%{tokens.%player%}%" parsed as integer
                set {_arg2} to "%arg-1%" parsed as integer
                if {tokens.%player%} is smaller than or equal to {_arg2}:
                    remove {_arg2} from {tokens.%player%}
                    execute console command "/give %player% magmacream %arg-2%"
                else:
                    message "invalid funds"
 
You need to parse it as a integer.
code_language.skript:
command /tokens [<text>] [<text>]:
    trigger: 
       if arg-1 is "withdraw":
            if arg-2 is set:
                set {tokens.%player%} to "%{tokens.%player%}%" parsed as integer
                set {_arg2} to "%arg-1%" parsed as integer
                if {tokens.%player%} is smaller than or equal to {_arg2}:
                    remove {_arg2} from {tokens.%player%}
                    execute console command "/give %player% magmacream %arg-2%"
                else:
                    message "invalid funds"

Still says 'invalid funds'
[doublepost=1492785040,1492784792][/doublepost]Solved
 
Status
Not open for further replies.