Raised This Month: $ Target: $400

[Sketch] CSO Like Money System Prototype

Post New Thread Reply   
Thread Tools Display Modes
Author Message
Senior Member
Join Date: May 2020
Old 09-21-2022 , 11:38   [Sketch] CSO Like Money System Prototype
Reply With Quote #1

A reapi approach for a money system like in cso which was pretty popular back then.

#include <amxmodx>
#include <reapi>

#define MONEY_MULHEAD 1.0
#define MONEY_MULLEG 0.75
#define MONEY_MULARM 0.75
#define MONEY_MULCHEST 0.65

#define MONEY_KILL 500
#define MONEY_HIT 2

#define MONEY_START 2000

#define MONEY_MULVIC 0.65

public plugin_init()
	register_plugin("Money", "-", "-")

	for(new RewardRules:i = RR_CTS_WIN; i < RR_END+RewardRules:1; i++)
		rg_set_account_rules(i, 0)

	RegisterHookChain(RG_CBasePlayer_Killed, "ReHook_Killed", 1)
	RegisterHookChain(RG_CBasePlayer_TakeDamage, "ReHook_TakeDamage_Post", 1)
        RegisterHookChain(RG_CBasePlayer_AddAccount, "ReHook_AddAccount_Pre")

public ReHook_TakeDamage_Post(iVictim, iInflictor, iAttacker, Float:flDamage, dmgBits)
	if(iVictim == iAttacker)
		return HC_CONTINUE;

	if(get_user_team(iVictim) == get_user_team(iAttacker))
		return HC_CONTINUE;

		return HC_CONTINUE;

	if(!(0 < iAttacker < 33) || !(0 < iVictim < 33))
		return HC_CONTINUE;

	new addMoney = floatround(flDamage*MONEY_HIT)

	switch(get_member(iVictim, m_LastHitGroup))
		case HIT_STOMACH: addMoney = floatround(addMoney*MONEY_MULSTOMACH)
		case HIT_CHEST: addMoney = floatround(addMoney*MONEY_MULCHEST)
		case HIT_LEFTLEG, HIT_RIGHTLEG: addMoney = floatround(addMoney*MONEY_MULLEG)
		case HIT_LEFTARM, HIT_RIGHTARM: addMoney = floatround(addMoney*MONEY_MULARM)
		case HIT_HEAD: addMoney = floatround(addMoney*MONEY_MULHEAD)

	rg_add_account(iAttacker, addMoney, AS_ADD)
	rg_add_account(iVictim, floatround(addMoney*MONEY_MULVIC), AS_ADD)

	return HC_CONTINUE;

public ReHook_Killed(iId, iAttacker)
	rg_add_account(iAttacker, MONEY_KILL, AS_ADD)

public ReHook_AddAccount_Pre(id, amount, RewardType:type, bool:bTrackChange)
	if(type == RT_NONE)
		return HC_CONTINUE;


GetMoney(iId) return get_member(iId, m_iLastAccount)
SetMoney(iId, amount) rg_add_account(iId, amount, AS_SET)
AddMoney(iId, amount) rg_add_account(iId, amount)

Last edited by AnimalMonster; 09-23-2022 at 11:12.
AnimalMonster is offline
Senior Member
Join Date: May 2021
Old 01-15-2023 , 16:21   Re: [Sketch] CSO Like Money System Prototype
Reply With Quote #2

Originally Posted by AnimalMonster View Post
A reapi approach for a money system like in cso which was pretty popular back then.
Yes, that's correct. The plugin uses the REAPI (ReGameDLL API) to create a money system for the game, similar to the one used in the popular CSO (Counter-Strike Online) mod. The REAPI is a set of functions and macros that extend the capabilities of AMX Mod X and can be used to create custom game modes, manage player rewards, and perform other tasks. The plugin uses the REAPI functions to register hooks, set rules for rewards, and manage player money.
No Steam = No Support.
McTavish is offline

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:16.

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