Game money: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
m (Substituted IO templates)
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{csgo point | game_money}}
{{this is a|point entity|game=Counter-Strike: Global Offensive|name=game_money}}


An entity that can add or deduct money from players or teams.
==Entity Description==
An entity that can add or deduct money from [[player]]s or teams.


== Keyvalues ==
== KeyValues ==
{{minititle|game_money}}
{{KV|Amount of money to add|int|intn=Money|Amount of money to add or deduct.}}
{{KV|Award Text|string|intn=AwardText|The text that will print in the chat next to the award amount. Will look like this: '+/-1000: <Award Text>'}}
{{KV Targetname}}
{{KV Targetname}}
{{ScrollBox|title=game_money|}}
{{KV|Amount of money to add|int|Amount of money to add or deduct.}}
{{note|Do not add '''+''' or '''-''' , to add or deduct money use inputs.}}
{{KV|Award Text|string|The text that will print in the chat next to the award amount. Will look like this: '+/-1000: <Award Text>'}}


== Inputs ==  
== Inputs ==  
{{ScrollBox|title=Base|}}
{{minititle|game_money}}
{{IO|FireUser1|to=FireUser4|Fire the <code>OnUser</code> outputs; see [[User Inputs and Outputs]].}}
{{I|SetMoneyAmount|param=int|Set the money value that will be awarded.
{{ScrollBox|title=game_money|}}
{{Bug|[[FGD]] doesn't let you input a value, use <code>[[AddOutput]] "Money <amount>"</code> instead or [[#FGD Code|fix the FGD]].}}
{{IO|SetMoneyAmount|Set the money value that will be awarded. (without awarding it)}}
}}
{{IO|AddTeamMoneyTerrorist|Add money to players on team TERRORIST.}}
{{I|AddTeamMoneyTerrorist|Award money to Terrorists.}}
{{IO|AddTeamMoneyCT|Add money to players on team COUNTER TERRORIST.}}
{{I|AddTeamMoneyCT|Award money to Counter-Terrorists.}}
{{IO|AddMoneyPlayer|Add money directly to the player activating this entity. (doesn't print in chat)}}
{{I|AddMoneyPlayer|Add money directly to the player activating this entity. (Doesn't print in chat)}}
{{IO|SpendMoneyFromPlayer|If the player has [money amount] or more, take [money amount] away.}}
{{I|SpendMoneyFromPlayer|param=int|If the player has [money amount] or more, take [money amount] away.}}
{{I Targetname}}


== Outputs ==  
== Outputs ==  
{{O BaseEntity}}
{{minititle|game_money}}
{{ScrollBox|title=game_money|}}
{{O|OnMoneySpent|Fires when input SpendMoneyFromPlayer succeeded.}}
{{IO|OnMoneySpent|Fires when input SpendMoneyFromPlayer succeeded.}}
{{O|OnMoneySpentFail|Fires when input SpendMoneyFromPlayer failed. (Player didn't have enough money)}}
{{IO|OnMoneySpentFail|Fires when input SpendMoneyFromPlayer failed. (Player didn't have enough money)}}
{{O Targetname}}
 
== FGD Code ==
This code belongs to <code>Counter-Strike Global Offensive/bin/[[csgo.fgd]]</code>.
<syntaxhighlight lang=cpp highlight=8>
@PointClass base(Targetname) iconsprite("editor/game_money.vmt") = game_money :
"An entity that awards money to a specific team."
[
Money(integer) : "Amount of money to add (+/-)" : 1000
AwardText(string) : "Award Text" : : "The text that will print in the chat next to the award amount.  Will look like this: '1000: <Award Text>'"
// Inputs
input SetMoneyAmount(integer) : "Set the money value that will be awarded. (without awarding it)" // changed type from 'void' to 'integer'
input AddTeamMoneyTerrorist(void) : "Add money to players on team TERRORIST."
input AddTeamMoneyCT(void) : "Add money to players on team COUNTER TERRORIST."
input AddMoneyPlayer(void) : "Add money directly to the player activating this entity. (no chat description)"
input SpendMoneyFromPlayer(void) : "If the player has [money amount] or more, take [money amount] away."
output OnMoneySpent(void) : "Fires when input SpendMoneyFromPlayer succeeded."
output OnMoneySpentFail(void) : "Fires when input SpendMoneyFromPlayer failed. (Player didn't have enough money)"
]
</syntaxhighlight>

Latest revision as of 07:55, 21 April 2025

game_money is a point entity available in Counter-Strike: Global Offensive Counter-Strike: Global Offensive.

Entity Description

An entity that can add or deduct money from players or teams.

KeyValues

game_money:

Amount of money to add (Money) <integer>
Amount of money to add or deduct.
Award Text (AwardText) <string>
The text that will print in the chat next to the award amount. Will look like this: '+/-1000: <Award Text>'
Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

Inputs

game_money:

SetMoneyAmount <integerRedirectInput/integer>
Set the money value that will be awarded.
Icon-Bug.pngBug:FGD doesn't let you input a value, use AddOutput "Money <amount>" instead or fix the FGD.  [todo tested in ?]
AddTeamMoneyTerrorist
Award money to Terrorists.
AddTeamMoneyCT
Award money to Counter-Terrorists.
AddMoneyPlayer
Add money directly to the player activating this entity. (Doesn't print in chat)
SpendMoneyFromPlayer <integerRedirectInput/integer>
If the player has [money amount] or more, take [money amount] away.


Outputs

game_money:

OnMoneySpent
Fires when input SpendMoneyFromPlayer succeeded.
OnMoneySpentFail
Fires when input SpendMoneyFromPlayer failed. (Player didn't have enough money)


FGD Code

This code belongs to Counter-Strike Global Offensive/bin/csgo.fgd.

@PointClass base(Targetname) iconsprite("editor/game_money.vmt") = game_money : 
	"An entity that awards money to a specific team." 
[
	Money(integer)		: "Amount of money to add (+/-)" : 1000
	AwardText(string)	: "Award Text" : : "The text that will print in the chat next to the award amount.  Will look like this:	'1000: <Award Text>'"
	
	// Inputs
	input SetMoneyAmount(integer) : "Set the money value that will be awarded. (without awarding it)" // changed type from 'void' to 'integer'
	input AddTeamMoneyTerrorist(void) : "Add money to players on team TERRORIST."
	input AddTeamMoneyCT(void) : "Add money to players on team COUNTER TERRORIST."
	input AddMoneyPlayer(void) : "Add money directly to the player activating this entity. (no chat description)"
	input SpendMoneyFromPlayer(void) : "If the player has [money amount] or more, take [money amount] away."
	
	output OnMoneySpent(void) : "Fires when input SpendMoneyFromPlayer succeeded."
	output OnMoneySpentFail(void) : "Fires when input SpendMoneyFromPlayer failed. (Player didn't have enough money)"
]