Percentages wont work

Discussion in 'Skript' started by B1a7e, Jan 27, 2020.

  1. Basically my skript is for coinflips and I have a 50% chance for heads/tails and sometimes it gives the player a win and loss at the same time or nothing at all

    Code (Text):
    command /coinflip [<text>] [<number>]:
        aliases: cf
        permission: gamble.core
        trigger:
            if {coinflipcd::%player%} is true:
                send "&cYou have a coinflip in progress"
                stop
            if arg-1 is not set:
                send "&cThe correct usage is &8/&7coinflip &8[&aheads &8or &ctails&8] &8[&7amount to bet&8]"
            if arg-1 is set:
                if arg-2 is not set:
                    send "&cThe correct usage is &8/&7coinflip &8[&aheads &8or &ctails&8] &8[&7amount to bet&8]"
                if arg-2 is set:
                    set {coinflipcd::%player%} to true
                    send "&4Flipping coin &7if you win your bet will be doubled and returned"
                    send "&a3"
                    wait 1 second
                    send "&62"
                    wait 1 second
                    send "&c1"
                    wait 1 second
                    chance of 50%:
                        if arg-1 is "heads":
                            send "&aYou have won! Adding &7$%arg-2 * 2% &ato your account"
                            broadcast "&8[&6&lCOINFLIP&8] %player's display name% &7has &awon &7a coinflip worth $%arg-2 * 2%"
                        if arg-1 is "tails":
                            send "&cYou have lost! Removing &7$%arg-2% &cfrom your account"
                            broadcast "&8[&6&lCOINFLIP&8] %player's display name% &7has &clost &7a coinflip worth $%arg-2 * 2%"
                    chance of 50%:
                        if arg-1 is "tails":
                            send "&aYou have won! Adding &7$%arg-2 * 2% &ato your account"
                            broadcast "&8[&6&lCOINFLIP&8] %player's display name% &7has &awon &7a coinflip worth $%arg-2 * 2%"
                        if arg-1 is "heads":
                            send "&cYou have lost! Removing &7$%arg-2% &cfrom your account"
                            broadcast "&8[&6&lCOINFLIP&8] %player's display name% &7has &clost &7a coinflip worth $%arg-2 * 2%"
                    set {coinflipcd::%player%} to false

     
     
  2. I don't know anything about Skript, but it looks like you're trying to flip a coin(chance of 50%) twice in a row.
    basically, if you can do something like
    Code (Text):
    chance of 50%:
        send "You have won"
    else:
        send "You have lost"
    you don't even need to check arg-1, because chances are equal.
     
    • Agree Agree x 1

  3. Thanks it worked