Good morning every one, I try to search in forum but can't find answer, so i creat this topic to ask. This is my question:
1. I made some thing, and when player unlock this, he have this, and when disconnect then connect again , it's not lost. Lost when change map --> DONE
Exp:
Quote:
Unlock ak47 - 4000$ --> Player have unlock_ak47[id] = true --> until change map , he have ak47 free. When disconnect then connect again , unlock_ak47[id] = true, do not lost.
2. But some time, 1 player A disconnect and his [id] like player B connect, player B have unlock_ak47[id] = true , and he don't need unlock with 4000$.
3. So i want to make some thing can save unlock_ak47[id] = true to player's ip or name and reset unlock_ak47[id] = false when map change or shutdown server. I try to find, maybe can save by nvault, but i don't know how to save this, please show me way to save this to nvault or something like this. Very thanks bros of alliedmods.:)
Blizzard_87
11-03-2013 01:50
Re: How to save something when player disconnect?
Please show your code. Then you can use nvault to save load the unlocks
public zp_extra_item_unlocked(player, itemid) { if ( itemid == g_itemid ) { if ( user_has_weapon(player, CSW_AK47) ) { drop_prim(player) }
give_item(player, "weapon_ak47") cs_set_user_bpammo(player, CSW_AK47, WPN_BPAMMO) client_print(player, print_chat, "[ZP] You unlock cv47") g_Hasak47[player] = true; //How to save this to nvault? and reset when change map, restart server? } }
stock drop_prim(id) { new weapons[32], num get_user_weapons(id, weapons, num) for (new i = 0; i < num; i++) { if (Wep_ak47 & (1<<weapons[i])) { static wname[32] get_weaponname(weapons[i], wname, sizeof wname - 1) engclient_cmd(id, "drop", wname) } } }
And i have more question:
-ID of 1 player can like 1 another player, so can i change id -> name or ip or steam id , don't need use nvault?