Thread: nVault Tutorial
View Single Post
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 09-22-2016 , 10:48   Re: nVault Tutorial
Reply With Quote #73

Quote:
Originally Posted by Craxor View Post
Yes, but if i will use you examples also for Saving data i willl need to call more times get_user_authid, i'm wrong?
I know about if i use just for taking data from nvault and is logic if i'm using only once ) what about retrieving?
EDIT: This is wrong as pointed out by Bugsy: That's the whole point. Compressing that long string into 1 cell which can be stored in exactly the same way. You don't have to convert it when saving or loading. get_user_authid() is called once for each player joining.
The saving is very much like your example. There's not much that can be done to optimize that.

Code:
I'm bad code, don't use me.

The CPU optimization is almost none.
The memory optimization is better but completely unimportant.
The database size however, much better.

Instead of saving this:

Code:
STEAM_0:X:XXX1 1234
STEAM_0:X:XXXXXX2 999
STEAM_0:X:XXXXX3 1
...
you're saving this:
Code:
1 1234
2 999
3 1
...
Quote:
Originally Posted by Craxor View Post
Btw: if a make something like: new szAuthid[32+1]; will change resize automatcly when new index is needed?
szAuthid[32+1] will become 33, and it will not resize automatically.
There are ways to changing the size of "static" arrays (not to be confused with dynamic arrays). But it's very complicated. It is almost never used.

Quote:
Originally Posted by Craxor View Post
Yeaaa, i have just 4 years of coding and i'm still beginner because i don't stay all the fucking day to understand codes, i have also lot of plans about my life but that's realy offtopic.
Everyone has stuff in their lives.
__________________

Last edited by Black Rose; 09-24-2016 at 11:53.
Black Rose is offline