Short: you have to save selected model by its index. Then if player reconnects, you just get his authid, then nvault_lookup() for saved index and set knife depending on index
look at this as at reference, adjust for yourself
PHP Code:
enum Knives
{
NoKnifeSet = 0, // first entry should be the default knife
...
}
new const g_ModelData[Knives][KnifeModels] = { ... } // first entry should be the default knife
save_to_vault(player)
{
new tempKey[...], tempValue[...]
get_user_authid(player, tempKey, charsmax(tempKey)) // or u can use formatex() instead of this if u have authid saved somewhere else in your plugin
formatex(tempValue, charsmax(tempValue), "%i", g_selectedKnifeId[player])
nvault_set(g_vault, tempKey, tempValue)
}
get_from_vault(player)
{
new tempKey[...], tempValue[...], timestamp
get_user_authid(player, tempKey, charsmax(tempKey))
new found = nvault_lookup(g_vault, tempKey, tempValue, charsmax(tempValue), timestamp)
if(found)
{
new iKnife = str_to_num(tempValue)
setKnifeById(player, iKnife) // use here your function for knife change
}
else
{
setKnifeById(player, 0) // if player's authid was not found then guve him defaut knife
}
}
__________________