1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Help with subtract quantity from message

Discussion in 'Skript' started by DavodaMC, May 7, 2019.

Thread Status:
Not open for further replies.
  1. DavodaMC

    DavodaMC Member

    Joined:
    Mar 31, 2019
    Messages:
    2
    Likes Received:
    0
    I'm making a economy system and I need help with subtract quantity from message

    CODE:


    Code (Text):
    1. command /retirar:
    2.     trigger:
    3.         set {retirar.%player%} to true
    4.         message "&6&lBirdMC &8» &c¡Ingresa la cantidad que quieras retirar!"
    5. on any move:
    6.     if {retirar.%player%} is true:
    7.         teleport player to location of player
    8.         message "&6&lBirdMC &8» &c¡Ingresa la cantidad que quieras retirar!"
    9. on chat:
    10.     if {retirar.%player%} is true:
    11.         if "%message%" contains "a" or "b" or "c" or "d" or "e" or "f" or "g" or "h" or "i" or "j" or "k" or "l" or "m" or "n" or "ñ" or "o" or "p" or "q" or "r" or "s" or "t" or "u" or  "v" or "x" or "y" or "z" or "?" or "¿" or "!" or "¡" or "<" or ">" or "." or "," or ":" or ";" or "@" or """" or "%%":
    12.             message "&6&lBirdMC &8» &c¡Introduce un número!"
    13.             cancel event
    14.             stop
    15.         if {dinerobanco.%player%} is 0:
    16.             cancel event
    17.             message "&6&lBirdMC &8» &c¡No tienes suficiente dinero en el banco!"
    18.             set {retirar.%player%} to false
    19.             stop
    20.         else:
    21.             cancel event
    22.             message "&6&lBirdMC &8» &e¡Has decidido retirar &a%message%€&e!"
    23.             set {retirar.%player%} to false
    24.             subtract "%message%" from {dinerobanco.%player%}
    25.             add "%message%" to {dineroefectivo.%player%}
    Sorry for my english, I'm from Spain.
     
  2. Best Answer:
    Post #2 by couger44, May 7, 2019
  3. couger44

    Supporter

    Joined:
    Feb 19, 2017
    Messages:
    714
    Likes Received:
    31
    I recommend that instead of using
    Code (Skript):
    1. if {dinerobanco.%player%} is 0:
    use
    Code (Skript):
    1. if {dinerobanco.%player%} = 0:
    try with:
    Code (Skript):
    1.  
    2. cancel event
    3. set {_number} to "%message%" parsed as number
    4. set {retirar.%player%} to false
    5. remove {_number} from {dinerobanco.%player%}
    6. add {_number} to {dineroefectivo.%player%}
    7. message "&6&lBirdMC &8»&e ¡Has decidido retirar &a%{_number}%&e!"
    8.  
    I have not tried this code, but more or less I would do it that way.
     
    #2 couger44, May 7, 2019
    Last edited: May 8, 2019
    • Useful Useful x 1
  4. DavodaMC

    DavodaMC Member

    Joined:
    Mar 31, 2019
    Messages:
    2
    Likes Received:
    0
    Thanks bro, it works perfect, you're a crack! <3
     
    • Friendly Friendly x 1
  5. couger44

    Supporter

    Joined:
    Feb 19, 2017
    Messages:
    714
    Likes Received:
    31
    You are welcome :emoji_slight_smile:
     
    • Friendly Friendly x 1
Thread Status:
Not open for further replies.

Share This Page

Loading...