Gui help

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

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

AKRODOGY

Active Member
Mar 20, 2018
52
2
8
24
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
[doublepost=1531908961,1531906918][/doublepost]?
 
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
[doublepost=1531908961,1531906918][/doublepost]?

I don't understand exactly what you're trying to ask, but I think this will work.
code_language.skript:
command /permisiuni:
    trigger:
        open chest with 6 row named "&cPermisiuni" to player
        wait 1 tick
        if {bought.we.%player%} is true:
            format slot 0 of player with redstone block named "&cBought!" with lore "5k" to close
        else:
            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"
command /adminwe:
    trigger:
        set {bought.we.%player%} to true

Probably you will need to do some modifies
 
Please do not use skQuery's format slot, it is known to be buggy.

Just use vanilla Skript instead:
code_language.skript:
command /permission:
  trigger:

    open chest inventory named "<light red>Permission" with 6 rows to the player

    set slot 0 of top inventory to diamond named "WorldEdit" with lore "5k"
    # Skript doesn't  have an '<item> with lore <lines>' expression yet.
    # Meanwhile, I recommend using skQuery for it or if you don't want dependencies, use:
    # set line 1 of slot 0 of top inventory to "5k"


# A function to simplify the process, takes the name as the permission and the first line of the lore as the price for it.
# Returns the permission if it was successfully bought.
function buyPermission(perm-item: item, buyer: player) :: text:

  set {_price::*} to line 1 of {_perm-item}'s lore parsed as "%number%%string%"
 
  if  {_price::2} is "k":
    set {_price} to {_price::1} + 1000
  else if {_price::2} is "m":
    set  {_price} to {_price::1} + 1000000
  else:
    set {_price} to {_price::1}

  set {_name} to uncolored display name of {_perm-item}

  set {_permission} to {_name} if {_name} contains ".", else "%{_name}%.*"
  if {_buyer}'s money is greater than or equal to {_price}:
    remove {_price} from {_buyer}'s money
    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
    return {_permission}
 

on inventory click:
  display name of clicked inventory is "<light red>Permission"

  set {_perm} to buyPermission(clicked slot, player)
  if {_perm} is set:
    send "<light green>Successfully bought the permission <yellow>'%{_perm}%'"
  else:
    send "<light red>Sorry but you don't have enough money for this."
 
Last edited:
Status
Not open for further replies.