Would this withdraw skript work?

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

brsko

Member
Mar 21, 2024
18
0
1
Hi, I need to know if this skript would work for my server.

Code:
command /speed:withdraw [<integer>]:
    aliases: /speed:w, /withdraw
    trigger:
        if arg-1 is set:
            if {speed::%player's uuid%} <= {@minspeed}:
                send "{@prefix} &eYou do not have enough speed to withdraw."
                stop
            else:
                send "{@prefix} &eWithdrawn &a1 &espeed successfully."
                remove 1 from {speed::%player's uuid%}
                give player lime dye named "&asᴘᴇᴇᴅ &7(ʀɪɢʜᴛ ᴄʟɪᴄᴋ)" with lore "&eThis gives +0.1 attack speed, right click to reddem, you must be below +0.5 attack speed for this to work."
        else if arg-1 is not set:
            send "{@prefix} &cState an amount of speed to withdraw."
            stop
        else if {speed::%player's uuid%} <= arg-1:
            send "{@prefix} &cYou do not have enough speed to withdraw."
            stop
        else:
            set %arg-1% to {_amount}
            send "{@prefix} &eWithdrawn &a%arg-1% &espeed successfully."
            remove 1 from {speed::%player's uuid%}
            loop {_amount} times:
                give player lime dye named "&asᴘᴇᴇᴅ &7(ʀɪɢʜᴛ ᴄʟɪᴄᴋ)" with lore "&eThis gives +0.1 attack speed, right click to reddem, you must be below +0.5 attack speed for this to work."

Please tell me if it is/fix it
thanks - brsko
 
Hey man, I think I worked on your server with you before.
Anyway a few things:

For one, if you're going to stop them if they don't enter a number, make the argument forced.
For two, while what I'm seeing should work, the way your if statements are formatted, as far as I can tell, you'll only be able to withdraw 1 speed at a time.
 
Hey man, I think I worked on your server with you before.
Anyway a few things:

For one, if you're going to stop them if they don't enter a number, make the argument forced.
For two, while what I'm seeing should work, the way your if statements are formatted, as far as I can tell, you'll only be able to withdraw 1 speed at a time.
Do yk how I would word it to make it withdraw the set amount?
 
Put what you have at the end in your first else statement.
Would I swap the first and end else: statement like this?

Code:
command /speed:withdraw [<integer>]:
    aliases: /speed:w, /withdraw
    trigger:
        if arg-1 is set:
            if {speed::%player's uuid%} <= {@minspeed}:
                send "{@prefix} &eYou do not have enough speed to withdraw."
                stop
            else:
                set %arg-1% to {_amount}
                send "{@prefix} &eWithdrawn &a%arg-1% &espeed successfully."
                loop {_amount} times:
                    remove 1 from {speed::%player's uuid%}
                    give player lime dye named "&asᴘᴇᴇᴅ &7(ʀɪɢʜᴛ ᴄʟɪᴄᴋ)" with lore "&eThis gives +0.1 attack speed, right click to reddem, you must be below +0.5 attack speed for this to work."
        else if arg-1 is not set:
            send "{@prefix} &cState an amount of speed to withdraw."
            stop
        else if {speed::%player's uuid%} <= arg-1:
            send "{@prefix} &cYou do not have enough speed to withdraw."
            stop
        else:
            send "{@prefix} &eWithdrawn &a1 &espeed successfully."
            remove 1 from {speed::%player's uuid%}
            give player lime dye named "&asᴘᴇᴇᴅ &7(ʀɪɢʜᴛ ᴄʟɪᴄᴋ)" with lore "&eThis gives +0.1 attack speed, right click to reddem, you must be below +0.5 attack speed for this to work."