Oh? I guess Value.Value is indeed a table, that’s my mistake. It’s likely “Value.Value.value” because of better-sqlite3’s return format and because the value’s key name is “value.”
Alright, thanks. It’s all coming together. I never would have thought the creator of the thread would ever help me. Again, thank you so much. I would never have done this without all your support. I will contact you if I ever need any more help. Again, thanks!
So, it turns out the sql can’t take any more than a request per .2 seconds. I’m trying to make it so that game 1 makes a value true for .1 seconds, while game 2 sees what the value is every .2 seconds. This is inefficient and does not work all the time. If I make it any faster than .2 seconds, it will not be able to handle this many requests. Is there any way I am able to send events?
Running the check every .2
seconds will make you exhaust the 500/minute HTTP limit. Try doing something like 1 request a second- this will leave plenty of additional requests for other scripts.
Now, it has seems that it has completely ceased function. It does not print anything or send any requests anymore, even though I had not changed anything.
Could you provide your code? If it stopped working, then something had to of changed. Are there any errors? Did you accidentally disable the script?
Nothing changed. It was because it was exhausted and it stopped working for a few minutes. Also, how am I going to be able to use this for individual player data. Like for example, a player would buy a car in game 1, and it saves that information along with the player id, then in game 2, the player would still have the car, because it gets the information for the player’s id.
You would PostAsync a json encoded array, then retrieve and json decode it with GetAsync.
You shouldn’t do a loop for player data, though as that’ll also exhaust your http limits.
How would I be able to store infinite amount of player information? Because it says that each section from the table stores 2 variables, meaning there would only be 6 variables stored. That is significantly less than infinity.
I don’t understand what you mean? You can store however much data you want as long as it’s able to be sent to the server and the server has enough space.
The table stores two variables, key and value. Both of which can be json encoded arrays which allow you to store many, many variables. JSON is the preferred format for using this, as it allows you to save different types of variables (numbers, booleans, strings, etc)
So in theory, I would be able to create infinite tables like this?
sql:PostAsync(tostring(player.userId), tostring(player.userId), jsonthingvariable, function(Success, Value, ServerResponse)
Yes, but the first argument (table) can’t be dynamic. It should be constant and based on your config (eg table2 or Users.)
Alright, I’ll test it out later. Thanks for the help