Raised This Month: $12 Target: $400
 3% 

Save Money


Post New Thread Reply   
 
Thread Tools Display Modes
ChillerX
Member
Join Date: Dec 2022
Old 02-09-2023 , 20:40   Re: Save Money
Reply With Quote #11

Quote:
Originally Posted by thebest24 View Post
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)
}
ChillerX is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:48.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode