Jabroni Brawl: Episode 3/Script Functions: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Updated signatures of some methods to match current game functions)
m (Nesciuse moved page Jabroni Brawl: Episode 3/Script Functions/en to Jabroni Brawl: Episode 3/Script Functions without leaving a redirect: Move en subpage to basepage)
 
(11 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{lang|List of Jabroni Brawl: Episode 3 Script Functions}}
{{LanguageBar}}
{{toc-right}}
{{sq}}{{lua}} {{jbep3|2}}'s implementation of [[VScript]] is built on {{csgo|2}}'s. This list only contains classes, functions and variables that differ from {{csgo|1|nt=1}}'s implementation.


{{toc-right}}
''Please note this article is written with {{sq|2}} in mind.''
 
{{sq}}{{lua}} {{game link|Jabroni Brawl: Episode 3}}'s implementation of [[VScript]] is built on {{game link|Counter-Strike: Global Offensive}}'s. This list only contains classes, functions and variables that differ from CSGO's implementation.
 
 
''Please note this article is written with {{sq}}[[Squirrel]] in mind.''


== Constants ==
== Constants ==
{| class="standard-table" style="width: 85%;"
{| class="standard-table" style="width: 80%;"
!Instance
!Instance
!Type
!Type
Line 15: Line 12:
!Description
!Description
|-
|-
|<code>EJBGameMode</code>
|{{Code|EJBGameMode}}
|table
|table
|<div class="mw-collapsible mw-collapsed"><syntaxhighlight lang=js>
|<div class="mw-collapsible mw-collapsed"><syntaxhighlight lang=js>
Line 45: Line 42:
|The gamemode of the match.
|The gamemode of the match.
|-
|-
|<code>ERoundState</code>
|{{Code|ERoundState}}
|table
|table
|<div class="mw-collapsible mw-collapsed"><syntaxhighlight lang=js>
|<div class="mw-collapsible mw-collapsed"><syntaxhighlight lang=js>
Line 62: Line 59:
|State of the round.
|State of the round.
|-
|-
|<code>EJBRoundMutator</code>
|{{Code|EJBRoundMutator}}
|table
|table
|<div class="mw-collapsible mw-collapsed"><syntaxhighlight lang=js>
|<div class="mw-collapsible mw-collapsed"><syntaxhighlight lang=js>
Line 109: Line 106:
|Mutator of the round. This only exists when Battle Royale is the current gamemode.
|Mutator of the round. This only exists when Battle Royale is the current gamemode.
|-
|-
|<code>ELifeState</code>
|{{Code|ELifeState}}
|table
|table
|<div class="mw-collapsible mw-collapsed"><syntaxhighlight lang=js>
|<div class="mw-collapsible mw-collapsed"><syntaxhighlight lang=js>
Line 119: Line 116:
|State of an entity's lifespan.
|State of an entity's lifespan.
|-
|-
|<code>EJBCharacterCond</code>
|{{Code|EJBCharacterCond}}
|table
|table
|<div class="mw-collapsible mw-collapsed"><syntaxhighlight lang=js>
|<div class="mw-collapsible mw-collapsed"><syntaxhighlight lang=js>
Line 184: Line 181:
|Special conditions for players.
|Special conditions for players.
|-
|-
|<code>EJBWeaponCond</code>
|{{Code|EJBWeaponCond}}
|table
|table
|<div class="mw-collapsible mw-collapsed"><syntaxhighlight lang=js>
|<div class="mw-collapsible mw-collapsed"><syntaxhighlight lang=js>
Line 198: Line 195:
|Special conditions for weapons.
|Special conditions for weapons.
|-
|-
|<code>EJBPossessType<code>
|{{Code|EJBPossessType}}
|table
|table
|<div class="mw-collapsible mw-collapsed"><syntaxhighlight lang=js>
|<div class="mw-collapsible mw-collapsed"><syntaxhighlight lang=js>
Line 216: Line 213:


==== Methods ====
==== Methods ====
{| class="standard-table" style="width: 85%;"
{| class="standard-table" style="width: 80%;"
! Function
! Function
! Signature
! Signature
! Description
! Description
|-
|-
| <code>GetLifeState</code>
| {{Code|GetLifeState}}
| <code>int GetLifeState()</code>
| {{Code|int GetLifeState()}}
| Returns the current life state of the entity.
| Returns the current life state of the entity.
|-
|-
| <code>SetName</code>
| {{Code|SetName}}
| <code>void SetName(string ''name'')</code>
| {{Code|void SetName(string ''name'')}}
| Sets the target name of the entity.
| Sets the target name of the entity.
|-
|-
| <code>SetParent</code>
| {{Code|SetParent}}
| <code>void SetParent(handle ''parent'')</code>
| {{Code|void SetParent(handle ''parent'')}}
| Sets the parent of the entity.
| Sets the parent of the entity.
|-
|-
| <code>SetParentAttachment</code>
| {{Code|SetParentAttachment}}
| <code>void SetParentAttachment(handle ''parent'', int ''index'')</code>
| {{Code|void SetParentAttachment(handle ''parent'', int ''index'')}}
| Sets the parent of the entity, as well as the attachment point (by index).
| Sets the parent of the entity, as well as the attachment point (by index).
|-
|-
| <code>Bonemerge</code>
| {{Code|Bonemerge}}
| <code>void Bonemerge(handle ''target'')</code>
| {{Code|void Bonemerge(handle ''target'')}}
| Starts following an entity via bonemerge.
| Starts following an entity via bonemerge.
|-
|-
Line 244: Line 241:


=== CEntities ===
=== CEntities ===
A client-side version of <code>Entities</code> now exists, with the following methods: <code>First</code>, <code>Next</code>, <code>FindByClassname</code>, and <code>GetByIndex</code>.
A client-side version of <code>Entities</code> now exists, with the following methods: <code>First</code>, <code>Next</code>, <code>FindByClassname</code>, and <code>GetByIndex</code>.


Line 253: Line 249:
! Description
! Description
|-
|-
| <code>Create</code>
| {{Code|Create}}
| <code>handle Create(string ''classname'', table ''keyvalues'')</code>
| {{Code|handle Create(string ''classname'', table ''keyvalues'')}}
| Creates and spawns an entity by classname, with the keyvalues from the given table.
| Creates and spawns an entity by classname, with the keyvalues from the given table.
|-
|-
| <code>CreateNoSpawn</code>
| {{Code|CreateNoSpawn}}
| <code>handle CreateNoSpawn(string ''classname'', table ''keyvalues'')</code>
| {{Code|handle CreateNoSpawn(string ''classname'', table ''keyvalues'')}}
| Creates an entity by classname without spawning it, with the keyvalues from the given table.
| Creates an entity by classname without spawning it, with the keyvalues from the given table.
|-
|-
| <code>GetByIndex</code>
| {{Code|GetByIndex}}
| <code>handle GetByIndex(int ''index'')</code>
| {{Code|handle GetByIndex(int ''index'')}}
| Gets the entity at the given index.
| Gets the entity at the given index.
|-
|-
Line 268: Line 264:


=== CBasePlayer ===
=== CBasePlayer ===


==== Methods ====
==== Methods ====
Line 277: Line 271:
! Description
! Description
|-
|-
| <code>GetUserID</code>
| {{Code|GetUserID}}
| <code>int GetUserID()</code>
| {{Code|int GetUserID()}}
| Returns player's user ID.
| Returns player's user ID.
|-
|-
| <code>GetNetworkIDString</code>
| {{Code|GetNetworkIDString}}
| <code>string GetNetworkIDString()</code>
| {{Code|string GetNetworkIDString()}}
| Returns player's Steam ID as a string.
| Returns player's Steam ID as a string.
|-
|-
| <code>GetAccountID</code>
| {{Code|GetAccountID}}
| <code>int GetAccountID()</code>
| {{Code|int GetAccountID()}}
| Returns player's account ID.
| Returns player's account ID.
|-
|-
| <code>GetPlayerName</code>
| {{Code|GetPlayerName}}
| <code>string GetPlayerName()</code>
| {{Code|string GetPlayerName()}}
| Returns player's network name.
| Returns player's network name.
|-
|-
| <code>IsFakeClient</code>
| {{Code|IsFakeClient}}
| <code>bool IsFakeClient()</code>
| {{Code|bool IsFakeClient()}}
| Returns true if this is a fake client.
| Returns true if this is a fake client.
|-
|-
Line 300: Line 294:


=== CPlayerVoiceListener ===
=== CPlayerVoiceListener ===
In JBEP3, the <code>PlayerVoiceListener</code> instance has been implemented.
In JBEP3, the <code>PlayerVoiceListener</code> instance has been implemented.


=== CJBBaseWeapon ===
=== CJBBaseWeapon ===


==== Methods ====
==== Methods ====
Line 313: Line 304:
! Description
! Description
|-
|-
| <code>AddCondition</code>
| {{Code|AddCondition}}
| <code>void HasCondition(int ''condition'')</code>
| {{Code|void HasCondition(int ''condition'')}}
| Adds the given condition to the weapon.
| Adds the given condition to the weapon.
|-
|-
| <code>HasCondition</code>
| {{Code|HasCondition}}
| <code>bool HasCondition(int ''condition'')</code>
| {{Code|bool HasCondition(int ''condition'')}}
| Returns true if the weapon has the given condition.
| Returns true if the weapon has the given condition.
|-
|-
| <code>RemoveCondition</code>
| {{Code|RemoveCondition}}
| <code>void RemoveCondition(int ''condition'')</code>
| {{Code|void RemoveCondition(int ''condition'')}}
| Removes the given condition from the weapon.
| Removes the given condition from the weapon.
|-
|-
| <code>RemoveAllConditions</code>
| {{Code|RemoveAllConditions}}
| <code>void RemoveAllConditions()</code>
| {{Code|void RemoveAllConditions()}}
| Removes all conditions from the weapon.
| Removes all conditions from the weapon.
|-
|-
Line 332: Line 323:


=== CJBPlayer ===
=== CJBPlayer ===


==== Methods ====
==== Methods ====
Line 341: Line 330:
! Description
! Description
|-
|-
| <code>AddCondition</code>
| {{Code|AddCondition}}
| <code>void AddCondition(int ''condition'')</code>
| {{Code|void AddCondition(int ''condition'')}}
| Adds the given condition to the player.
| Adds the given condition to the player.
|-
|-
| <code>HasCondition</code>
| {{Code|HasCondition}}
| <code>bool HasCondition(int ''condition'')</code>
| {{Code|bool HasCondition(int ''condition'')}}
| Returns true if the player has the given condition.
| Returns true if the player has the given condition.
|-
|-
| <code>RemoveCondition</code>
| {{Code|RemoveCondition}}
| <code>void RemoveCondition(int ''condition'')</code>
| {{Code|void RemoveCondition(int ''condition'')}}
| Removes the given condition from the player.
| Removes the given condition from the player.
|-
|-
| <code>ResetConditions</code>
| {{Code|ResetConditions}}
| <code>void ResetConditions()</code>
| {{Code|void ResetConditions()}}
| Removes all conditions from the player.
| Removes all conditions from the player.
|-
|-
| <code>GetPossessType</code>
| {{Code|GetPossessType}}
| <code>int GetPossessType()</code>
| {{Code|int GetPossessType()}}
| Returns the spectator monster type of the player.
| Returns the spectator monster type of the player.
|-
|-
Line 364: Line 353:


=== Vector ===
=== Vector ===
Vectors can have each component negated with the <code>-</code> operator.
Vectors can have each component negated with the <code>-</code> operator.


Example: <code>-Vector(1, -2, 3)</code> will evaluate to <code>Vector(-1, 2, -3)</code>
Example: {{Code|-Vector(1, -2, 3)}} will evaluate to {{Code|Vector(-1, 2, -3)}}


==== Methods ====
==== Methods ====
Line 375: Line 363:
! Description
! Description
|-
|-
| <code>constructor</code>
| {{Code|constructor}}
| <code>Vector Vector()</code>
| {{Code|Vector Vector()}}
| Creates a new vector (zeroed).
| Creates a new vector (zeroed).
|-
|-
| <code>constructor</code>
| {{Code|constructor}}
| <code>Vector Vector(float ''x'', float ''y'', float ''z'')</code>
| {{Code|Vector Vector(float ''x'', float ''y'', float ''z'')}}
| Creates a new vector with the specified coordinates.
| Creates a new vector with the specified coordinates.
|-
|-
| <code>operator +</code>
| {{Code|operator +}}
| <code>Vector Vector + Vector</code>
| {{Code|Vector Vector + Vector}}
| Returns result of the summary.
| Returns result of the summary.
|-
|-
| <code>operator +</code>
| {{Code|operator +}}
| <code>Vector Vector + float</code>
| {{Code|Vector Vector + float}}
| Returns a new vector with each component increased by a given number.
| Returns a new vector with each component increased by a given number.
|-
|-
| <code>operator -</code>
| {{Code|operator -}}
| <code>Vector Vector - Vector</code>
| {{Code|Vector Vector - Vector}}
| Returns result of the subtraction.
| Returns result of the subtraction.
|-
|-
| <code>operator -</code>
| {{Code|>operator -}}
| <code>Vector Vector - float</code>
| {{Code|Vector Vector - float}}
| Returns a new vector with each component decreased by a given number.
| Returns a new vector with each component decreased by a given number.
|-
|-
| <code>operator *</code>
| {{Code|operator *}}
| <code>Vector Vector * Vector</code>
| {{Code|Vector Vector * Vector}}
| Returns result of the multiplication.
| Returns result of the multiplication.
|-
|-
| <code>operator *</code>
| {{Code|operator *}}
| <code>Vector Vector * float</code>
| {{Code|Vector Vector * float}}
| Returns a new vector with each component multiplied by a given number.
| Returns a new vector with each component multiplied by a given number.
|-
|-
| <code>operator /</code>
| {{Code|operator /}}
| <code>Vector Vector / Vector</code>
| {{Code|Vector Vector / Vector}}
| Returns result of the division.
| Returns result of the division.
Throws an error on attempt to divide by zero.
Throws an error on attempt to divide by zero.
|-
|-
| <code>operator /</code>
| {{Code|operator /}}
| <code>Vector Vector / float</code>
| {{Code|Vector Vector / float}}
| Returns a new vector with each component divided by a given number.
| Returns a new vector with each component divided by a given number.
Throws an error on attempt to divide by zero.
Throws an error on attempt to divide by zero.
|-
|-
| <code>tostring</code>
| {{Code|tostring}}
| <code>string tostring()</code>
| {{Code|string tostring()}}
| Returns a human readable string.
| Returns a human readable string.
Example output: <code>(vector: (0.000000, 0.000000, 0.000000))</code>
Example output: <code>(vector: (0.000000, 0.000000, 0.000000))</code>
|-
|-
| <code>ToKVString</code>
| {{Code|ToKVString}}
| <code>string ToKVString()</code>
| {{Code|string ToKVString()}}
| Returns a string that can be used when creating an entity or firing an input.
| Returns a string that can be used when creating an entity or firing an input.
Example output: <code>0.000000 0.000000 0.000000</code>
Example output: <code>0.000000 0.000000 0.000000</code>
|-
|-
| <code>ToQAngle</code>
| {{Code|ToQAngle}}
| <code>QAngle ToQAngle()</code>
| {{Code|QAngle ToQAngle()}}
| Returns a new QAngle.
| Returns a new QAngle.
|-
|-
| <code>IsValid</code>
| {{Code|IsValid}}
| <code>bool IsValid()</code>
| {{Code|bool IsValid()}}
| Returns true if the vector is valid, false otherwise.
| Returns true if the vector is valid, false otherwise.
|-
|-
| <code>Invalidate</code>
| {{Code|Invalidate}}
| <code>void Invalidate()</code>
| {{Code|void Invalidate()}}
| Sets each component to <code>NaN</code>.
| Sets each component to <code>NaN</code>.
|-
|-
| <code>IsZero</code>
| {{Code|IsZero}}
| <code>bool IsZero()</code>
| {{Code|bool IsZero()}}
| Returns 'true' if the vector has zero length, 'false' otherwise.
| Returns 'true' if the vector has zero length, 'false' otherwise.
|-
|-
| <code>Zero</code>
| {{Code|Zero}}
| <code>void Zero()</code>
| {{Code|void Zero()}}
| Sets each components to zero.
| Sets each components to zero.
|-
|-
| <code>Random</code>
| {{Code|Random}}
| <code>void Random(float ''min'', float ''max'')</code>
| {{Code|void Random(float ''min'', float ''max'')}}
| Randomizes each component's value within the specified range.
| Randomizes each component's value within the specified range.
|-
|-
| <code>Scale</code>
| {{Code|Scale}}
| <code>Vector Scale(float ''mult'')</code>
| {{Code|Vector Scale(float ''mult'')}}
| Returns a new vector with each component multiplied by a given number.
| Returns a new vector with each component multiplied by a given number.
|-
|-
| <code>Lerp</code>
| {{Code|Lerp}}
| <code>Vector Lerp(Vector ''other'', float ''frac'')</code>
| {{Code|Vector Lerp(Vector ''other'', float ''frac'')}}
| Returns vector interpolated a given amount between itself and another given vector.
| Returns vector interpolated a given amount between itself and another given vector.
|-
|-
| <code>Length</code>
| {{Code|Length</code>
| <code>float Length()</code>
| {{Code|float Length()</code>
| Returns length of the vector.
| Returns length of the vector.
|-
|-
| <code>LengthSqr</code>
| {{Code|LengthSqr}}
| <code>float LengthSqr()</code>
| {{Code|float LengthSqr()}}
| Returns the squared length of the vector.
| Returns the squared length of the vector.
|-
|-
| <code>Length2D</code>
| {{Code|Length2D}}
| <code>float Length2D()</code>
| {{Code|float Length2D()}}
| Returns the length of the vector, only considering the X and Y axes.
| Returns the length of the vector, only considering the X and Y axes.
|-
|-
| <code>Length2DSqr</code>
| {{Code|Length2DSqr}}
| <code>float Length2DSqr()</code>
| {{Code|float Length2DSqr()}}
| Returns the squared length of the vector, only considering the X and Y axes.
| Returns the squared length of the vector, only considering the X and Y axes.
|-
|-
| <code>LargestComponent</code>
| {{Code|LargestComponent}}
| <code>int LargestComponent()</code>
| {{Code|int LargestComponent()}}
| Returns index of the largest component.
| Returns index of the largest component.
|-
|-
| <code>LargestComponentValue</code>
| {{Code|LargestComponentValue}}
| <code>float LargestComponentValue()</code>
| {{Code|float LargestComponentValue()}}
| Returns value of the largest component.
| Returns value of the largest component.
|-
|-
| <code>SmallestComponent</code>
| {{Code|SmallestComponent}}
| <code>int SmallestComponent()</code>
| {{Code|int SmallestComponent()}}
| Returns index of the smallest component.
| Returns index of the smallest component.
|-
|-
| <code>SmallestComponentValue</code>
| {{Code|SmallestComponentValue}}
| <code>float SmallestComponentValue()</code>
| {{Code|float SmallestComponentValue()}}
| Returns value of the smallest component.
| Returns value of the smallest component.
|-
|-
| <code>Min</code>
| {{Code|Min}}
| <code>Vector Min(Vector ''other'')</code>
| {{Code|Vector Min(Vector ''other'')}}
| Returns the minimum between this and a given vector.
| Returns the minimum between this and a given vector.
|-
|-
| <code>Max</code>
| {{Code|Max<}}
| <code>Vector Max(Vector ''other'')</code>
| {{Code|Vector Max(Vector ''other'')}}
| Returns the maximum between this and a given vector.
| Returns the maximum between this and a given vector.
|-
|-
| <code>Normalize</code>
| {{Code|Normalize}}
| <code>float Normalize()</code>
| {{Code|float Normalize()}}
| Normalizes the vector, and returns the vector length.
| Normalizes the vector, and returns the vector length.
|-
|-
| <code>DistTo</code>
| {{Code|DistTo}}
| <code>float DistTo(Vector ''other'')</code>
| {{Code|float DistTo(Vector ''other'')}}
| Returns the distance between the vector and a given vector.
| Returns the distance between the vector and a given vector.
|-
|-
| <code>DistToSqr</code>
| {{Code|DistToSqr}}
| <code>float DistToSqr(Vector ''other'')</code>
| {{Code|float DistToSqr(Vector ''other'')}}
| Returns the squared distance between the vector and a given vector.
| Returns the squared distance between the vector and a given vector.
|-
|-
| <code>Dot</code>
| {{Code|Dot}}
| <code>float Dot(Vector ''other'')</code>
| {{Code|float Dot(Vector ''other'')}}
| Returns the dot product of the vector and a given vector.
| Returns the dot product of the vector and a given vector.
|-
|-
| <code>Cross</code>
| {{Code|Cross}}
| <code>Vector Cross(Vector ''other'')</code>
| {{Code|Vector Cross(Vector ''other'')}}
| Returns the cross product of the vector and a given vector.
| Returns the cross product of the vector and a given vector.
|-
|-
| <code>ProjectOnto</code>
| {{Code|ProjectOnto}}
| <code>Vector ProjectOnto(Vector ''other'')</code>
| {{Code|>Vector ProjectOnto(Vector ''other'')}}
| Returns the vector projected onto a given vector.
| Returns the vector projected onto a given vector.
|-
|-
| <code>Rotate</code>
| {{Code|Rotate}}
| <code>Vector Rotate(QAngle ''angles'')</code>
| {{Code|Vector Rotate(QAngle ''angles'')}}
| Returns the vector rotated by a given QAngle.
| Returns the vector rotated by a given QAngle.
|-
|-
Line 924: Line 912:


== See also ==
== See also ==
*[[VScript]]
* [[VScript]]
*[[VScript Fundamentals]]
* [[VScript Fundamentals]]
*{{sq}} [[Squirrel]]
* {{sq|2}}
*[[Listening to game events in CS:GO|Listening to game events]]
* [[Listening to game events in CS:GO|Listening to game events]]
*{{csgo}} [[CSGO Vscript Examples|VScript Examples]]
* {{csgo}} [[CSGO Vscript Examples|VScript Examples]]
*{{csgo}} [[List of Counter-Strike: Global Offensive Script Functions]]
* {{csgo}} [[List of Counter-Strike: Global Offensive Script Functions]]
*{{l4d2}} [[Left_4_Dead_2/Script_Functions|List of L4D2 Script Functions]]
* {{l4d2}} [[Left_4_Dead_2/Script_Functions|List of L4D2 Script Functions]]
*{{portal2}} [[List of Portal 2 Script Functions]]
* {{portal2}} [[List of Portal 2 Script Functions]][Category:Jabroni Brawl: Episode 3]][[Category:Scripting]]
 
[[Category:Jabroni Brawl: Episode 3]]
[[Category:Scripting]]

Latest revision as of 07:41, 12 July 2024

English (en)Translate (Translate)

SquirrelLua Jabroni Brawl: Episode 3 Jabroni Brawl: Episode 3's implementation of VScript is built on Counter-Strike: Global Offensive Counter-Strike: Global Offensive's. This list only contains classes, functions and variables that differ from CS:GO's implementation.

Please note this article is written with Squirrel Squirrel in mind.

Constants

Instance Type Value Description
EJBGameMode table
Invalid =-1
Test = 0
BattleRoyale = 1
Deathmatch = 2
FartCops = 3
GunGame = 4
Survival = 5
SvT = 6
TeamDeathmatch = 7
InstaGib = 8
Ricochet = 9
SvM = 10
HazardCourse = 11
Flagdoll = 12
ScientistHunt = 13
Hunted = 14
TeamMission = 15
RatRace = 16
HotSpot = 17
Cooperative = 18
Hidden = 19
Bonedemic = 20
HeadHunt = 21
GiantSlayer = 22
Max = 23
The gamemode of the match.
ERoundState table
Invalid = -1
Init = 0
PreGame = 1
StartGame = 2
PreRound = 3
RoundRunning = 4
TeamWin = 5
Restart = 6
Stalemate = 7
GameOver = 8
Bonus = 9
BetweenRounds = 10
State of the round.
EJBRoundMutator table
None = -1
Standard = 0
InstaGib = 1
Melee = 2
Sniper = 3
Inverted = 4
Cats = 5
HighHP = 6
Farts = 7
HighSpeed = 8
LowSpeed = 9
LowFriction = 10
Headshot = 11
FoodFight = 12
BigHead = 13
Vampirism = 14
Jousting = 15
Grenades = 16
Golden = 17
Science = 18
DuckHunt = 19
BatterUp = 20
Boomerangs = 21
BrittleBones = 22
FingerBang = 23
Ghosts = 24
GravityHell = 25
Moonwalk = 26
RedLightGreenLight = 27
Shrink = 28
Splash = 29
SlowMelon = 30
RocketPogo = 31
Mirrored = 32
TextAdventure = 33
Hurricane = 34
Ricochets = 35
DutyCalls = 36
TankControls = 37
Berserk = 38
ScreenSaver = 39
Max = 40
Mutator of the round. This only exists when Battle Royale is the current gamemode.
ELifeState table
Alive = 0
Dying = 1
Dead = 2
Respawnable = 3
DiscardBody = 4
State of an entity's lifespan.
EJBCharacterCond table
None = -1
Invisible = 0
FrictionNade = 1
HeldUp = 2
Frozen = 3
NoDive = 4
NoWeaponDrop = 5
Dubstep = 6
HeadshotImmune = 7
SilentWalk = 8
NoThirdpersonView = 9
SilentDeath = 10
HeldUp_AllowChat = 11
GG_FinalLevel = 12
Deafen = 13
Bounce = 14
HideWeapon = 15
InvertedControls = 16
SlowWalk = 17
AutoStand = 18
SpawnProtection = 19
NoAirControl = 20
Seduced = 21
InfiniteClip = 22
InfiniteAmmo = 23
NoHealthDrop = 24
XRay = 25
AbsorbNextFall = 26
NoKicking = 27
ForceAttack1 = 28
ForceAttack2 = 29
Invisible_Blink = 30
Burning = 31
Censored = 32
Censored_Overlay = 33
Poisoned = 34
NoSlamDamage = 35
Bleeding = 36
NoFallDamage = 37
NoFireDamage = 38
FrictionNade_Self = 39
InvertedControls_X = 40
InvertedControls_Y = 41
TopDownView = 42
ASCII_Overlay = 43
RadioJam = 44
HPRegen = 45
CrazyViewSway = 46
HDBrown = 47
Scared = 48
Invincible = 49
Hallucinations = 50
Purgatory = 51
Predator = 52
Virus = 53
TankControls = 54
ScreenSaver = 55
NoDiveJump = 56
StompImmune = 57
Max = 58
Special conditions for players.
EJBWeaponCond table
Golden = 0
Scoped = 1
NoPrimary = 2
NoSecondary = 3
NoReload = 4
InfiniteAmmo = 5
InfiniteClip = 6
Slowdown = 7
Max = 8
Special conditions for weapons.
EJBPossessType table
None = -1
Headcrab = 0
Pigeon = 1
Scihead = 2
Chicken = 3
Max = 4
Spectator monster types.

Classes

CBaseEntity

Methods

Function Signature Description
GetLifeState int GetLifeState() Returns the current life state of the entity.
SetName void SetName(string name) Sets the target name of the entity.
SetParent void SetParent(handle parent) Sets the parent of the entity.
SetParentAttachment void SetParentAttachment(handle parent, int index) Sets the parent of the entity, as well as the attachment point (by index).
Bonemerge void Bonemerge(handle target) Starts following an entity via bonemerge.

CEntities

A client-side version of Entities now exists, with the following methods: First, Next, FindByClassname, and GetByIndex.

Methods

Function Signature Description
Create handle Create(string classname, table keyvalues) Creates and spawns an entity by classname, with the keyvalues from the given table.
CreateNoSpawn handle CreateNoSpawn(string classname, table keyvalues) Creates an entity by classname without spawning it, with the keyvalues from the given table.
GetByIndex handle GetByIndex(int index) Gets the entity at the given index.

CBasePlayer

Methods

Function Signature Description
GetUserID int GetUserID() Returns player's user ID.
GetNetworkIDString string GetNetworkIDString() Returns player's Steam ID as a string.
GetAccountID int GetAccountID() Returns player's account ID.
GetPlayerName string GetPlayerName() Returns player's network name.
IsFakeClient bool IsFakeClient() Returns true if this is a fake client.

CPlayerVoiceListener

In JBEP3, the PlayerVoiceListener instance has been implemented.

CJBBaseWeapon

Methods

Function Signature Description
AddCondition void HasCondition(int condition) Adds the given condition to the weapon.
HasCondition bool HasCondition(int condition) Returns true if the weapon has the given condition.
RemoveCondition void RemoveCondition(int condition) Removes the given condition from the weapon.
RemoveAllConditions void RemoveAllConditions() Removes all conditions from the weapon.

CJBPlayer

Methods

Function Signature Description
AddCondition void AddCondition(int condition) Adds the given condition to the player.
HasCondition bool HasCondition(int condition) Returns true if the player has the given condition.
RemoveCondition void RemoveCondition(int condition) Removes the given condition from the player.
ResetConditions void ResetConditions() Removes all conditions from the player.
GetPossessType int GetPossessType() Returns the spectator monster type of the player.

Vector

Vectors can have each component negated with the - operator.

Example: -Vector(1, -2, 3) will evaluate to Vector(-1, 2, -3)

Methods

Function Signature Description
constructor Vector Vector() Creates a new vector (zeroed).
constructor Vector Vector(float x, float y, float z) Creates a new vector with the specified coordinates.
operator + Vector Vector + Vector Returns result of the summary.
operator + Vector Vector + float Returns a new vector with each component increased by a given number.
operator - Vector Vector - Vector Returns result of the subtraction.
>operator - Vector Vector - float Returns a new vector with each component decreased by a given number.
operator * Vector Vector * Vector Returns result of the multiplication.
operator * Vector Vector * float Returns a new vector with each component multiplied by a given number.
operator / Vector Vector / Vector Returns result of the division.

Throws an error on attempt to divide by zero.

operator / Vector Vector / float Returns a new vector with each component divided by a given number.

Throws an error on attempt to divide by zero.

tostring string tostring() Returns a human readable string.

Example output: (vector: (0.000000, 0.000000, 0.000000))

ToKVString string ToKVString() Returns a string that can be used when creating an entity or firing an input.

Example output: 0.000000 0.000000 0.000000

ToQAngle QAngle ToQAngle() Returns a new QAngle.
IsValid bool IsValid() Returns true if the vector is valid, false otherwise.
Invalidate void Invalidate() Sets each component to NaN.
IsZero bool IsZero() Returns 'true' if the vector has zero length, 'false' otherwise.
Zero void Zero() Sets each components to zero.
Random void Random(float min, float max) Randomizes each component's value within the specified range.
Scale Vector Scale(float mult) Returns a new vector with each component multiplied by a given number.
Lerp Vector Lerp(Vector other, float frac) Returns vector interpolated a given amount between itself and another given vector.
Length float Length() Returns length of the vector.
LengthSqr float LengthSqr() Returns the squared length of the vector.
Length2D float Length2D() Returns the length of the vector, only considering the X and Y axes.
Length2DSqr float Length2DSqr() Returns the squared length of the vector, only considering the X and Y axes.
LargestComponent int LargestComponent() Returns index of the largest component.
LargestComponentValue float LargestComponentValue() Returns value of the largest component.
SmallestComponent int SmallestComponent() Returns index of the smallest component.
SmallestComponentValue float SmallestComponentValue() Returns value of the smallest component.
Min Vector Min(Vector other) Returns the minimum between this and a given vector.
Max< Vector Max(Vector other) Returns the maximum between this and a given vector.
Normalize float Normalize() Normalizes the vector, and returns the vector length.
DistTo float DistTo(Vector other) Returns the distance between the vector and a given vector.
DistToSqr float DistToSqr(Vector other) Returns the squared distance between the vector and a given vector.
Dot float Dot(Vector other) Returns the dot product of the vector and a given vector.
Cross Vector Cross(Vector other) Returns the cross product of the vector and a given vector.
ProjectOnto >Vector ProjectOnto(Vector other) Returns the vector projected onto a given vector.
Rotate Vector Rotate(QAngle angles) Returns the vector rotated by a given QAngle.

Members

Member Type Description
x float Cartesian X axis.
y float Cartesian Y axis.
z float Cartesian Z axis.

QAngle

Methods

Function Signature Description
constructor QAngle QAngle() Creates a new QAngle (zeroed).
constructor QAngle QAngle(float pitch, float yaw, float roll) Creates a new QAngle with the specified coordinates.
operator + QAngle QAngle + QAngle Returns result of the summary.
operator + QAngle QAngle + float Returns a new QAngle with each component increased by a given number.
operator - QAngle QAngle - QAngle Returns result of the subtraction.
operator - QAngle QAngle - float Returns a new QAngle with each component decreased by a given number.
operator * QAngle QAngle * QAngle Returns result of the multiplication.
operator * QAngle QAngle * float Returns a new QAngle with each component multiplied by a given number.
operator / QAngle QAngle / QAngle Returns result of the division.

Throws an error on attempt to divide by zero.

operator / QAngle QAngle / float Returns a new QAngle with each component diivided by a given number.

Throws an error on attempt to divide by zero.

tostring string tostring() Returns a human readable string.

Example output: (qangle: (0.000000, 0.000000, 0.000000))

ToKVString string ToKVString() Returns a string that can be used when creating an entity or firing an input.

Example output: 0.000000 0.000000 0.000000

IsValid boolean IsValid() Returns true if the QAngle is valid, false otherwise.
Invalidate void Invalidate() Sets each component to NaN.
Random void Random(float min, float max) Randomizes each component's value within the specified range.
Scale QAngle Scale(float mult) Returns a new QAngle with each component multiplied by a given number.
Length float Length() Returns the length of the QAngle.
LengthSqr float LengthSqr() Returns the squared length of the QAngle.
Normalize void Normalize() Clamps each component in range (-180..180]
NormalizePositive void NormalizePositive() Clamps each component in range [0..360)
Forward Vector Forward() Returns a normal vector in the direction that the QAngle points.
Right Vector Right() Returns a normal vector pointing to the right of the direction that the QAngle points.
Up Vector Up() Returns a normal vector pointing upwards of the direction that the QAngle points.

Members

Member Type Description
x float Rotation on the X axis.
y float Rotation on the Y axis.
z float Rotation on the Z axis.
pitch float Same as x.
yaw float Same as y.
roll float Same as z.

Global classes

g_Clients

Methods

Function Signature Description
GetLocalPlayer handle GetLocalPlayer() Client-side only. Gets the local player.
IsClientConnected bool IsClientConnected(int index) Server-side only. Returns true if the client at the given index is connected.
IsClientInGame bool IsClientConnected(int index) Server-side only. Returns true if the client at the given index is in-game.
IsFakeClient bool IsFakeClient(int index) Server-side only. Returns true if the client at the given index is fake.
IsClientSourceTV bool IsClientSourceTV(int index) Server-side only. Returns true if the client at the given index is SourceTV.
GetMaxClients int GetMaxClients() Returns the maximum number of clients.
GetPlayerByIndex handle GetPlayerByIndex(int index) Gets the player at the given index. Index starts at 1.
GetPlayerByUserID handle GetPlayerByUserID(int userid) Gets a player from the given user ID.
GetPlayerBySteamID handle GetPlayerBySteamID(string steamid) Gets a player from the given Steam ID. Uses the STEAM_X:Y:Z format.
GetPlayerByAccountID handle GetPlayerByAccountID(int accountid) Gets a player from the given Steam account ID.

g_CVar

Methods

Function Signature Description
GetFloat float GetFloat(string convar) Returns the given convar as a float.
GetString string GetString(string convar) Returns the given convar as a string.
GetClientConVarValue string GetClientConVarValue(string convar, int index) Returns the given convar for the entity at the given index as a string.
SetValue void SetValue(string convar, variant value) Sets the value of the given convar to the given value. Supported types are bool, int, float, string.

g_GameRules

Methods

Function Signature Description
IsMultiplayer bool IsMultiplayer() Returns true if the current gamemode is multiplayer.
IsTeamplay bool IsTeamplay() Returns true if the current gamemode is team-based.
IsCoOp bool IsCoOp() Returns true if the current gamemode is cooperative.
GetRoundState int GetRoundState() Returns the state of the current round.
IsInWaitingForPlayers bool IsInWaitingForPlayers() Returns true if the game is currently waiting for players before starting.
GetModeID int GetModeID() Returns the ID of the current gamemode.
GetModeName string GetModeName() Returns the short name of the current gamemode.
GetModeNameLong string GetModeNameLong() Returns the long name of the current gamemode.
GetRoundMutator int GetRoundMutator() Returns id of the current round's mutator.

Global functions

Printing and drawing

Function Signature Description
__DevMsg void __DevMsg(int developerLevel, string message) Prints the given message to the developer console if the current developer level is equal to or greater than the given developer level.
DevMsg void DevMsg(string message) Prints the given message to the developer console if the current developer level is equal to or greater than 1.
DevMsg2 void DevMsg2(string message) Prints the given message to the developer console if the current developer level is equal to or greater than 2.
DevMsg3 void DevMsg3(string message) Prints the given message to the developer console if the current developer level is equal to or greater than 3.
DebugDrawText void DebugDrawText(Vector origin, string text, bool bViewCheck, float duration) Draw text in 3D, at the given origin.
DebugDrawScreenTextLine void DebugDrawScreenTextLine(float x, float y, int lineOffset, string text, int r, int g, int b, int a, float duration) Draw text in 2D, at the given X and Y coordinates, with a line offset.
DebugDrawLine_vCol void DebugDrawLine_vCol(Vector start, Vector end, Vector rgb, bool zTest, float duration) Draw a debug line between the given positions.
DebugDrawCircle void DebugDrawCircle(Vector center, float radius, Vector rgb, bool zTest, float duration) Draw a debug circle, at the given origin.
DebugDrawBoxDirection void DebugDrawBoxDirection(Vector center, Vector min, Vector max, Vector forward, Vector rgb, float alpha, float duration) Draw a debug forward box.
DebugDrawClear void DebugDrawBoxDirection() Try to clear all the debug overlay info.

Other

Function Signature Description
IsServerRealm bool IsServerRealm() Returns true if the script is running on a server.
IsDedicatedServer bool IsDedicatedServer() Returns true if the script is running on a dedicated server.
DispatchSpawn void DispatchSpawn(handle entity) Spawns an entity that has been created but not spawned yet.

Removed functions

Function Signature Description Reason
CreateProp handle CreateProp(string classname, Vector origin, string model, int animation) Create a prop with the specified class and model. Both prop_physics, prop_dynamic as well as some other entity classes with models work. Does not precache the model. Broken, and no longer needed with the addition of Create and CreateNoSpawn.
GetDeveloperLevel int GetDeveloperLevel() Gets the level of the developer mode. Equivalent to developer(). Removed in favor of developer().

Global hooks

Function Signature Description
OnGameEvent void OnGameEvent(string eventName, table eventData) Called whenever an event is triggered. Can be used to control various events with varying conditions. eventData will hold the elements for various conditions of the event.

See also