My ChestShop.sk: how are people stealing?!

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

redbau

New Member
Feb 3, 2017
6
0
1
43
I've developed a chestshop Skript that sets a yaml variable (shop=true) when a player opens a chest shop, and then checks on inventory click to verify shop=true, but a very tiny few (3 so far) players have been able to bypass this and steal from my chest shop. Can anyone offer insight into how I can prevent this or a potential flaw in my approach?

Here's the code: https://pastebin.com/Lka46E9f

The main part sets a variable on this action (line 99):
code_language.skript:
on rightclick on a chest or trapped chest: # works with both types of chests

Then later on line 131 i do the transaction if shop=true within:
code_language.skript:
on inventory click:

Should I be adding ticks to wait between file writing? Are there client mods people can use to bypass chest clicks?

Thank you if you read this and can offer any insights or directions for me to investigate more. I'm honestly not sure how to even debug the issue at this point.
 
I've had the same issues and seen other servers with the same issue, last time I fixed this by just looping all items in all players inventory then checking for names of chest items and removing them from loop-player's inventory, I don't know any other fixes.
 
@Donut {plain-variables} ended up being too slow as that file is now over 1.5mb large! I flattened out each user to a basic set of 5 variables in the .yml file so it's much faster now and avoided any lag problems before using plain global variables.

I've had the same issues and seen other servers with the same issue, last time I fixed this by just looping all items in all players inventory then checking for names of chest items and removing them from loop-player's inventory, I don't know any other fixes.

@BoatXD can you share that inventory check code please? That sounds like a pain to write from scratch! Thanks for your help, this issue is making me very sad for my users.
 
@Donut {plain-variables} ended up being too slow as that file is now over 1.5mb large! I flattened out each user to a basic set of 5 variables in the .yml file so it's much faster now and avoided any lag problems before using plain global variables.



@BoatXD can you share that inventory check code please? That sounds like a pain to write from scratch! Thanks for your help, this issue is making me very sad for my users.
That's not true, YML will never be faster than variables (assuming vars are working correctly)
 
That's not true, YML will never be faster than variables (assuming vars are working correctly)

@Pikachu Can you please explain how vars are faster, are they kept in memory always? Why would I see a performance increase switching to a series of tiny YML files vs a huge 1.5MB variables file with tens of thousands of lines? I'm trying to understand what I'm missing, so thanks for helping to clarify!
 
This is exactly how variables work, which is why they'll always be faster than YAML (in Skript, at least).

How often does Skript write vars to disk? I was seeing lag issues before I switched to YAML and now these issues are gone, so I'm not sure how to measure variable performance beyond these tests.
 
Status
Not open for further replies.