View Single Post
aEEk
Member
Join Date: May 2012
Location: Romania
Old 05-29-2020 , 16:19   Re: [INC] nVault Array
Reply With Quote #11

Quote:
Originally Posted by Bugsy View Post
I guess, but it looks sloppy being inconsistent.


I think you did the complete opposite. It's much more uniform to have an enumerator define all of your constants instead of having multiple arrays floating around in your code, and indexed inconsistently var[id][i] and var[i][id]. It's easy to mess something up with code like this since you may forget how you are indexing an array and may assign a value with var[id][i] when you declared the array for var[i][id] use.

It looks like you are saving a ton of data for each player and this can likely be reduced. Can you explain what this is for?

PHP Code:
// LOAD STATTRAK SKINS to USER ID
formatex(szKeycharsmax(szKey), "%s-STTK"auth);

if(
nvault_get_array(vault_stattrak_idszKeyuserSTATTRAK[id][ePlayerStattrak:0], sizeof(userSTATTRAK[])))
{        
    for(new 
1100i++)
    {
        
stattrak[i][id]     = userSTATTRAK[id][pdStatTrak][i];
        
kill[i][id]         = userSTATTRAK[id][pdStatTrakKills][i];
    }

I store data like this:
1. level, xp, money, cases and keys.
2. skins that player owns.
3. stattrak skins that player owns + kills of that stattrak.
4. skins that player have in use.


I have changed all my declarations to be var[id][i] and I have checked every line of code and everything looks fine, data is saving for all players. The problem is because I guess beeing a ton of data saved, when there are more than 10 players for example on server and change map, the data is missing for some players, not for all, maybe data is exceeded or idk...
Anyway, I will try to save with SQL, maybe you can give me an example or I will find some tut regarding this kind of save.

Last edited by aEEk; 05-29-2020 at 16:22.
aEEk is offline
Send a message via Yahoo to aEEk Send a message via Skype™ to aEEk