Quote:
Originally Posted by extream87
DavidJr so i need to add more weapons here right?
Code:
LoadData(iIndex)
{
new szAuthId[35];
get_user_authid(iIndex, szAuthId, sizeof szAuthId);
new szWpnKey[33];
format(szWpnKey, sizeof szWpnKey, "%s_Wpn", szAuthId);
new szWpn[25];
fvault_get_data(VAULT_NAME, szWpnKey, szWpn, sizeof szWpn);
gAwp[iIndex] = str_to_num(szWpn);
gAk47[iIndex] = str_to_num(szWpn);
gM4A1[iIndex] = str_to_num(szWpn);
//More...
}
|
You either need to separate the keys or the values.
Example 1:
STEAM_ID_BLAH_AWP 1
STEAM_ID_BLAH_M4A1 4
STEAM_ID_BLAH_AK47 2
Example 2:
STEAM_ID_BLAH 1,4,2
The first example will create a larger vault but it will be more efficient while saving/loading single values.
The second example will also be harder to edit if you start adding or removing weapons. You are locked to that structure and you can't remove values even if they're not being used anymore.
Not sure which one is more efficient while loading all values. Probably the second one.
"_Wpn" suffix is completely useless and will only add to the native calls.
If you're only using the vault for true/false values you can make it a bitsum for up to 31 (or 32, I'm not sure) weapons in one value. You also can make it a "binary" string for several values. "100101", much like the second example.
Quote:
Originally Posted by extream87
I'm getting tag mismatch error:
Code:
new bool:g_HasuspP[33]
new purple_usp_vmodel[64] = "models/skinned/usp_purple/v_usp_purple.mdl"
LoadData(iIndex)
{
new szAuthId[35];
get_user_authid(iIndex, szAuthId, sizeof szAuthId);
new szWpnKey[33];
format(szWpnKey, sizeof szWpnKey, "%s_Wpn", szAuthId);
new szWpn[25];
fvault_get_data(VAULT_NAME, szWpnKey, szWpn, sizeof szWpn);
//here g_HasuspP[iIndex] = str_to_num(szWpn);
}
|
g_HasuspP is a boolean which only takes true/false.
Code:
g_HasuspP[iIndex] = str_to_num(szWpn) ? true : false;
__________________