func_buyzone
Jump to navigation
Jump to search
| CBuyZone |
This is a preserved entity.
If the game has round restart mechanics this entity may not behave as expected.
If the game has round restart mechanics this entity may not behave as expected.
func_buyzone is a trigger entity available in ![]()
Counter-Strike series.
It is used to define areas where players of different teams can use the buy and buymenu commands, i. e. open the buy menu to purchase weapons and equipment.
If a player touches the volume of this entity and their team equals the team of this entity, then they are allowed to buy.
The SetTeam input can be used to change the buying team in-game.
This entity can also use the team values 0 or -1, such that any or no player can buy inside this entity's volume, respectively.
Disableing it both have the same effect, just that these two operations are independent. A player is only allowed to buy if both this entity is enabled and if its team value matches. Keyvalues
- Name (targetname) <string>
-
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g.
parentnameortarget).
Also displayed in Hammer's 2D views and Entity Report.See also: Generic Keyvalues, Inputs and Outputs available to all entities
-1 No one (!FGD in
)
0 (only in
) Everyone
2 Terrorists 3 Counter-Terrorists other No one
-
Legacy team number (team) <integer choices>!FGD
-
Deprecated; exists for backwards compatibility.
Takes priority over TeamNum if set to 1 or 2.
1 Terrorists 2 Counter-Terrorists
|
Inputs
- SetTeam <integer choices>
- Sets the team of this entity, which also sets the team that is allowed to buy.
- SetTeam_TerroristOnly (in all games since
) - Restrict buyzone to Terrorists only. Equivalent to
SetTeam 2. - SetTeam_CTOnly (in all games since
) - Restrict buyzone to Counter-Terrorists only. Equivalent to
SetTeam 3. - SetTeam_AllTeams (in all games since
) - Allows all teams to use the buyzone. Equivalent to
SetTeam 0. - SetTeam_None (in all games since
) - Allows no team to use the buyzone, effectively disabling it. Equivalent to
SetTeam -1. team <integer choices>!FGD
- Exists as due to the
teamKV being defined using DEFINE_INPUT() instead of DEFINE_KEYFIELD().
Sets the team KV to the specified value. Since the KV is only analyzed during spawn, this input is useless; useSetTeaminstead.
|
Outputs
|
FGD Code
This code...
- replaces its base class with Trigger which effectively adds trigger properties such as the keyvalue StartDisabled, the inputs and outputs Enable/Disable/Toggle/OnStartTouch/... and the trigger flags (1: Clients, ...).
- adds the input TouchTest and the outputs OnTouching/OnNotTouching as seen in trigger_multiple of base.fgd.
- removes the invalid inputs SetEnabled, SetDisabled.
Replace the entry in cstrike.fgd or csgo.fgd for func_buyzone with this.
@SolidClass base(Trigger, TeamNum) = func_buyzone: // "Targetname" -> "Trigger" so we inherit "OnStartTouch" etc.
"Buy Zone. Players can buy equipment while standing in this zone, if the zone matches their current team.\n\n" +
"A single Buy Zone entity must be either terrorist or counter-terrorist, it cannot be both. Should have " +
"the toolstrigger material applied to all sides"
[
// input SetEnabled(void) : "Sets this buyzone as enabled."
// input SetDisabled(void) : "Sets this buyzone as disabled."
team(choices) : "Legacy Team Number (deprecated)" : "" : "Takes priority over TeamNum if present. Used for GoldSrc backwards compatibility." =
[
"" : "Use TeamNum"
1 : "Terrorist"
2 : "Counter-terrorist"
]
// not in CS:S!
input SetTeam_TerroristOnly(void) : "Make it so only terrorist can buy from this buyzone."
input SetTeam_CTOnly(void) : "Make it so only CT's can buy from this buyzone."
input SetTeam_AllTeams(void) : "Make it so all teams can buy from this buyzone."
input SetTeam_None(void) : "Make it so no teams can buy from this buyzone (this essentially disables the buyzone)."
input TouchTest(void) : "Tests if the trigger is being touched and fires an output based on whether the value is true or false."
output OnTouching(void) : "Fired when the TestTouch input is true (something is touching the trigger.)"
output OnNotTouching(void) : "Fired when the TestTouch input is not true (nothing is touching the trigger.)"
]