Best way to just save the data from an array
Hey, guys! I just want to ask you which is the best way to just save the data from an array and call it like in plugin_init for the maptime. Because arrays are global and they just reset on map change. That's why I just want the most simple and efficient way to save the data from an array. Sql, vault, some other way or?
|
Re: Best way to just save the data from an array
It depends on what you want to save. You can create an ini file if you want to store sth like players names, gag time, etc. If you are saving points use nvault/mysql.
|
Re: Best way to just save the data from an array
Yes, they are mostly strings, one trie and one integer. Different. I don't want to use it anywhere, just to save it for the next map.
|
Re: Best way to just save the data from an array
Just use nVault. It's so much easier than trying to parse data from a file.
|
Re: Best way to just save the data from an array
Quote:
|
Re: Best way to just save the data from an array
https://forums.alliedmods.net/showthread.php?t=244605
This is the widely accepted option, but it requires a different data system than what you're using. If you seriously want to save contents of a trie then you would need to use CellTravTrie so you're able to traverse it. I still suggest changing your data to JSON object because that's like, a million times better. |
Re: Best way to just save the data from an array
I really didn't try to use that JSON, because I simply can't understand even a bit of it...
So, here is what I though out, but unfortunately it's not working (maybe because it's not properly coded). What I actually did? Well, I pushed new string into the array enum - it's players ID. After this I save it as a string and used it as a key for retrieving the data from the trie. Btw, I don't know if it's possible to return a string via nvault, but since all the numbers must be converted to strings, I think it will be okay. PHP Code:
|
Re: Best way to just save the data from an array
There should probably be one global Trie, instead of one for each player.
|
Re: Best way to just save the data from an array
Well, you're asking for help. I gave you the best solution available, use JSON. Instead of making excuses that you can't use it, why don't you at least try it? It's really not any more difficult than using arrays and tries, plus there are tutorials all over the internet on how to use Jansson. The AMXX version is not that much different.
|
| All times are GMT -4. The time now is 13:14. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.