Raised This Month: $119 Target: $400
 29% 

Money Manager v1.0


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Gameplay       
WATCH_DOGS UNITED
Junior Member
Join Date: Nov 2020
Location: United States
Old 11-17-2020 , 16:31   Money Manager v1.0
Reply With Quote #1

For Counter-Strike 1.6 and Condition-Zero.

Credits:
xPaw - set money
Bugsy - get players + command automation + Infinite money
Rqoua - get user team
SonicSonedit - round count
SnoW - bonus control
kketan77 - get roundend events
ConnorMcLeod - rewards per kill


Description:

This plugin allows you to control various functions related to in-game money.

Includes:

value obtained by killing enemies;

value obtained by killing enemies with headshot;

value obtained by killing teammates;

first round money (works normally when restarting rounds);

starting money for each round (does not interfere with the function of the first round);

bonus earned by each team on winning or losing the round (will be received in the same round completed);

Infinite money.


For each command (except reward per kill), you can choose which team will be affected.

You can use negative values, like -16000 in each function.


Commands (By default, all functions are disabled):

mm - will show all the functions available on the console.

mm_kill_money_enabled - activates the earn / kill functions below:

mm_killmoney - reward for killing enemies. Default value: 300

mm_killmoney_head - reward for killing enemies in the head. Default value: 300

mm_killmoney_team - reward for killing teammates. Default value: -3000

mm_bonus_enabled - activates the functions for bonus conditions below:

mm_bonus_win_t - bonus earned by terrorists for winning the round. Default value: 3000

mm_bonus_win_ct - bonus earned by counter-terrorists for winning the round. Default value: 3000

mm_bonus_lose_t - bonus earned by terrorists when they lose the round. Default value: 1000

mm_bonus_lose_ct - bonus earned by counter-terrorists when they lose the round. Default value: 1000

mm_first_round_enabled - activates money functions of the first round:

mm_first_round_t - first round money amount for terrorists. Default value: 800

mm_first_round_ct - first round money amount for counter-terrorists. Default value: 800

mm_every_round_enabled - activates money functions for each round:

mm_every_round_t - starting money for each round for terrorists. Default value: 16000

mm_every_round_ct - starting money for each round for counter-terrorists. Default value: 16000

mm_Infinite_enabled - activates the functions of Infinite money below (just type and press enter):

mm_Infinite - infinite money for both teams.

mm_Infinite_t - infinite money for terrorists only.

mm_Infinite_ct - infinite money for counter-terrorists only.

Notes:

You can use values between -1000000000 and 1000000000, however when killing enemies or buying if the value was in 1000000000 it will return to 16000, except for Infinite money.

Bonus values are obtained when completing the round.

A commandmenu has been created especially for the plugin, so you can use it more quickly and easily (PRESS "H"). See the photos below:










Software used:

Sublime Text v3.2

Code:

Code:
/*
	Money Manager - AMX Mod X script. Copyright  2020, WATCH_DOGS UNITED

	This plugin is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	If you do not know the terms of the GPLv3 you can consult
	it at <https://www.gnu.org/licenses/gpl-3.0.html>

	Credits:
	xPaw         - set money
	Bugsy        - get players + command automation + Infinite money
	Rqoua        - get user team
	SonicSonedit - round count
	SnoW         - bonus control
	kketan77     - get roundend events
	ConnorMcLeod - rewards per kill

	PRESS "MM" ON THE CONSOLE TO GET THE LIST OF COMMANDS.
*/
	#include <amxmisc>
	#include <cstrike>
	#include <fakemeta_util>
	#include <hamsandwich>

	#define Money_Amount 1
	#define IsPlayer(%1)	( 1 <= %1 <= g_iMaxPlayers )
	#define XTRA_OFS_PLAYER 5
	#define m_iAccount 115
	#define cs_set_money_value(%1,%2)	set_pdata_int(%1, m_iAccount, %2, XTRA_OFS_PLAYER)

	const MoneyAmount = 1000000;

	new bool:g_bmm_Infinite, bool:g_bmm_Infinite_t , bool:g_bmm_Infinite_ct

	new g_iMaxPlayers
	new g_pcvarMoneyControl
	new g_pcvarKillMoney
	new g_pcvarTkMoney
	new g_pcvarKillMoneyHs
	new g_iNewMoney
	new g_iMsgHookMoney
	new gmsgMoney
	new round_number = -1
	new g_pcvar_mm_Infinite
	new g_pcvar_mm_bonus
	new g_pcvar_mm_bonus_win_t
	new g_pcvar_mm_bonus_win_ct
	new g_pcvar_mm_bonus_lose_t
	new g_pcvar_mm_bonus_lose_ct
	new g_pcvar_mm_first_round
	new g_pcvar_mm_first_round_t;
	new g_pcvar_mm_first_round_ct;
	new g_pcvar_mm_every_round
	new g_pcvar_mm_every_round_t;
	new g_pcvar_mm_every_round_ct;

