storing multiple values in nvault?
title
For example... store player's money, armor and a custom currency.. Can this be done by storing them in an array? new gArray[33]= { gMoney, gArmor, gCredits } Just save gArray in the savevalue function? |
Re: storing multiple values in nvault?
PHP Code:
|
Re: storing multiple values in nvault?
You can do it an easier way. Let me know how many numbers you need to store and the max possible value of each.
|
Re: storing multiple values in nvault?
Save them permanently even if the server crashes... if It's even possible. So max possible value of... 200 for one value, for the other value let it be played time... so I don't know the limit But I also want it to be permanently saved.
@OcixCrom I'll see Bugsy's way and decide which is more suitable for me |
Re: storing multiple values in nvault?
Quote:
|
Re: storing multiple values in nvault?
Quote:
|
Re: storing multiple values in nvault?
My original plan was to store the values within 1 cell since there are 4 bytes to work with. This is useful if you are storing multiple booleans or multiple small value numbers. Play time can get high so this approach would not be good because you would probably need 16 bits just for play time alone, leaving only 16 for the remainder of the values. Also, it could be confusing unless you are familiar with bit operations.
Instead here is something easier. For this you will need nVault Utility PHP Code:
|
Re: storing multiple values in nvault?
Bear in mind that the data is saved when the client successfully disconnects from the server, so if the server crashes, none of it will get saved. You can avoid this by saving the data in another way, for example when the player spawns, which will have a far less impact when it crashes, but I'm not sure how this will affect the performance.
|
Re: storing multiple values in nvault?
I'll keep that in mind. But can I add inside plugin_end an index for online players with get_players and when it crashes (ends) it saves it for every player? Yes.. confusing indeed
|
Re: storing multiple values in nvault?
Yes, you can call the save function any time you want. Doing it at disconnect is normally done because it avoids redundant saves, plus it gives you the accurate last known data for the player.
How often does the average persons server crash? I ran one for years and it was very rare for me. If you have something that is causing a crash, address it. Don't let it be and work around the fact that you will get crashes. Quote:
|
| All times are GMT -4. The time now is 18:13. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.