Jump to content

Buy ranks


g1ps

Recommended Posts

How to make the player buy ranks one by one ?

options:
  reloadAlert: true 
  guiformat: gray stained glass pane with hidden all flags named "&7"

function openRankGUI(opener: player, p: player):
  set {_u} to uuid of {_p}
  create a gui with virtual chest named "&2&lranks" with 5 rows:
    format gui slot (integers between 0 and 44) to {@guiformat}
    format gui slot 10 with paper named "&rtest1" with lore "&r1000"
    format gui slot 11 with paper named "&rtest2" with lore "&r2000"
    format gui slot 12 with paper named "&rtest3" with lore "&r3000"
    format gui slot 13 with paper named "&rtest4" with lore "&r4000"
    format gui slot 14 with paper named "&rtest5" with lore "&r5000"
    format gui slot 15 with paper named "&rtest6" with lore "&r6000"
    format gui slot 16 with paper named "&rtest7" with lore "&r7000"
    format gui slot 19 with paper named "&rtest8" with lore "&r8000"
    format gui slot 20 with paper named "&rtest9" with lore "&r9000"
    format gui slot 21 with paper named "&rtest10" with lore "&r10000"
    format gui slot 22 with paper named "&rtest11" with lore "&r11000"
    format gui slot 23 with paper named "&rtest12" with lore "&r12000"
    format gui slot 24 with paper named "&rtest13" with lore "&r13000"
    format gui slot 25 with paper named "&rtest14" with lore "&r14000"
    format gui slot 30 with paper named "&rtest15" with lore "&r15000"
    format gui slot 31 with paper named "&rtest16" with lore "&r16000"
    format gui slot 32 with paper named "&rtest17" with lore "&r17000"
    format gui slot 33 with paper named "&rtest18" with lore "&r18000"
  open last gui to {_opener}
    
