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

Save Money


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   General Purpose       
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 04-14-2016 , 06:26   Save Money
Reply With Quote #1

< Save Money >

A very simple plugin that saves players' money for the current map only or forever.

Cvar:
  • sm_maponly <default: "1">
    • 0 = saves the money forever (if you had 8000$ on the previous map, you will start with that much on the next one)
    • 1 = saves money for the current map only (after retry, kick etc.)

Servers using this plugin

Although this is a very simple plugin and is probably used in many servers, I personally can't find a similar one submitted in AlliedMods, so I decided to make one and upload it here.
Attached Files
File Type: sma Get Plugin or Get Source (crx_savemoney.sma - 709 views - 1.3 KB)

Last edited by OciXCrom; 04-14-2016 at 10:05.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 04-14-2016 , 08:32   Re: Save Money
Reply With Quote #2

Good job, but have you prevented money load on server restart? (I mean sv_restart 1)

For example I have 8000 $ and I left server

While I'm not in server it happens server restart and after I'm joining I have 8000$ and others have 800 as default start money cvar value.
siriusmd99 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 04-14-2016 , 10:07   Re: Save Money
Reply With Quote #3

Hmm, hadn't thought about that. I updated the code and added a check to prevent that. Thank you for mentioning it.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
thebest24
Member
Join Date: Sep 2018
Location: Georgia
Old 02-03-2023 , 05:50   Re: Save Money
Reply With Quote #4

Quote:
Originally Posted by OciXCrom View Post
Hmm, hadn't thought about that. I updated the code and added a check to prevent that. Thank you for mentioning it.
it still doesnt work, at server restart it resetes to 800.
__________________
Hello!
thebest24 is offline
thebest24
Member
Join Date: Sep 2018
Location: Georgia
Old 02-04-2023 , 08:28   Re: Save Money
Reply With Quote #5

Quote:
Originally Posted by thebest24 View Post
it still doesnt work, at server restart it resetes to 800.
is there any way to fix it?
__________________
Hello!
thebest24 is offline
ChillerX
Member
Join Date: Dec 2022
Old 02-09-2023 , 20:40   Re: Save Money
Reply With Quote #6

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
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 04-14-2016 , 10:48   Re: Save Money
Reply With Quote #7

There are a lot of bank plugins, also this one is too simple. Unapproved, but if you want to add more features I can check it again.
__________________
HamletEagle is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 04-14-2016 , 19:54   Re: Save Money
Reply With Quote #8

@HamletEagle, what's your features for this plugin?
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 04-15-2016 , 09:15   Re: Save Money
Reply With Quote #9

Sorry, but I only managed to find this in the approved plugins section and it's very different from this one. Mine is a basic plugin that people should use if they want to prevent money loss due to kick, retry, internet problems etc, so it would be nice to have a simple plugin to do the job. I personally can't think of more options to add to it.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 04-15-2016 , 10:14   Re: Save Money
Reply With Quote #10

From rules:
Quote:
Do not post plugins "just for the sake of it". eg. A fulfilled request may have been useful for one or a few people, but that does not necessarily mean that it has a place in the Approved section. Please take the time to expand your knowledge and produce some quality work.
__________________
HamletEagle is offline
Reply



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 13:06.


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