Solved Improving my Skript

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

iMinePixels

Member
Mar 12, 2024
22
1
1
Hello, I am really new to skript. I made a money voucher to grant a random amount of money, that I set, but I feel like the way that I did it, isn't safe, or may bug out.

As of now, it works flawlessly, but again, feels unsafe. Could I get some help making this more safe? i doubt if this will be okay to use on a live server?

Edit 1: I only made it "if player's tool's display name is "&a&lᴍᴏɴᴇʏ ᴘᴏᴜᴄʜ &8(&7Tier-1&8)":" because no one on the server will be able to rename items with color, so ultimately, only those who have the item can only right-click it for the skript to run. They cannot produce an item with the same colors and format.

Code:
on rightclick:
    if player's tool is a paper:
        if player's tool's display name is "&a&lᴍᴏɴᴇʏ ᴘᴏᴜᴄʜ &8(&7Tier-1&8)":
            cancel the event
            remove 1 of player's tool from player's inventory
            set {_amount} to a random integer between 500 and 10000
            execute console command "eco give %player% %{_amount}%"
 
Last edited:
I'd still be careful with adding colour codes. Could still be faked by someone, although can't remember if anvils let you put & in.

If you've got Vault installed, you can do add {_amount} to balance of player
 
  • Like
Reactions: Luke_Sky_Walker
I'd still be careful with adding colour codes. Could still be faked by someone, although can't remember if anvils let you put & in.

If you've got Vault installed, you can do add {_amount} to balance of player
I don't think anvils do that on java. I recall seeing multiple plugins make anvils do that though.

I can switch out the execute line for what you said, thank you.

This is what it looks like if a player renames a paper to exactly that the item's name is. Which when they do that, no longer is right-clickable.

1711036196512.png
 
Last edited:
I don't think anvils do that on java. I recall seeing multiple plugins make anvils do that though.

I can switch out the execute line for what you said, thank you.

This is what it looks like if a player renames a paper to exactly that the item's name is. Which when they do that, no longer is right-clickable.

View attachment 8373
With the colour codes, if you have EssentialsX installed you can use /iname for colours.
 
He does have essentials installed (you can tell from the eco give command) but also /iname requires a specific permission, so not applicable in this instance.
 
He does have essentials installed (you can tell from the eco give command) but also /iname requires a specific permission, so not applicable in this instance.
Exactly this, I do not plan to give anyone access to the item rename command or any other ability to create this formatted name. I guess imma just consider this solved, if something comes up, ill make a new post. Thank you everyone.