public plugin_init()
{
	register_plugin( "Money Manager" , "1.0" , "WATCH_DOGS UNITED" );

	register_event("DeathMsg", "Kill_Reward", "a")
	g_iMaxPlayers = get_maxplayers()
	gmsgMoney = get_user_msgid("Money")

	RegisterHam(Ham_Spawn, "player", "starting_money", 1);

	register_event("TextMsg", "event_game_restart", "a", "2=#Game_Commencing", "2=#Game_will_restart_in")
	register_event( "Money" , "Infinite_money" , "be" );

	register_logevent("bonus_t" , 6, "3=Terrorists_Win", "3=Target_Bombed")
	register_logevent("bonus_ct", 6, "3=CTs_Win", "3=All_Hostages_Rescued")

	g_pcvarMoneyControl = register_cvar("mm_kill_money_enabled", "1")
	g_pcvarKillMoney = register_cvar("mm_killmoney", "300")
	g_pcvarKillMoneyHs = register_cvar("mm_killmoney_head", "300")
	g_pcvarTkMoney = register_cvar("mm_killmoney_team", "-3000")
	g_pcvar_mm_bonus = register_cvar( "mm_bonus_enabled" , "0" );
	g_pcvar_mm_bonus_win_t = register_cvar( "mm_bonus_win_t" , "3000" );
	g_pcvar_mm_bonus_win_ct = register_cvar( "mm_bonus_win_ct" , "3000" );
	g_pcvar_mm_bonus_lose_t = register_cvar( "mm_bonus_lose_t" , "1000" );
	g_pcvar_mm_bonus_lose_ct = register_cvar( "mm_bonus_lose_ct" , "1000" );
	g_pcvar_mm_first_round = register_cvar( "mm_first_round_enabled" , "0" );
	g_pcvar_mm_first_round_t = register_cvar( "mm_first_round_t" , "800" );
	g_pcvar_mm_first_round_ct = register_cvar( "mm_first_round_ct" , "800" );
	g_pcvar_mm_every_round = register_cvar( "mm_every_round_enabled" , "0" );
	g_pcvar_mm_every_round_t = register_cvar( "mm_every_round_t" , "16000" );
	g_pcvar_mm_every_round_ct = register_cvar( "mm_every_round_ct" , "16000" );
	g_pcvar_mm_Infinite = register_cvar( "mm_Infinite_enabled" , "0" );
	register_concmd( "mm_Infinite" , "enable_mm_Infinite" );
	register_concmd( "mm_Infinite_t" , "enable_mm_Infinite_t" );
	register_concmd( "mm_Infinite_ct" , "enable_mm_Infinite_ct" );
	register_concmd( "mm", "show_cvars" );
}

public show_cvars(id)
{
	client_print(id, print_console, " " );
	client_print(id, print_console, "============== Money Manager - Command list: ==============" );
	client_print(id, print_console, " " );
	client_print(id, print_console, "mm_kill_money_enabled  -  activates the earn / kill functions below:" );
	client_print(id, print_console, " " );
	client_print(id, print_console, "mm_killmoney  -  reward for killing enemies" );
	client_print(id, print_console, "mm_killmoney_head  -  reward for killing enemies in the head" );
	client_print(id, print_console, "mm_killmoney_team  -  reward for killing teammates" );
	client_print(id, print_console, " " );
	client_print(id, print_console, "mm_bonus_enabled  -  activates the functions for bonus conditions below:" );
	client_print(id, print_console, " " );
	client_print(id, print_console, "mm_bonus_win_t  -  bonus earned by terrorists for winning the round" );
	client_print(id, print_console, "mm_bonus_win_ct  -  bonus earned by counter-terrorists for winning the round" );
	client_print(id, print_console, "mm_bonus_lose_t  -  bonus earned by terrorists when they lose the round" );
	client_print(id, print_console, "mm_bonus_lose_ct  -  bonus earned by counter-terrorists when they lose the round" );
	client_print(id, print_console, " " );
	client_print(id, print_console, "mm_first_round_enabled  -  activates money functions of the first round:" );
	client_print(id, print_console, " " );
	client_print(id, print_console, "mm_first_round_t  -  first round money amount for terrorists" );
	client_print(id, print_console, "mm_first_round_ct  -  first round money amount for counter-terrorists" );
	client_print(id, print_console, " " );
	client_print(id, print_console, "mm_every_round_enabled  -  activates money functions for each round:" );
	client_print(id, print_console, " " );
	client_print(id, print_console, "mm_every_round_t  -  starting money for each round for terrorists" );
	client_print(id, print_console, "mm_every_round_ct  -  starting money for each round for counter-terrorists" );
	client_print(id, print_console, " " );
	client_print(id, print_console, "mm_Infinite_enabled  -  activates the functions of infinite money:" );
	client_print(id, print_console, " " );
	client_print(id, print_console, "mm_Infinite  -  infinite money for both teams" );
	client_print(id, print_console, "mm_Infinite_t  -  infinite money for terrorists" );
	client_print(id, print_console, "mm_Infinite_ct  -  infinite money for counter-terrorists" );
	client_print(id, print_console, " " );
}

public enable_mm_Infinite()
{
	g_bmm_Infinite = true;
	g_bmm_Infinite_t = false;
	g_bmm_Infinite_ct = false;
}

public enable_mm_Infinite_t()
{
	g_bmm_Infinite = false;
	g_bmm_Infinite_t = true;
	g_bmm_Infinite_ct = false;
}

public enable_mm_Infinite_ct()
{
	g_bmm_Infinite = false;
	g_bmm_Infinite_t = false;
	g_bmm_Infinite_ct = true;
}

public starting_money( id )
{
	set_task( 0.0 , "money_every_round" );
	set_task( 0.0 , "money_first_round" );
}

public money_every_round()
{
	if ( !get_pcvar_num( g_pcvar_mm_every_round ) )
		return;

	new iPlayers[ 32 ] , iNum , iPlayer;
	 
	get_players( iPlayers , iNum , "a" );
	 
	for ( new i = 0 ; i < iNum ; i++ )
	{
		iPlayer = iPlayers[ i ];
		 
		new iMoney_every_round_t = clamp( get_pcvar_num( g_pcvar_mm_every_round_t ), -1000000000, 1000000000 );
		new iMoney_every_round_ct = clamp( get_pcvar_num( g_pcvar_mm_every_round_ct ), -1000000000, 1000000000 );

		if(get_user_team(iPlayer) == 1)
		{
			cs_set_user_money( iPlayer , iMoney_every_round_t );
		}
		if(get_user_team(iPlayer) == 2)
		{
			cs_set_user_money( iPlayer , iMoney_every_round_ct );
		}
	}
}