on inventory click:
  inventory name of current inventory of player is "&2&lranks":
    cancel event
    set {_u} to uuid of player
    set {_base} to 1
    set {_price} to 1000
    clicked slot is 10:
      if {purchasedslot::%{_base}%::*} does not contain {_u}:
        if balance of player >= {_price}:
          add {_u} to {purchasedslot::%{_base}%::*}
          make console execute command "/broadcast %{_base}%"
          remove {_price} from balance of player
          send "&aSuccessfully purchased this item."
        else:
          send "&cError: &aNot enough money."
      else:
        send "&cError: &aYou already purchased this."

    clicked slot is 11:
      add 1 to {_base}
      set {_price} to (1000*{_base})
      if {purchasedslot::%{_base}%::*} does not contain {_u}:
        if balance of player >= {_price}:
          add {_u} to {purchasedslot::%{_base}%::*}
          make console execute command "/broadcast %{_base}%"
          remove {_price} from balance of player
          send "&aSuccessfully purchased this item."
        else:
          send "&cError: &aNot enough money."
      else:
        send "&cError: &aYou already purchased this."
    
    clicked slot is 12:
      add 2 to {_base}
      set {_price} to (1000*{_base})
      if {purchasedslot::%{_base}%::*} does not contain {_u}:
        if balance of player >= {_price}:
          add {_u} to {purchasedslot::%{_base}%::*}
          make console execute command "/broadcast %{_base}%"
          remove {_price} from balance of player
          send "&aSuccessfully purchased this item."
        else:
          send "&cError: &aNot enough money."
      else:
        send "&cError: &aYou already purchased this."
    
    
    clicked slot is 13:
      add 3 to {_base}
      set {_price} to (1000*{_base})
      if {purchasedslot::%{_base}%::*} does not contain {_u}:
        if balance of player >= {_price}:
          add {_u} to {purchasedslot::%{_base}%::*}
          make console execute command "/broadcast %{_base}%"
          remove {_price} from balance of player
          send "&aSuccessfully purchased this item."
        else:
          send "&cError: &aNot enough money."
      else:
        send "&cError: &aYou already purchased this."
    
    
    clicked slot is 14:
      add 4 to {_base}
      set {_price} to (1000*{_base})
      if {purchasedslot::%{_base}%::*} does not contain {_u}:
        if balance of player >= {_price}:
          add {_u} to {purchasedslot::%{_base}%::*}
          make console execute command "/broadcast %{_base}%"
          remove {_price} from balance of player
          send "&aSuccessfully purchased this item."
        else:
          send "&cError: &aNot enough money."
      else:
        send "&cError: &aYou already purchased this."
    
    clicked slot is 15:
      add 5 to {_base}
      set {_price} to (1000*{_base})
      if {purchasedslot::%{_base}%::*} does not contain {_u}:
        if balance of player >= {_price}:
          add {_u} to {purchasedslot::%{_base}%::*}
          make console execute command "/broadcast %{_base}%"
          remove {_price} from balance of player
          send "&aSuccessfully purchased this item."
        else:
          send "&cError: &aNot enough money."
      else:
        send "&cError: &aYou already purchased this."
    
    clicked slot is 16:
      add 6 to {_base}
      set {_price} to (1000*{_base})
      if {purchasedslot::%{_base}%::*} does not contain {_u}:
        if balance of player >= {_price}:
          add {_u} to {purchasedslot::%{_base}%::*}
          make console execute command "/broadcast %{_base}%"
          remove {_price} from balance of player
          send "&aSuccessfully purchased this item."
        else:
          send "&cError: &aNot enough money."
      else:
        send "&cError: &aYou already purchased this."
    
    clicked slot is 19:
      add 7 to {_base}
      set {_price} to (1000*{_base})
      if {purchasedslot::%{_base}%::*} does not contain {_u}:
        if balance of player >= {_price}:
          add {_u} to {purchasedslot::%{_base}%::*}
          make console execute command "/broadcast %{_base}%"
          remove {_price} from balance of player
          send "&aSuccessfully purchased this item."
        else:
          send "&cError: &aNot enough money."
      else:
        send "&cError: &aYou already purchased this."
    
    clicked slot is 20:
      add 8 to {_base}
      set {_price} to (1000*{_base})
      if {purchasedslot::%{_base}%::*} does not contain {_u}:
        if balance of player >= {_price}:
          add {_u} to {purchasedslot::%{_base}%::*}
          make console execute command "/broadcast %{_base}%"
          remove {_price} from balance of player
          send "&aSuccessfully purchased this item."
        else:
          send "&cError: &aNot enough money."
      else:
        send "&cError: &aYou already purchased this."
    
    clicked slot is 21:
      add 9 to {_base}
      set {_price} to (1000*{_base})
      if {purchasedslot::%{_base}%::*} does not contain {_u}:
        if balance of player >= {_price}:
          add {_u} to {purchasedslot::%{_base}%::*}
          make console execute command "/broadcast %{_base}%"
          remove {_price} from balance of player
          send "&aSuccessfully purchased this item."
        else:
          send "&cError: &aNot enough money."
      else:
        send "&cError: &aYou already purchased this."
    
    clicked slot is 22:
      add 10 to {_base}
      set {_price} to (1000*{_base})
      if {purchasedslot::%{_base}%::*} does not contain {_u}:
        if balance of player >= {_price}:
          add {_u} to {purchasedslot::%{_base}%::*}
          make console execute command "/broadcast %{_base}%"
          remove {_price} from balance of player
          send "&aSuccessfully purchased this item."
        else:
          send "&cError: &aNot enough money."
      else:
        send "&cError: &aYou already purchased this."
    
    clicked slot is 23:
      add 11 to {_base}
      set {_price} to (1000*{_base})
      if {purchasedslot::%{_base}%::*} does not contain {_u}:
        if balance of player >= {_price}:
          add {_u} to {purchasedslot::%{_base}%::*}
          make console execute command "/broadcast %{_base}%"
          remove {_price} from balance of player
          send "&aSuccessfully purchased this item."
        else:
          send "&cError: &aNot enough money."
      else:
        send "&cError: &aYou already purchased this."
    
    clicked slot is 24:
      add 12 to {_base}
      set {_price} to (1000*{_base})
      if {purchasedslot::%{_base}%::*} does not contain {_u}:
        if balance of player >= {_price}:
          add {_u} to {purchasedslot::%{_base}%::*}
          make console execute command "/broadcast %{_base}%"
          remove {_price} from balance of player
          send "&aSuccessfully purchased this item."
        else:
          send "&cError: &aNot enough money."
      else:
        send "&cError: &aYou already purchased this."
    
    clicked slot is 25:
      add 13 to {_base}
      set {_price} to (1000*{_base})
      if {purchasedslot::%{_base}%::*} does not contain {_u}:
        if balance of player >= {_price}:
          add {_u} to {purchasedslot::%{_base}%::*}
          make console execute command "/broadcast %{_base}%"
          remove {_price} from balance of player
          send "&aSuccessfully purchased this item."
        else:
          send "&cError: &aNot enough money."
      else:
        send "&cError: &aYou already purchased this."
    
    clicked slot is 30:
      add 14 to {_base}
      set {_price} to (1000*{_base})
      if {purchasedslot::%{_base}%::*} does not contain {_u}:
        if balance of player >= {_price}:
          add {_u} to {purchasedslot::%{_base}%::*}
          make console execute command "/broadcast %{_base}%"
          remove {_price} from balance of player
          send "&aSuccessfully purchased this item."
        else:
          send "&cError: &aNot enough money."
      else:
        send "&cError: &aYou already purchased this."
    
    clicked slot is 31:
      add 15 to {_base}
      set {_price} to (1000*{_base})
      if {purchasedslot::%{_base}%::*} does not contain {_u}:
        if balance of player >= {_price}:
          add {_u} to {purchasedslot::%{_base}%::*}
          make console execute command "/broadcast %{_base}%"
          remove {_price} from balance of player
          send "&aSuccessfully purchased this item."
        else:
          send "&cError: &aNot enough money."
      else:
        send "&cError: &aYou already purchased this."
    
    clicked slot is 32:
      add 16 to {_base}
      set {_price} to (1000*{_base})
      if {purchasedslot::%{_base}%::*} does not contain {_u}:
        if balance of player >= {_price}:
          add {_u} to {purchasedslot::%{_base}%::*}
          make console execute command "/broadcast %{_base}%"
          remove {_price} from balance of player
          send "&aSuccessfully purchased this item."
        else:
          send "&cError: &aNot enough money."
      else:
        send "&cError: &aYou already purchased this."

    clicked slot is 33:
      add 17 to {_base}
      set {_price} to (1000*{_base})
      if {purchasedslot::%{_base}%::*} does not contain {_u}:
        if balance of player >= {_price}:
          add {_u} to {purchasedslot::%{_base}%::*}
          make console execute command "/broadcast %{_base}%"
          remove {_price} from balance of player
          send "&aSuccessfully purchased this item."
        else:
          send "&cError: &aNot enough money."
      else:
        send "&cError: &aYou already purchased this."

command /rankgui [<player>]:
  trigger:
    openRankGUI(player, arg-1)

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...