HELP (is more than)

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

    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.

djmanbr

Member
Feb 18, 2017
31
2
0
28
I have a problem, i'm doing something special but a part of the command don't work correctly.

Look:

code_language.skript:
command /k [<text>] [<player>] [<player>] [<text>]:
    trigger:
        if arg-1 is "buy":
            if {items.auction::%arg-2%} is set:
                if arg-3 is not arg-2:
                    set {_money} to arg-4
                    replace all "$" or "," in {_money} with ""
                    send "%{_money}% == %{items.auction::%arg-2%::price}%" to arg-3
                    if {_money} is greater than or equal to {items.auction::%arg-2%::price}:
                        give {items.auction::%arg-2%} to arg-3
                        clear {items.auction::%arg-2%}
                        clear {items.auction::%arg-2%::name}
                        clear {items.auction::%arg-2%::price}
                        set {items.auction.used::%arg-2%} to false
                        clear {items.auction.time::%arg-2%}
                        send "&7[&6AH&7]&2You bought the item!" to arg-3
                        remove {items.auction::%arg-2%::price} from arg-3's balance
                        send "&7[&6AH&7]&2Your item has bought!" to arg-2
                        add {items.auction::%arg-2%::price} to arg-3's balance
                    else:
                        send "&7[&6AH&7]&cYou don't have sufficient money!" to arg-3

The problem is when i intent to detect if {_money} is more than the price of the item, but when i test it with more money than the item price, it sends: "You don't have sufficient money!"

Sorry if you don't understand something, i'm not english. :emoji_stuck_out_tongue:
 
I have a problem, i'm doing something special but a part of the command don't work correctly.

Look:

code_language.skript:
command /k [<text>] [<player>] [<player>] [<text>]:
    trigger:
        if arg-1 is "buy":
            if {items.auction::%arg-2%} is set:
                if arg-3 is not arg-2:
                    set {_money} to arg-4
                    replace all "$" or "," in {_money} with ""
                    send "%{_money}% == %{items.auction::%arg-2%::price}%" to arg-3
                    if {_money} is greater than or equal to {items.auction::%arg-2%::price}:
                        give {items.auction::%arg-2%} to arg-3
                        clear {items.auction::%arg-2%}
                        clear {items.auction::%arg-2%::name}
                        clear {items.auction::%arg-2%::price}
                        set {items.auction.used::%arg-2%} to false
                        clear {items.auction.time::%arg-2%}
                        send "&7[&6AH&7]&2You bought the item!" to arg-3
                        remove {items.auction::%arg-2%::price} from arg-3's balance
                        send "&7[&6AH&7]&2Your item has bought!" to arg-2
                        add {items.auction::%arg-2%::price} to arg-3's balance
                    else:
                        send "&7[&6AH&7]&cYou don't have sufficient money!" to arg-3

The problem is when i intent to detect if {_money} is more than the price of the item, but when i test it with more money than the item price, it sends: "You don't have sufficient money!"

Sorry if you don't understand something, i'm not english. :emoji_stuck_out_tongue:
maybe you need parsed first the variables as numbers.
 
After the line
Code:
add {items.auction::%arg-2%::price} to arg-3's balance
put
Code:
stop trigger

so it looks like this:
Code:
add {items.auction::%arg-2%::price} to arg-3's balance
stop trigger
 
After the line
Code:
add {items.auction::%arg-2%::price} to arg-3's balance
put
Code:
stop trigger

so it looks like this:
Code:
add {items.auction::%arg-2%::price} to arg-3's balance
stop trigger
??? Wtf?

He say. if he got enough money, will send message that he got not enough money....
 
??? Wtf?

He say. if he got enough money, will send message that he got not enough money....

I've had situations where the code keeps on running through else statement even if the previous condition was met so by adding the stop trigger it stops this from happening. It might not be what's happening to him but it's worth a try.
 
