Raised This Month: $ Target: $400
 0% 

[HELP] Save Model Permanent


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 03-19-2014 , 14:04   Re: [HELP] Save Model Permanent
Reply With Quote #4

Quote:
Originally Posted by extream87 View Post
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 View Post
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;
__________________

Last edited by Black Rose; 03-19-2014 at 14:15.
Black Rose is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:54.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode