Just an example to save and load your weapon. I use fvault
PHP Code:
new const VAULT_NAME[] = "cs_weapon";
new gAwp[33];
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
}
public client_authorized(iIndex)
{
if (!is_user_hltv(iIndex) && !is_user_bot(iIndex)) LoadData(iIndex);
}
public client_disconnect(iIndex)
{
SaveData(iIndex);
}
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);
}
SaveData(iIndex)
{
new szAuthId[35];
get_user_authid(iIndex, szAuthId, sizeof(szAuthId));
new szWpnKey[33];
format(szWpnKey, sizeof szWpnKey, "%s_Wpn", szAuthId);
new szWpn[25];
num_to_str(gAwp[iIndex], szWpn, sizeof szWpn);
fvault_set_data(VAULT_NAME, szWpnKey, szWpn);
}
__________________