Quote:
Originally Posted by thebest24
is there any way to fix it?
|
You can try this until someone experienced shows up to edit it (not tested)
Code:
#include <amxmodx>
#include <cstrike>
#include <fvault>
#define PLUGIN_VERSION "1.1"
new const g_szVault[] = "PlayerMoney"
new g_cvMapOnly
public plugin_init()
{
register_plugin("Save Money", PLUGIN_VERSION, "OciXCrom")
register_cvar("SaveMoney", PLUGIN_VERSION, FCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)
register_logevent("eventRoundRestart", 2, "0=World triggered")
g_cvMapOnly = register_cvar("sm_maponly", "1")
}
public client_putinserver(id)
LoadData(id)
public client_disconnected(id)
SaveData(id)
SaveData(id)
{
new szAuthId[32], szMoney[10]
get_user_authid(id, szAuthId, charsmax(szAuthId))
num_to_str(cs_get_user_money(id), szMoney, charsmax(szMoney))
fvault_set_data(g_szVault, szAuthId, szMoney)
}
LoadData(id)
{
new szAuthId[32], szData[10]
get_user_authid(id, szAuthId, charsmax(szAuthId))
if(fvault_get_data(g_szVault, szAuthId, szData, charsmax(szData)))
cs_set_user_money(id, str_to_num(szData))
}
public plugin_end()
{
if(get_pcvar_num(g_cvMapOnly))
fvault_clear(g_szVault)
}