public bonus_t()
{
	if ( !get_pcvar_num( g_pcvar_mm_bonus ) )
		return;

	new iPlayers[ 32 ] , iNum , iPlayer;
	 
	get_players( iPlayers , iNum , "a" );
	 
	for ( new i = 0 ; i < iNum ; i++ )
	{
		iPlayer = iPlayers[ i ];
		 
		new bonus = cs_get_user_money(iPlayer);

		if(get_user_team(iPlayer) == 1)
		{
			cs_set_user_money( iPlayer , bonus + clamp( get_pcvar_num( g_pcvar_mm_bonus_win_t ), -1000000000, 1000000000 ) );
		}
		if(get_user_team(iPlayer) == 2)
		{
			cs_set_user_money( iPlayer , bonus + clamp( get_pcvar_num( g_pcvar_mm_bonus_lose_ct ), -1000000000, 1000000000 ) );
		}
	}
}

public bonus_ct()
{
	if ( !get_pcvar_num( g_pcvar_mm_bonus ) )
		return;

	new iPlayers[ 32 ] , iNum , iPlayer;
	 
	get_players( iPlayers , iNum , "a" );
	 
	for ( new i = 0 ; i < iNum ; i++ )
	{
		iPlayer = iPlayers[ i ];
		 
		new bonus = cs_get_user_money(iPlayer);

		if(get_user_team(iPlayer) == 2)
		{
			cs_set_user_money( iPlayer , bonus + clamp( get_pcvar_num( g_pcvar_mm_bonus_win_ct ), -1000000000, 1000000000 ) );
		}
		if(get_user_team(iPlayer) == 1)
		{
			cs_set_user_money( iPlayer , bonus + clamp( get_pcvar_num( g_pcvar_mm_bonus_lose_t ), -1000000000, 1000000000 ) );
		}
	}
}

public money_first_round()
{
	if ( !get_pcvar_num( g_pcvar_mm_first_round ) )
		return;

	round_number++

	new iPlayers[ 32 ] , iNum , iPlayer;
	 
	get_players( iPlayers , iNum , "a" );
	 
	for ( new i = 0 ; i < iNum ; i++ )
	{

		if(round_number< 2)
		{
		iPlayer = iPlayers[ i ];
		 
		new iMoney_first_round_t = clamp( get_pcvar_num( g_pcvar_mm_first_round_t ), -1000000000, 1000000000 );
		new iMoney_first_round_ct = clamp( get_pcvar_num( g_pcvar_mm_first_round_ct ), -1000000000, 1000000000 );

		if(get_user_team(iPlayer) == 1)
		{
			cs_set_user_money( iPlayer , iMoney_first_round_t );
		}
		if(get_user_team(iPlayer) == 2)
		{
			cs_set_user_money( iPlayer , iMoney_first_round_ct );
		}
		}
	}
}

public event_game_restart()
{
	round_number= 0
}

public Infinite_money( id )
{
	if ( !get_pcvar_num( g_pcvar_mm_Infinite ) )
		return;

	if ( g_bmm_Infinite )
	{

	if(get_user_team(id) == 1)
	{
	cs_set_user_money( id , MoneyAmount , 0 );
	}
	if(get_user_team(id) == 2)
	{
	cs_set_user_money( id , MoneyAmount , 0 );
	}
	}

	if ( g_bmm_Infinite_t )
	{

	if(get_user_team(id) == 1)
	{
	cs_set_user_money( id , MoneyAmount , 0 );
	}
	}

	if ( g_bmm_Infinite_ct )
	{

	if(get_user_team(id) == 2)
	{
	cs_set_user_money( id , MoneyAmount , 0 );
	}
	}
}

enum
{	
	DeathMsg_KillerID = 1, // byte
	DeathMsg_VictimID, // byte
	DeathMsg_IsHeadshot, // byte
	DeathMsg_TruncatedWeaponName // string
}

public Kill_Reward()
{
	if ( !get_pcvar_num( g_pcvarMoneyControl ) )
		return;

	new iKiller = read_data(DeathMsg_KillerID)
	if( IsPlayer(iKiller)&& is_user_connected(iKiller) )
	{
		new iVictim = read_data(DeathMsg_VictimID)
		if( iVictim != iKiller )
		{
				g_iNewMoney = clamp
								( 
									cs_get_user_money(iKiller)+ get_pcvar_num( cs_get_user_team(iVictim)== cs_get_user_team(iKiller)? g_pcvarTkMoney : (read_data(DeathMsg_IsHeadshot)? g_pcvarKillMoneyHs : g_pcvarKillMoney) ), 
									0
								)
				g_iMsgHookMoney = register_message(gmsgMoney, "Message_Money")
		}
	}
}

