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!

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

Solved Buying items with this System

Discussion in 'Requests' started by ImEnzo, Feb 5, 2017.

  1. ImEnzo

    Supporter

    Joined:
    Jan 29, 2017
    Messages:
    25
    Likes Received:
    1
    Hey i want to Add Something on Mad's Skript for my Server (He has the Credits).
    I want that:
    If i buy something with a command then i need to lose the Price of the Coins from my Balance.
    Heres the Code from Mad:
    Code (Skript):
    1. #Official Skript of Mad
    2. #Copyright [2017 Mad]
    3. #Version: 1.0 Beta
    4.  
    5. #  ___                 _              
    6. # |_ _|  _ __     __| |   ___  __  __
    7. #  | |  | '_ \   / _` |  / _ \ \ \/ /
    8. #  | |  | | | | | (_| | |  __/  >  <
    9. # |___| |_| |_|  \__,_|  \___| /_/\_\
    10. #
    11. #
    12.  
    13. options:
    14.     prefix: &a&lCoins&r &7»&r
    15.     version: 1.0
    16.    
    17. variables:
    18.     {coins.%player%} = 0
    19.    
    20. on first join:
    21.     set {coins.%player%} to 0
    22.    
    23. #  ___  _____  ____  _  _  ___
    24. # / __)(  _  )(_  _)( \( )/ __)
    25. #( (__  )(_)(  _)(_  )  ( \__ \
    26. # \___)(_____)(____)(_)\_)(___/
    27. #
    28.  
    29. command /coins [<text>] [<player>] [<int>]:
    30.     description: Help for skCoins.
    31.     usage: /coins (add:remove:set:reset) (player) (value)
    32.     executable by: players and console
    33.     trigger:
    34.         if arg-1 is not set:
    35.             message ""
    36.             message "&a&lCOINS"
    37.             message ""
    38.             message "&8&7/coins add (player) (value) &a- Add player's coins"
    39.             message "&8&7/coins remove (player) (value) &a- Remove player's coins"
    40.             message "&8&7/coins set (player) (value) &a- Set player's coins"
    41.             message "&8&7/coins reset (player) &a- Reset player's coins"
    42.             message ""
    43.         if arg-1 is set:
    44.             if player has permission "coins.admin":
    45.                 if arg-1 is "add":
    46.                     if arg-2 is not set:
    47.                         message "&aCorrect Usage: &7/coins add (player) (value)"
    48.                     if arg-2 is set:
    49.                         if arg-3 is not set:
    50.                             message "&aCorrect Usage: &7/coins add (player) (value)"
    51.                         if arg-3 is set:
    52.                             add arg-3 to {coins.%arg-2%}
    53.                             message "{@prefix} &7Operation completed successfully!"
    54.                             message "{@prefix} &7You have recived &a%arg-3%&7 coins." to arg-2
    55.                 if arg-1 is "remove":
    56.                     if arg-2 is not set:
    57.                         message "&aCorrect Usage: &7/coins remove (player) (value)"
    58.                     if arg-2 is set:
    59.                         if arg-3 is not set:
    60.                             message "&aCorrect Usage: &7/coins remove (player) (value)"
    61.                         if arg-3 is set:
    62.                             remove arg-3 from {coins.%arg-2%}
    63.                             message "{@prefix} &7Operation completed successfully!"
    64.                             message "{@prefix} &7You have lost &a%arg-3%&7 coins." to arg-2
    65.                 if arg-1 is "set":
    66.                     if arg-2 is not set:
    67.                         message "&aCorrect Usage: &7/coins set (player) (value)"
    68.                     if arg-2 is set:
    69.                         if arg-3 is not set:
    70.                             message "&aCorrect Usage: &7/coins set (player) (value)"
    71.                         if arg-3 is set:
    72.                             set {coins.%arg-2%} to arg-3
    73.                             message "{@prefix} &7Operation completed successfully!"
    74.                             message "{@prefix} &7You have now &a%arg-3%&7 coins." to arg-2
    75.                 if arg-1 is "reset":
    76.                     if arg-2 is not set:
    77.                         message "&aCorrect Usage: &7/coins reset (player)"
    78.                     if arg-2 is set:
    79.                         set {coins.%arg-2%} to 0
    80.                         message "{@prefix} &7You reset &a%arg-2%&7's coins!"
    81.                         message "{@prefix} &7Your coins have been reset." to arg-2
    82.             if player does not have permission "coins.admin":
    83.                 message "&cYou don't have the permission."
    84.                        
    85. command /balance [<player>]:
    86.     description: See the player's balance.
    87.     usage: /balance <player>
    88.     executable by: players and console
    89.     trigger:
    90.         if arg-1 is not set:
    91.             message "{@prefix} &7Your balance is: &a%{coins.%player%}%&7."
    92.         if arg-1 is set:
    93.             message "{@prefix} &a%arg-1%&7's balance is: &a%{coins.%arg-1%}%&7."
    I was inactive for a time so sorry i forgot a lot :/
    --- Double Post Merged, Feb 5, 2017, Original Post Date: Feb 5, 2017 ---
    Okay, here a better Question:
    How is it possible that i lose coins, by entering a command?
    --- Double Post Merged, Feb 5, 2017 ---
    Ok got the one Thing now the other Thing is the "Bigger Than" dont works any help?
    Code (Skript):
    1. command /buy:
    2.     trigger:
    3.         if {coins.%player%} is bigger than 100:
    4.         give 16 tnt named "&7&lTest" to player
    5.         remove 100 from {coins.%player%}
    6.     else:
    7.         message "&6Test &8&7Test."


     
  2. Best Answer:
    Post #6 by ShaneBee, Feb 11, 2017
  3. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    Code (Skript):
    1. if {coins.%player%} >= 100:
    2.     #Do stuff
     
  4. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    Dont works :/
    --- Double Post Merged, Feb 6, 2017, Original Post Date: Feb 6, 2017 ---
    Here the Code it dont works the Problem is if i have 99 coins or lower i still can buy it and i lose -100 coins.

    Code (Skript):
    1. #Plugin by Mad. (on SkUnity)
    2. options:
    3.     prefix: &a&lCoins&r &7»&r
    4.     version: 1.0
    5.    
    6. variables:
    7.     {coins.%player%} = 0
    8.    
    9. on first join:
    10.     set {coins.%player%} to 0
    11.    
    12. command /coins [<text>] [<player>] [<int>]:
    13.     description: Hilfe für WeedMC - Coins.
    14.     usage: /coins (add:remove:set:reset) (player) (value)
    15.     executable by: players and console
    16.     trigger:
    17.         if arg-1 is not set:
    18.             message ""
    19.             message "&a&lWeedMC - Coins"
    20.             message ""
    21.             message "&8&7/coins add (player) (value) &a- Fügt Coins zu Spieler hinzu"
    22.             message "&8&7/coins remove (player) (value) &a- Löscht Coins von Spieler"
    23.             message "&8&7/coins set (player) (value) &a- Setzt die Coins von Spieler"
    24.             message "&8&7/coins reset (player) &a- Resetet die Coins von Spieler"
    25.             message ""
    26.         if arg-1 is set:
    27.             if player has permission "coins.admin":
    28.                 if arg-1 is "add":
    29.                     if arg-2 is not set:
    30.                         message "&aMeinst du: &7/coins add (player) (value)"
    31.                     if arg-2 is set:
    32.                         if arg-3 is not set:
    33.                             message "&aMeinst du: &7/coins add (player) (value)"
    34.                         if arg-3 is set:
    35.                             add arg-3 to {coins.%arg-2%}
    36.                             message "&6WeedMC &8&7Erfolgreich!"
    37.                             message "&6WeedMC &8&7Du bekommst &a%arg-3%&7 Coins." to arg-2
    38.                 if arg-1 is "remove":
    39.                     if arg-2 is not set:
    40.                         message "&aMeinst du: &7/coins remove (player) (value)"
    41.                     if arg-2 is set:
    42.                         if arg-3 is not set:
    43.                             message "&aMeinst du: &7/coins remove (player) (value)"
    44.                         if arg-3 is set:
    45.                             remove arg-3 from {coins.%arg-2%}
    46.                             message "&6WeedMC &8&7Erfolgreich!"
    47.                             message "&6WeedMC &8&7Du verlierst &a%arg-3%&7 Coins." to arg-2
    48.                 if arg-1 is "set":
    49.                     if arg-2 is not set:
    50.                         message "&aMeinst du: &7/coins set (player) (value)"
    51.                     if arg-2 is set:
    52.                         if arg-3 is not set:
    53.                             message "&aMeinst du: &7/coins set (player) (value)"
    54.                         if arg-3 is set:
    55.                             set {coins.%arg-2%} to arg-3
    56.                             message "&6WeedMC &8&7Erfolgreich!"
    57.                             message "&6WeedMC &8&7Du hast jetzt &a%arg-3%&7 Coins." to arg-2
    58.                 if arg-1 is "reset":
    59.                     if arg-2 is not set:
    60.                         message "&aMeinst du: &7/coins reset (player)"
    61.                     if arg-2 is set:
    62.                         set {coins.%arg-2%} to 0
    63.                         message "&6WeedMC &8&7Du hast die Coins von &a%arg-2%&7's Resetet!"
    64.                         message "&6WeedMC &8&7Deine Coins wurden Resetet." to arg-2
    65.             if player does not have permission "coins.admin":
    66.                 message "&cDu hast nicht die Rechte dazu!"
    67.                        
    68. command /balance [<player>]:
    69.     usage: /balance <player>
    70.     aliases: /guthaben
    71.     executable by: players and console
    72.     trigger:
    73.         if arg-1 is not set:
    74.             message "&6WeedMC &8&7Dein Guthaben: &a%{coins.%player%}%&7."
    75.         if arg-1 is set:
    76.             message "&6WeedMC &8&a%arg-1%&7's &7Guthaben beträgt: &a%{coins.%arg-1%}%&7."
    77.  
    78. command /kaufen:
    79.     trigger:
    80.         if {coins.%player%} >= 100:
    81.         give 16 tnt named "&7&lTest" to player
    82.         remove 100 from {coins.%player%}
    83.     else:
    84.         message "&6WeedMC &8&7Du hast nicht genug Guthaben."
     
  5. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    This is working for me
    Code (Skript):
    1. command /kaufen:
    2.     trigger:
    3.         if {coins.%player%} >= 100:
    4.             give 16 tnt named "&7&lTest" to player
    5.             remove 100 from {coins.%player%}
    6.         else:
    7.             message "&6WeedMC &8&7Du hast nicht genug Guthaben."
     
  6. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    So when you enter this command with under 99 balance you cant get it? and the message comes?
     
  7. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    See this!
    [​IMG]
    [​IMG]
    [​IMG]
    with this
    Code (Skript):
    1. command /kaufen:
    2.     trigger:
    3.         if {coins.%player%} >= 100:
    4.             give 16 tnt named "&7&lTest" to player
    5.             remove 100 from {coins.%player%}
    6.             send "&a&lSuccesfull Purchase"
    7.         else:
    8.             message "&6WeedMC &8&7Du hast nicht genug Guthaben."
     
    ImEnzo likes this.
  8. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    Works now thx!
     

Share This Page

Loading...