I don't know how to use nVault, or any kind of vault for that matter. There is also a problem with my ScoreInfo event, because NONE of the client_print's get executed, and at least the ScoreInfo one should.
I tried client_putinserver, and it may no change. client_authorized should not be any different.
EDIT: I got the client_print for the ScoreInfo function to show up, but the other two on LoadXP and SaveXP do not show.
Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <vault>
new score[33]
new deaths[33]
new currentscore[33]
new currentdeaths[33]
//new g_scoreinfo
public plugin_init()
{
register_plugin("Kill/Death Records", "1.0", "fluffy")
register_concmd("say saveme", "SaveXP")
//g_scoreinfo = get_user_msgid("ScoreInfo")
register_event("ScoreInfo", "ScoreInfo", "a")
}
public SaveXP(id)
{
new authid[32];
get_user_authid(id,authid,31);
new vaultkey[64], vaultdata[64];
format(vaultkey,63,"score-%s",authid)
format(vaultdata,63,"%i",currentscore[id])
set_vaultdata(vaultkey,vaultdata)
format(vaultkey,63,"deaths-%s",authid)
format(vaultdata,63,"%i",currentdeaths[id])
set_vaultdata(vaultkey,vaultdata)
}
public LoadXP(id)
{
new authid[32];
get_user_authid(id,authid,31);
new vaultkey[64], vaultdata[64];
format(vaultkey,63,"score-%s",authid)
get_vaultdata(vaultkey,vaultdata,63)
score[id] = str_to_num(vaultdata)
format(vaultkey,63,"deaths-%s",authid)
get_vaultdata(vaultkey,vaultdata,63)
deaths[id] = str_to_num(vaultdata)
}
public client_putinserver(id)
{
client_print(id, print_console, "Kill/Death Loaded.")
LoadXP(id)
}
public client_disconnect(id)
{
client_print(id, print_console, "Kill/Death Saved.")
SaveXP(id)
}
public ScoreInfo()
{
new playerid, playerscore, playerdeaths, data4, data5
playerid = read_data(1)
if(is_user_bot(playerid))
{
return PLUGIN_HANDLED
}
client_print(playerid, print_chat, "ScoreInfo function called.")
playerscore = read_data(2)
playerdeaths = read_data(3)
data4 = read_data(4)
data5 = read_data(5)
format(currentscore[playerid], 32, "%i", playerscore + score[playerid])
format(currentdeaths[playerid],32, "%i", playerdeaths + deaths[playerid])
message_begin(MSG_ALL, 83, {0,0,0}, playerid)
//message_begin(MSG_ALL, g_scoreinfo, {0,0,0}, playerid)
write_byte(playerid)
write_short(playerscore)
write_short(playerdeaths)
write_short(data4)
write_short(data5)
message_end()
return PLUGIN_CONTINUE
}