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.

Gui help

Discussion in 'Skript' started by AKRODOGY, Jul 18, 2018.

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

    AKRODOGY Active Member

    Joined:
    Mar 20, 2018
    Messages:
    52
    Likes Received:
    2
    I want to make a gui with buy permission and when the permission is buyed the slot in the chest with this permission to replace with a redstone block

    command /permisiuni:
    trigger:
    open chest with 6 row named "&cPermisiuni" to player
    wait 1 tick
    format slot 0 of player with diamond named "WorldEdit" with lore "5k" to close then run "admin we"
    format slot 1 of player with diamond named "fawe.plotsquared" with lore "?" to close then run "admin fawe"
    format slot 2 of player with diamond named "voxelsniper.*" with lore "4.5k" to close then run "admin vs"

    this is the skript,

    Ex: I buy Worldedit permission.And when in tap /permisiuni , the slot 0 in not be a diamond, to be a redstone block

    Sorry for bad english
    --- Double Post Merged, Jul 18, 2018, Original Post Date: Jul 18, 2018 ---
    ?
     
  2. Aidanete

    Aidanete Active Member

    Joined:
    Apr 11, 2017
    Messages:
    139
    Likes Received:
    9
    I don't understand exactly what you're trying to ask, but I think this will work.
    Code (Skript):
    1. command /permisiuni:
    2.     trigger:
    3.         open chest with 6 row named "&cPermisiuni" to player
    4.         wait 1 tick
    5.         if {bought.we.%player%} is true:
    6.             format slot 0 of player with redstone block named "&cBought!" with lore "5k" to close
    7.         else:
    8.             format slot 0 of player with diamond named "WorldEdit" with lore "5k" to close then run "admin we"
    9.         format slot 1 of player with diamond named "fawe.plotsquared" with lore "?" to close then run "admin fawe"
    10.         format slot 2 of player with diamond named "voxelsniper.*" with lore "4.5k" to close then run "admin vs"
    11. command /adminwe:
    12.     trigger:
    13.         set {bought.we.%player%} to true
    14.  
    Probably you will need to do some modifies
     
  3. Snow-Pyon

    Moderator Resource Staff

    Joined:
    Jan 25, 2017
    Messages:
    1,236
    Likes Received:
    176
    Medals:
    Please do not use skQuery's format slot, it is known to be buggy.

    Just use vanilla Skript instead:
    Code (Skript):
    1. command /permission:
    2.   trigger:
    3.  
    4.     open chest inventory named "<light red>Permission" with 6 rows to the player
    5.  
    6.     set slot 0 of top inventory to diamond named "WorldEdit" with lore "5k"
    7.     # Skript doesn't  have an '<item> with lore <lines>' expression yet.
    8.     # Meanwhile, I recommend using skQuery for it or if you don't want dependencies, use:
    9.     # set line 1 of slot 0 of top inventory to "5k"
    10.  
    11.  
    12. # A function to simplify the process, takes the name as the permission and the first line of the lore as the price for it.
    13. # Returns the permission if it was successfully bought.
    14. function buyPermission(perm-item: item, buyer: player) :: text:
    15.  
    16.   set {_price::*} to line 1 of {_perm-item}'s lore parsed as "%number%%string%"
    17.  
    18.   if  {_price::2} is "k":
    19.     set {_price} to {_price::1} + 1000
    20.   else if {_price::2} is "m":
    21.     set  {_price} to {_price::1} + 1000000
    22.   else:
    23.     set {_price} to {_price::1}
    24.  
    25.   set {_name} to uncolored display name of {_perm-item}
    26.  
    27.   set {_permission} to {_name} if {_name} contains ".", else "%{_name}%.*"
    28.   if {_buyer}'s money is greater than or equal to {_price}:
    29.     remove {_price} from {_buyer}'s money
    30.     execute console command "lp user %{_buyer}% %{_permission}% set" # this is for LuckPerms, if you don't want it to spam the console use skUniversal's hook
    31.     return {_permission}
    32.  
    33.  
    34. on inventory click:
    35.   display name of clicked inventory is "<light red>Permission"
    36.  
    37.   set {_perm} to buyPermission(clicked slot, player)
    38.   if {_perm} is set:
    39.     send "<light green>Successfully bought the permission <yellow>'%{_perm}%'"
    40.   else:
    41.     send "<light red>Sorry but you don't have enough money for this."
     
    #3 Snow-Pyon, Jul 18, 2018
    Last edited: Jul 18, 2018
  4. AKRODOGY

    AKRODOGY Active Member

    Joined:
    Mar 20, 2018
    Messages:
    52
    Likes Received:
    2
Thread Status:
Not open for further replies.

Share This Page

Loading...