下面是引用 tw2twtw 於 2011-12-11 08:38 發表的 :
複製程式
public plugin_natives()
{
register_native("set_user_point", "native_set_point", 1)
}
//執行
public native_set_point(id, amount)
{
// 設定點數
point[id] = amount
//要不要回傳都隨便...
return point[id]
}
然後inc打
native set_user_point(id, amount)
行了..謝謝大大喔:)
另外
我儲存資料和載入資料有點問題
public SaveData(id)
{
new name[32], vaultkey[64], vaultdata[256]
get_user_name(id, name, 31)
format(vaultkey, 63, "%s", name)
format(vaultdata, 255, "%i#%i#%i#", g_pret[id], g_ak4760r[id], g_ncpts[id])
nvault_set(g_vault, vaultkey, vaultdata)
client_print(id, print_chat, "保存記錄成功")
}
public LoadData(id)
{
new name[32], vaultkey[64], vaultdata[256]
get_user_name(id,name,31)
format(vaultkey, 63, "%s", name)
format(vaultdata, 255, "%i#%i#%i#", g_pret[id], g_ak4760r[id], g_ncpts[id])
nvault_get(g_vault, vaultkey, vaultdata, 255)
replace_all(vaultdata, 255, "#", " ")
new pret[32], ak4760r[32], ncpts[32]
parse(vaultdata, pret, 31, ak4760r, 31, ncpts, 31)
g_pret[id] = str_to_num(pret)
g_ak4760r[id] = str_to_num(ak4760r)
g_ncpts[id] = str_to_num(ncpts)
return PLUGIN_CONTINUE
}
有什麼問題呢?