need quick 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 community!

    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!

elyexee

Member
Jul 16, 2023
30
0
6
hi so what i want to do is when people buy an ender chest named "vault +1" it gives one more vault but it seems that it just gives 2 vaults because i did execute console command

Code:
on rightclick with ender chest:
    if name of tool of player is "&f&lVault +1":
        remove player's held item from player's inventory
        play sound "block.note_block.pling" at volume 1 at pitch 2 to player
        execute console command "/lp user %player% permission set playervaults.amount.2 true"
        send "&4&lNow u got +1 Vault"
 
try this:

Code:
on load:
    set {vualt} to tripwire hook named "&f&lVault +1"
    # u can change the item lmao



on rightclick with ender chest:
    if type of player's held item contains {vualt}:
        remove 1 of tripwire hook named "&f&lVault +1" from player's inventory
        play sound "block.note_block.pling" at volume 1 at pitch 2 to player
        execute console command "/lp user %player% permission set playervaults.amount.2 true"
        send "&4&lNow u got +1 Vault"

Also u didnt need to do &f bc default code for names is white. If you were adding lores with skript im not sure but for lore the default is &5
 
try this:

Code:
on load:
    set {vualt} to tripwire hook named "&f&lVault +1"
    # u can change the item lmao



on rightclick with ender chest:
    if type of player's held item contains {vualt}:
        remove 1 of tripwire hook named "&f&lVault +1" from player's inventory
        play sound "block.note_block.pling" at volume 1 at pitch 2 to player
        execute console command "/lp user %player% permission set playervaults.amount.2 true"
        send "&4&lNow u got +1 Vault"

Also u didnt need to do &f bc default code for names is white. If you were adding lores with skript im not sure but for lore the default is &5
That’s just not what he asked for you to do, he asked for a way to do +1 vault multiple times
 
hi so what i want to do is when people buy an ender chest named "vault +1" it gives one more vault but it seems that it just gives 2 vaults because i did execute console command

Code:
on rightclick with ender chest:
    if name of tool of player is "&f&lVault +1":
        remove player's held item from player's inventory
        play sound "block.note_block.pling" at volume 1 at pitch 2 to player
        execute console command "/lp user %player% permission set playervaults.amount.2 true"
        send "&4&lNow u got +1 Vault"
Your issue is the "playervaults.amount.2 true" part (Change the 2 to a 1). I would also recommend, if you haven't already, use SkQuery to use the expression:
Code:
add "example" to player's permissions
Not only will this shorten a line your code (Longer lines take longer to run that shorter ones!), but it can also mean you can use a function to add vault slots regardless of the number attached to it. I'll write an example function below.

Code:
function updatevault(n: number, p: player):
   set {_na} to name of {_p}'s tool
   if {_na} contains "&f&lVault +":
      remove {_p}'s held item
      play sound "block.note_block.pling" at volume 1 at pitch 2 to {_p}
      set {_nam::*} to {_na} split at "&f&lVault +"
      # Add the rest of the code you want here. For more help: {_nam::2} contains the number of player vault so you can add that in text for adding the permission to the player

Note: None of this is tested and it may not work. Also make sure you know how to use this kinda function before adding it! By the way: the reason you'd want a function instead of what you currently have is so that you could shorten your code by many lines if you wanted to add more vault slot type items.