I need help changing a plugin that uses nvault save to make it use mysql save.
I have no knowledge what so ever of how to code with mysql saving, so I need you you to make the code for me. If you need any more information from the plugin to be able to do this, please tell me.
Here is the code for saving/loading.
PHP Code:
public client_disconnect(id)
{
TotalPlayedTime[id] = TotalPlayedTime[id] + (get_user_time(id));
SaveTime(id, TotalPlayedTime[id]);
}
public client_putinserver(id)
{
TotalPlayedTime[id] = LoadTime(id);
}
public LoadTime( id )
{
new valut = nvault_open("Time_played_0.4")
new authid[33];
new vaultkey[64], vaultdata[64];
get_user_authid(id, authid[id],31);
format(vaultkey, 63, "TIMEPLAYED%s", authid[id]);
nvault_get(valut, vaultkey, vaultdata, 63);
nvault_close(valut);
return str_to_num(vaultdata);
}
public SaveTime(id,PlayedTime)
{
new valut = nvault_open("Time_played_0.4")
if(valut == INVALID_HANDLE)
set_fail_state("nValut returned invalid handle")
new authid[33];
new vaultkey[64], vaultdata[64];
get_user_authid(id, authid[id],31);
format(vaultkey, 63, "TIMEPLAYED%s", authid[id]);
format(vaultdata, 63, "%d", PlayedTime);
nvault_set(valut, vaultkey, vaultdata);
nvault_close(valut);
}
public prune()
{
new valut = nvault_open("Time_played_0.4");
if(valut == INVALID_HANDLE)
set_fail_state("nValut returned invalid handle");
nvault_prune(valut, 0, get_systime() - PRUNE_TIME);
nvault_close(valut);
}
public plugin_end()
{
prune()
}
Thank you so much in advance if anyone would help me!