絕影華
|
分享:
▼
x0
|
[1.6][插件] 關於等級插件存檔問題
我自創了一種等級插件
但set了自動存檔入到GAME殺了幾個人有一堆經驗
重開場後全部沒有幫我存檔
這等級有4種東西
new g_xp[33] // 玩家的經驗值 new g_level[33] // 玩家的等級 new g_kill[33] // 殺玩家次數 new g_damage[33] // 玩家的給予傷害累積
下面是sma檔入面關於save的文字...請大家幫忙有什麼問題
register_clcmd("say /save","client_disconnect") g_vault = nvault_open("LevelSystem2")
public client_disconnect(id) { SaveData(id) }
public client_putinserver(id) { LoadData(id) }
public SaveData(id) { new name[35], vaultkey[64], vaultdata[256]
get_user_name(id, name, 34)
format(vaultkey, 63, "%s-LevelInfo", name) format(vaultdata, 255, "%i#%i#%i#%i#", g_xp[id], g_level[id], g_damage[id], g_kill[id])
nvault_set(g_vault, vaultkey, vaultdata)
return PLUGIN_CONTINUE }
public LoadData(id) { new name[35], vaultkey[64], vaultdata[256]
get_user_name(id,name,34)
format(vaultkey, 63, "%s-LevelInfo", name) format(vaultdata, 255, "%i#%i#%i#%i#", g_xp[id], g_level[id], g_damage[id], g_kill[id])
nvault_get(g_vault, vaultkey, vaultdata, 255)
replace_all(vaultdata, 255, "#", " ")
new playerxp[32], playerlevel[32], playerdamage[32], playerkill[32] parse(vaultdata, playerxp, 31, playerlevel, 31, playerdamage, 31, playerkill, 31)
g_xp[id] = str_to_num(playerxp)
g_level[id] = str_to_num(playerlevel)
g_damage[id] = str_to_num(playerdamage)
g_kill[id] = str_to_num(playerkill)
return PLUGIN_CONTINUE }
|