Solved if ({variable parsed as num}) > {argument}: - is not not working

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

Fojoin

Member
Jul 22, 2023
2
0
1
"if ({_money} parsed as num) > {_amount::%player%}:" does not work. which is very strange, because in "set result %{_amount::%player%}% and %{_money}%%" the numbers are displayed
code_language.skript:
variables:
    {amount::%player%} = 10
on placeholderapi placeholder request for the prefix "cost":
    loop all items in inventory of player:
        if loop-item is player head:
            add item amount of loop-item *15 to {_amount::%player%}  
        if loop-item is gold ingot:
            add item amount of loop-item *25 to {_amount::%player%}
        if loop-item is golden sword or golden helmet or golden chestplate or golden leggings or golden boots or golden pickaxe:
            add 40 to {_amount::%player%}
        if loop-item is slime ball:
            if custom model data of loop-item is 10000:
                add item amount of loop-item *15 to {_amount::%player%}
        if loop-item is slime ball:
            if custom model data of loop-item is 10001:
                add item amount of loop-item *25 to {_amount::%player%}
    set {_money} to placeholder "vault_eco_balance" from player
    if ({_money} parsed as num) > {_amount::%player%}:
        set the result to "%{_money}%"
    else:
        set the result to "%{_amount::%player%}% and %{_money}%"
on death of player:
    execute console command "money give %attacker% %placeholder "cost" from victim%"

I additionally use this https://github.com/APickledWalrus/skript-placeholders
 
you can just use `player's balance` instead of getting a placeholder
code_language.skript:
variables:
    {amount::%player%} = 10
on placeholderapi placeholder request for the prefix "cost":
    loop all items in inventory of player:
        if loop-item is player head:
            add item amount of loop-item *15 to {_amount::%player%} 
        if loop-item is gold ingot:
            add item amount of loop-item *25 to {_amount::%player%}
        if loop-item is golden sword or golden helmet or golden chestplate or golden leggings or golden boots or golden pickaxe:
            add 40 to {_amount::%player%}
        if loop-item is slime ball:
            if custom model data of loop-item is 10000:
                add item amount of loop-item *15 to {_amount::%player%}
        if loop-item is slime ball:
            if custom model data of loop-item is 10001:
                add item amount of loop-item *25 to {_amount::%player%}
    set {_money} to player's balance
    if {_money} < {_amount::%player%}:
        set the result to "%{_money}%"
    else:
        set the result to "%{_amount::%player%}% and %{_money}%"
on death of player:
    execute console command "money give %attacker% %placeholder "cost" from victim%"
Thanks, it worked