luckperms voucher 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!

shakyslime

Member
Jul 20, 2024
3
1
3
so i made a voucher rank for luckperms bc i want to use a piece of paper and right clicking does a console command and removes it from your inventory, but i encountered a problem that i cant get past. when i use this code
[LIST=1]
[*]on right click with paper:
[*] If name of player's tool is "&cOwner Rank":
[*] make console execute command "lp user %player% parent set owner"
[*] remove 1 of event-item from player's inventory
[/LIST]

it doesnt work but however when i change the color code from "&c" to "&a" it suddenly works. someone please help me fix this. my server is on minehut if u were wondering
 
so i made a voucher rank for luckperms bc i want to use a piece of paper and right clicking does a console command and removes it from your inventory, but i encountered a problem that i cant get past. when i use this code
[LIST=1]
[*]on right click with paper:
[*] If name of player's tool is "&cOwner Rank":
[*] make console execute command "lp user %player% parent set owner"
[*] remove 1 of event-item from player's inventory
[/LIST]

it doesnt work but however when i change the color code from "&c" to "&a" it suddenly works. someone please help me fix this. my server is on minehut if u were wondering
Firstly, you'll wanna format your code just so it's easier to read (In a code block). Also, you'll need to make sure that the name of the item and the name of the item you put in the code are identical. If there's one thing that isn't accurate with either, (Ie: If the name of actual item is "&r&cOwner Rank"), then your code will not work. Also, keep in mind if your item also has a lore, it probably will not work either cause then you also need to check for that too. Another issue I see with the code in general (Not major) is that you almost never want to run console commands using Skript. The main reason as to why is that lines of code like that usually tend to be pretty long and Skript already has built in expressions that allow you to change previously longer lines to shorter lines. Longer/more lines does not mean good code. Below I've fixed these solutions but before you go and copy and paste the code I've provided, see if you can solve the issues on your own.

Code:
command givevoucher: # This way you can give yourself and exact copy of the paper
   permission: *
   trigger:
      give player 1 of paper named "&c[Owner] Rank"

on right click with paper:
   if name of player's tool is "&c[Owner] Rank": # with lore "Example" is optional, "Example" can be anything
      set player's group to "Owner" # Much shorter and easier for your server to process
      remove 1 of held item from player
ALSO: If you want to go way more advanced with this, you could create a function to set the player's group and remove the player's item if you have 3-4 different rank vouchers, which would make your overall total code several lines shorter.
 
Firstly, you'll wanna format your code just so it's easier to read (In a code block). Also, you'll need to make sure that the name of the item and the name of the item you put in the code are identical. If there's one thing that isn't accurate with either, (Ie: If the name of actual item is "&r&cOwner Rank"), then your code will not work. Also, keep in mind if your item also has a lore, it probably will not work either cause then you also need to check for that too. Another issue I see with the code in general (Not major) is that you almost never want to run console commands using Skript. The main reason as to why is that lines of code like that usually tend to be pretty long and Skript already has built in expressions that allow you to change previously longer lines to shorter lines. Longer/more lines does not mean good code. Below I've fixed these solutions but before you go and copy and paste the code I've provided, see if you can solve the issues on your own.

Code:
command givevoucher: # This way you can give yourself and exact copy of the paper
   permission: *
   trigger:
      give player 1 of paper named "&c[Owner] Rank"

on right click with paper:
   if name of player's tool is "&c[Owner] Rank": # with lore "Example" is optional, "Example" can be anything
      set player's group to "Owner" # Much shorter and easier for your server to process
      remove 1 of held item from player
ALSO: If you want to go way more advanced with this, you could create a function to set the player's group and remove the player's item if you have 3-4 different rank vouchers, which would make your overall total code several lines shorter.
thanks
 
  • Like
Reactions: Luke_Sky_Walker