public Message_Money(iMsgId, iMsgDest, id)
{
	unregister_message(gmsgMoney, g_iMsgHookMoney)
	cs_set_money_value(id, g_iNewMoney)
	set_msg_arg_int(Money_Amount, ARG_LONG, g_iNewMoney)
}
Attached Files
File Type: sma Get Plugin or Get Source (money_manager.sma - 39 views - 11.0 KB)
File Type: zip optional_commandmenu.zip (2.6 KB, 17 views)
__________________
WATCH_DOGS UNITED is offline
Ark_Procession
Member
Join Date: Jun 2020
Location: Argentina
Old 11-20-2020 , 23:05   Re: Money Manager v1.0
Reply With Quote #2

Hi, when i try to use your mod after i kill a player, the game crashes, no log error.
Tested without any other plugins, without orpheu and without any additional modules and still crashes even if mm bonus is 0 in console.

Ok i really wanted it to work, reinstalled all cs from scratch, amx 1.8.2 , and added only your plugin but still crashes without any other modification.

Better check it out.
__________________
Feel free to ask for ENG to SPA Translations.

Last edited by Ark_Procession; 11-20-2020 at 23:34.
Ark_Procession is offline
WATCH_DOGS UNITED
Junior Member
Join Date: Nov 2020
Location: United States
Old 11-21-2020 , 08:06   Re: Money Manager v1.0
Reply With Quote #3

We cannot check this error because it does not occur here, but we will update the code and when we release the new version you can check and let us know if everything is right.
__________________
WATCH_DOGS UNITED is offline
Midnight Kid
Junior Member
Join Date: Aug 2017
Location: Chornobay, Ukraine
Old 11-21-2020 , 09:48   Re: Money Manager v1.0
Reply With Quote #4

Wow, there's another interesting thing for num values calculating pack (frags, deaths, assists, money etc.).
Thanks, I'm taking it.
Midnight Kid is offline
DruGzOG
Veteran Member
Join Date: Nov 2007
Location: Unknown
Old 11-22-2020 , 06:22   Re: Money Manager v1.0
Reply With Quote #5

Quote:
Originally Posted by Ark_Procession View Post
Hi, when i try to use your mod after i kill a player, the game crashes, no log error.
Tested without any other plugins, without orpheu and without any additional modules and still crashes even if mm bonus is 0 in console.

Ok i really wanted it to work, reinstalled all cs from scratch, amx 1.8.2 , and added only your plugin but still crashes without any other modification.

Better check it out.
Use the latest amxmodx.
__________________

Home of the AMX SUPER
Discord
DruGzOG is offline
Send a message via AIM to DruGzOG
Ark_Procession
Member
Join Date: Jun 2020
Location: Argentina
Old 11-22-2020 , 14:21   Re: Money Manager v1.0
Reply With Quote #6

that would be great wouldn't it?

but i'm using plugins that depend strictly on 1.8.2 and i'm no coder.
__________________
Feel free to ask for ENG to SPA Translations.
Ark_Procession is offline
WATCH_DOGS UNITED
Junior Member
Join Date: Nov 2020
Location: United States
Old 11-22-2020 , 18:48   Re: Money Manager v1.0
Reply With Quote #7

Quote:
Originally Posted by Ark_Procession View Post
that would be great wouldn't it?

but i'm using plugins that depend strictly on 1.8.2 and i'm no coder.

We are currently using AMX Mod X version 1.8.2 and it works normally. But we will update the code soon.
__________________

Last edited by WATCH_DOGS UNITED; 11-22-2020 at 18:52. Reason: version
WATCH_DOGS UNITED 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 13:44.


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