code_language.skript:
command /k [<text>] [<player>] [<player>] [<text>]: #Change <text> with <int>
    trigger:
        if arg-1 is "buy":
            if {items.auction::%arg-2%} is set:
                if arg-3 is not arg-2:
                    set {_money} to arg-4 #Or set {_money} to arg-4 parsed as number
                    replace all "$" or "," in {_money} with ""
                    send "%{_money}% == %{items.auction::%arg-2%::price}%" to arg-3
                    if {_money} is greater than or equal to {items.auction::%arg-2%::price}:
                        give {items.auction::%arg-2%} to arg-3
                        clear {items.auction::%arg-2%}
                        clear {items.auction::%arg-2%::name}
                        clear {items.auction::%arg-2%::price}
                        set {items.auction.used::%arg-2%} to false
                        clear {items.auction.time::%arg-2%}
                        send "&7[&6AH&7]&2You bought the item!" to arg-3
                        remove {items.auction::%arg-2%::price} from arg-3's balance
                        send "&7[&6AH&7]&2Your item has bought!" to arg-2
                        add {items.auction::%arg-2%::price} to arg-3's balance
                    else:
                        send "&7[&6AH&7]&cYou don't have sufficient money!" to arg-3
 
code_language.skript:
command /k [<text>] [<player>] [<player>] [<text>]: #Change <text> with <int>
    trigger:
        if arg-1 is "buy":
            if {items.auction::%arg-2%} is set:
                if arg-3 is not arg-2:
                    set {_money} to arg-4 #Or set {_money} to arg-4 parsed as number
                    replace all "$" or "," in {_money} with ""
                    send "%{_money}% == %{items.auction::%arg-2%::price}%" to arg-3
                    if {_money} is greater than or equal to {items.auction::%arg-2%::price}:
                        give {items.auction::%arg-2%} to arg-3
                        clear {items.auction::%arg-2%}
                        clear {items.auction::%arg-2%::name}
                        clear {items.auction::%arg-2%::price}
                        set {items.auction.used::%arg-2%} to false
                        clear {items.auction.time::%arg-2%}
                        send "&7[&6AH&7]&2You bought the item!" to arg-3
                        remove {items.auction::%arg-2%::price} from arg-3's balance
                        send "&7[&6AH&7]&2Your item has bought!" to arg-2
                        add {items.auction::%arg-2%::price} to arg-3's balance
                    else:
                        send "&7[&6AH&7]&cYou don't have sufficient money!" to arg-3

I can't change <text> with <int> because the command is send from a GUI and it sends the player balance, and the player balance have a $. So I need to replace the symbol "$" with nothing and then i have the numbers to compare it.

I try to put only (set {_money} to "%arg-4%" parsed as number) but it doesn't work.
 
It could not work because at the time youre parsing it the variable looks like "<input here a random number>$"


So you need to parse it after you removed the $
code_language.skript:
command /k [<text>] [<player>] [<player>] [<text>]:
    trigger:
        if arg-1 is "buy":
            if {items.auction::%arg-2%} is set:
                if arg-3 is not arg-2:
                    set {_money} to arg-4
                    replace all "$" or "," in {_money} with ""
                    set {_money} to "%{_money}%" parsed as number
                    send "%{_money}% == %{items.auction::%arg-2%::price}%" to arg-3
                    if {_money} is greater than or equal to {items.auction::%arg-2%::price}:
                        give {items.auction::%arg-2%} to arg-3
                        clear {items.auction::%arg-2%}
                        clear {items.auction::%arg-2%::name}
                        clear {items.auction::%arg-2%::price}
                        set {items.auction.used::%arg-2%} to false
                        clear {items.auction.time::%arg-2%}
                        send "&7[&6AH&7]&2You bought the item!" to arg-3
                        remove {items.auction::%arg-2%::price} from arg-3's balance
                        send "&7[&6AH&7]&2Your item has bought!" to arg-2
                        add {items.auction::%arg-2%::price} to arg-3's balance
                    else:
                        send "&7[&6AH&7]&cYou don't have sufficient money!" to arg-3
 
Status
Not open for further replies.