1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

My ChestShop.sk: how are people stealing?!

Discussion in 'Skript' started by redbau, Jul 24, 2017.

Tags:
Thread Status:
Not open for further replies.
  1. redbau

    redbau New Member

    Joined:
    Feb 3, 2017
    Messages:
    6
    Likes Received:
    0
    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 (Skript):
    1. 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 (Skript):
    1. 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.
     
  2. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    232
  3. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    232
    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.
     
  4. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    232
    @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.
     
  5. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    232
    That's not true, YML will never be faster than variables (assuming vars are working correctly)
     
  6. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    232
    @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!
     
  7. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    232
    This is exactly how variables work, which is why they'll always be faster than YAML (in Skript, at least).
     
  8. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    232
    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.
     
Thread Status:
Not open for further replies.

Share This Page

Loading...