Jabroni Brawl: Episode 3/Script Functions: Difference between revisions
mNo edit summary |
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) |
||
(22 intermediate revisions by 8 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{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. | |||
{{ | ''Please note this article is written with {{sq|2}} in mind.'' | ||
{{ | == Constants == | ||
{| class="standard-table" style="width: 80%;" | |||
!Instance | |||
!Type | |||
!Value | |||
!Description | |||
|- | |||
|{{Code|EJBGameMode}} | |||
|table | |||
|<div class="mw-collapsible mw-collapsed"><syntaxhighlight lang=js> | |||
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</syntaxhighlight> | |||
|The gamemode of the match. | |||
|- | |||
|{{Code|ERoundState}} | |||
|table | |||
|<div class="mw-collapsible mw-collapsed"><syntaxhighlight lang=js> | |||
Invalid = -1 | |||
Init = 0 | |||
PreGame = 1 | |||
StartGame = 2 | |||
PreRound = 3 | |||
RoundRunning = 4 | |||
TeamWin = 5 | |||
Restart = 6 | |||
Stalemate = 7 | |||
GameOver = 8 | |||
Bonus = 9 | |||
BetweenRounds = 10</syntaxhighlight> | |||
|State of the round. | |||
|- | |||
|{{Code|EJBRoundMutator}} | |||
|table | |||
|<div class="mw-collapsible mw-collapsed"><syntaxhighlight lang=js> | |||
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</syntaxhighlight> | |||
|Mutator of the round. This only exists when Battle Royale is the current gamemode. | |||
|- | |||
|{{Code|ELifeState}} | |||
|table | |||
|<div class="mw-collapsible mw-collapsed"><syntaxhighlight lang=js> | |||
Alive = 0 | |||
Dying = 1 | |||
Dead = 2 | |||
Respawnable = 3 | |||
DiscardBody = 4</syntaxhighlight> | |||
|State of an entity's lifespan. | |||
|- | |||
|{{Code|EJBCharacterCond}} | |||
|table | |||
|<div class="mw-collapsible mw-collapsed"><syntaxhighlight lang=js> | |||
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</syntaxhighlight> | |||
|Special conditions for players. | |||
|- | |||
|{{Code|EJBWeaponCond}} | |||
|table | |||
|<div class="mw-collapsible mw-collapsed"><syntaxhighlight lang=js> | |||
Golden = 0 | |||
Scoped = 1 | |||
NoPrimary = 2 | |||
NoSecondary = 3 | |||
NoReload = 4 | |||
InfiniteAmmo = 5 | |||
InfiniteClip = 6 | |||
Slowdown = 7 | |||
Max = 8</syntaxhighlight> | |||
|Special conditions for weapons. | |||
|- | |||
|{{Code|EJBPossessType}} | |||
|table | |||
|<div class="mw-collapsible mw-collapsed"><syntaxhighlight lang=js> | |||
None = -1 | |||
Headcrab = 0 | |||
Pigeon = 1 | |||
Scihead = 2 | |||
Chicken = 3 | |||
Max = 4</syntaxhighlight> | |||
|Spectator monster types. | |||
|- | |||
|} | |||
== Classes == | == Classes == | ||
Line 10: | Line 213: | ||
==== Methods ==== | ==== Methods ==== | ||
{| class="standard-table" style="width: | {| class="standard-table" style="width: 80%;" | ||
! Function | ! Function | ||
! Signature | ! Signature | ||
! Description | ! Description | ||
|- | |- | ||
| | | {{Code|GetLifeState}} | ||
| | | {{Code|int GetLifeState()}} | ||
| Returns the current life state of the entity. | |||
|- | |||
| {{Code|SetName}} | |||
| {{Code|void SetName(string ''name'')}} | |||
| Sets the target name of the entity. | | Sets the target name of the entity. | ||
|- | |- | ||
| | | {{Code|SetParent}} | ||
| | | {{Code|void SetParent(handle ''parent'')}} | ||
| Sets the parent of | | Sets the parent of the entity. | ||
|- | |- | ||
| | | {{Code|SetParentAttachment}} | ||
| | | {{Code|void SetParentAttachment(handle ''parent'', int ''index'')}} | ||
| Sets the parent of | | Sets the parent of the entity, as well as the attachment point (by index). | ||
|- | |- | ||
| | | {{Code|Bonemerge}} | ||
| | | {{Code|void Bonemerge(handle ''target'')}} | ||
| Starts following an entity via bonemerge. | | Starts following an entity via bonemerge. | ||
|- | |- | ||
Line 34: | 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>. | |||
==== Methods ==== | ==== Methods ==== | ||
Line 41: | Line 249: | ||
! Description | ! Description | ||
|- | |- | ||
| | | {{Code|Create}} | ||
| | | {{Code|handle Create(string ''classname'', table ''keyvalues'')}} | ||
| Creates an entity by classname without spawning it. | | Creates and spawns an entity by classname, with the keyvalues from the given table. | ||
|- | |||
| {{Code|CreateNoSpawn}} | |||
| {{Code|handle CreateNoSpawn(string ''classname'', table ''keyvalues'')}} | |||
| Creates an entity by classname without spawning it, with the keyvalues from the given table. | |||
|- | |||
| {{Code|GetByIndex}} | |||
| {{Code|handle GetByIndex(int ''index'')}} | |||
| Gets the entity at the given index. | |||
|- | |||
|} | |||
=== CBasePlayer === | |||
==== Methods ==== | |||
{| class="standard-table" style="width: 100%;" | |||
! Function | |||
! Signature | |||
! Description | |||
|- | |||
| {{Code|GetUserID}} | |||
| {{Code|int GetUserID()}} | |||
| Returns player's user ID. | |||
|- | |||
| {{Code|GetNetworkIDString}} | |||
| {{Code|string GetNetworkIDString()}} | |||
| Returns player's Steam ID as a string. | |||
|- | |||
| {{Code|GetAccountID}} | |||
| {{Code|int GetAccountID()}} | |||
| Returns player's account ID. | |||
|- | |||
| {{Code|GetPlayerName}} | |||
| {{Code|string GetPlayerName()}} | |||
| Returns player's network name. | |||
|- | |||
| {{Code|IsFakeClient}} | |||
| {{Code|bool IsFakeClient()}} | |||
| Returns true if this is a fake client. | |||
|- | |- | ||
|} | |} | ||
=== CPlayerVoiceListener === | === CPlayerVoiceListener === | ||
In JBEP3, the <code>PlayerVoiceListener</code> instance has been implemented. | |||
=== CJBBaseWeapon === | |||
==== Methods ==== | |||
{| class="standard-table" style="width: 100%;" | |||
! Function | |||
! Signature | |||
! Description | |||
|- | |||
| {{Code|AddCondition}} | |||
| {{Code|void HasCondition(int ''condition'')}} | |||
| Adds the given condition to the weapon. | |||
|- | |||
| {{Code|HasCondition}} | |||
| {{Code|bool HasCondition(int ''condition'')}} | |||
| Returns true if the weapon has the given condition. | |||
|- | |||
| {{Code|RemoveCondition}} | |||
| {{Code|void RemoveCondition(int ''condition'')}} | |||
| Removes the given condition from the weapon. | |||
|- | |||
| {{Code|RemoveAllConditions}} | |||
| {{Code|void RemoveAllConditions()}} | |||
| Removes all conditions from the weapon. | |||
|- | |||
|} | |||
=== CJBPlayer === | |||
==== Methods ==== | |||
{| class="standard-table" style="width: 100%;" | |||
! Function | |||
! Signature | |||
! Description | |||
|- | |||
| {{Code|AddCondition}} | |||
| {{Code|void AddCondition(int ''condition'')}} | |||
| Adds the given condition to the player. | |||
|- | |||
| {{Code|HasCondition}} | |||
| {{Code|bool HasCondition(int ''condition'')}} | |||
| Returns true if the player has the given condition. | |||
|- | |||
| {{Code|RemoveCondition}} | |||
| {{Code|void RemoveCondition(int ''condition'')}} | |||
| Removes the given condition from the player. | |||
|- | |||
| {{Code|ResetConditions}} | |||
| {{Code|void ResetConditions()}} | |||
| Removes all conditions from the player. | |||
|- | |||
| {{Code|GetPossessType}} | |||
| {{Code|int GetPossessType()}} | |||
| Returns the spectator monster type of the player. | |||
|- | |||
|} | |||
=== Vector === | |||
Vectors can have each component negated with the <code>-</code> operator. | |||
Example: {{Code|-Vector(1, -2, 3)}} will evaluate to {{Code|Vector(-1, 2, -3)}} | |||
==== Methods ==== | |||
{| class="standard-table" style="width: 100%;" | |||
! Function | |||
! Signature | |||
! Description | |||
|- | |||
| {{Code|constructor}} | |||
| {{Code|Vector Vector()}} | |||
| Creates a new vector (zeroed). | |||
|- | |||
| {{Code|constructor}} | |||
| {{Code|Vector Vector(float ''x'', float ''y'', float ''z'')}} | |||
| Creates a new vector with the specified coordinates. | |||
|- | |||
| {{Code|operator +}} | |||
| {{Code|Vector Vector + Vector}} | |||
| Returns result of the summary. | |||
|- | |||
| {{Code|operator +}} | |||
| {{Code|Vector Vector + float}} | |||
| Returns a new vector with each component increased by a given number. | |||
|- | |||
| {{Code|operator -}} | |||
| {{Code|Vector Vector - Vector}} | |||
| Returns result of the subtraction. | |||
|- | |||
| {{Code|>operator -}} | |||
| {{Code|Vector Vector - float}} | |||
| Returns a new vector with each component decreased by a given number. | |||
|- | |||
| {{Code|operator *}} | |||
| {{Code|Vector Vector * Vector}} | |||
| Returns result of the multiplication. | |||
|- | |||
| {{Code|operator *}} | |||
| {{Code|Vector Vector * float}} | |||
| Returns a new vector with each component multiplied by a given number. | |||
|- | |||
| {{Code|operator /}} | |||
| {{Code|Vector Vector / Vector}} | |||
| Returns result of the division. | |||
Throws an error on attempt to divide by zero. | |||
|- | |||
| {{Code|operator /}} | |||
| {{Code|Vector Vector / float}} | |||
| Returns a new vector with each component divided by a given number. | |||
Throws an error on attempt to divide by zero. | |||
|- | |||
| {{Code|tostring}} | |||
| {{Code|string tostring()}} | |||
| Returns a human readable string. | |||
Example output: <code>(vector: (0.000000, 0.000000, 0.000000))</code> | |||
|- | |||
| {{Code|ToKVString}} | |||
| {{Code|string ToKVString()}} | |||
| 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> | |||
|- | |||
| {{Code|ToQAngle}} | |||
| {{Code|QAngle ToQAngle()}} | |||
| Returns a new QAngle. | |||
|- | |||
| {{Code|IsValid}} | |||
| {{Code|bool IsValid()}} | |||
| Returns true if the vector is valid, false otherwise. | |||
|- | |||
| {{Code|Invalidate}} | |||
| {{Code|void Invalidate()}} | |||
| Sets each component to <code>NaN</code>. | |||
|- | |||
| {{Code|IsZero}} | |||
| {{Code|bool IsZero()}} | |||
| Returns 'true' if the vector has zero length, 'false' otherwise. | |||
|- | |||
| {{Code|Zero}} | |||
| {{Code|void Zero()}} | |||
| Sets each components to zero. | |||
|- | |||
| {{Code|Random}} | |||
| {{Code|void Random(float ''min'', float ''max'')}} | |||
| Randomizes each component's value within the specified range. | |||
|- | |||
| {{Code|Scale}} | |||
| {{Code|Vector Scale(float ''mult'')}} | |||
| Returns a new vector with each component multiplied by a given number. | |||
|- | |||
| {{Code|Lerp}} | |||
| {{Code|Vector Lerp(Vector ''other'', float ''frac'')}} | |||
| Returns vector interpolated a given amount between itself and another given vector. | |||
|- | |||
| {{Code|Length</code> | |||
| {{Code|float Length()</code> | |||
| Returns length of the vector. | |||
|- | |||
| {{Code|LengthSqr}} | |||
| {{Code|float LengthSqr()}} | |||
| Returns the squared length of the vector. | |||
|- | |||
| {{Code|Length2D}} | |||
| {{Code|float Length2D()}} | |||
| Returns the length of the vector, only considering the X and Y axes. | |||
|- | |||
| {{Code|Length2DSqr}} | |||
| {{Code|float Length2DSqr()}} | |||
| Returns the squared length of the vector, only considering the X and Y axes. | |||
|- | |||
| {{Code|LargestComponent}} | |||
| {{Code|int LargestComponent()}} | |||
| Returns index of the largest component. | |||
|- | |||
| {{Code|LargestComponentValue}} | |||
| {{Code|float LargestComponentValue()}} | |||
| Returns value of the largest component. | |||
|- | |||
| {{Code|SmallestComponent}} | |||
| {{Code|int SmallestComponent()}} | |||
| Returns index of the smallest component. | |||
|- | |||
| {{Code|SmallestComponentValue}} | |||
| {{Code|float SmallestComponentValue()}} | |||
| Returns value of the smallest component. | |||
|- | |||
| {{Code|Min}} | |||
| {{Code|Vector Min(Vector ''other'')}} | |||
| Returns the minimum between this and a given vector. | |||
|- | |||
| {{Code|Max<}} | |||
| {{Code|Vector Max(Vector ''other'')}} | |||
| Returns the maximum between this and a given vector. | |||
|- | |||
| {{Code|Normalize}} | |||
| {{Code|float Normalize()}} | |||
| Normalizes the vector, and returns the vector length. | |||
|- | |||
| {{Code|DistTo}} | |||
| {{Code|float DistTo(Vector ''other'')}} | |||
| Returns the distance between the vector and a given vector. | |||
|- | |||
| {{Code|DistToSqr}} | |||
| {{Code|float DistToSqr(Vector ''other'')}} | |||
| Returns the squared distance between the vector and a given vector. | |||
|- | |||
| {{Code|Dot}} | |||
| {{Code|float Dot(Vector ''other'')}} | |||
| Returns the dot product of the vector and a given vector. | |||
|- | |||
| {{Code|Cross}} | |||
| {{Code|Vector Cross(Vector ''other'')}} | |||
| Returns the cross product of the vector and a given vector. | |||
|- | |||
| {{Code|ProjectOnto}} | |||
| {{Code|>Vector ProjectOnto(Vector ''other'')}} | |||
| Returns the vector projected onto a given vector. | |||
|- | |||
| {{Code|Rotate}} | |||
| {{Code|Vector Rotate(QAngle ''angles'')}} | |||
| Returns the vector rotated by a given QAngle. | |||
|- | |||
|} | |||
==== Members ==== | |||
{| class="standard-table" style="width: 100%;" | |||
! Member | |||
! Type | |||
! Description | |||
|- | |||
| <code>x</code> | |||
| <code>float</code> | |||
| Cartesian X axis. | |||
|- | |||
| <code>y</code> | |||
| <code>float</code> | |||
| Cartesian Y axis. | |||
|- | |||
| <code>z</code> | |||
| <code>float</code> | |||
| Cartesian Z axis. | |||
|- | |||
|} | |||
=== QAngle === | |||
==== Methods ==== | |||
{| class="standard-table" style="width: 100%;" | |||
! Function | |||
! Signature | |||
! Description | |||
|- | |||
| <code>constructor</code> | |||
| <code>QAngle QAngle()</code> | |||
| Creates a new QAngle (zeroed). | |||
|- | |||
| <code>constructor</code> | |||
| <code>QAngle QAngle(float ''pitch'', float ''yaw'', float ''roll'')</code> | |||
| Creates a new QAngle with the specified coordinates. | |||
|- | |||
| <code>operator +</code> | |||
| <code>QAngle QAngle + QAngle</code> | |||
| Returns result of the summary. | |||
|- | |||
| <code>operator +</code> | |||
| <code>QAngle QAngle + float</code> | |||
| Returns a new QAngle with each component increased by a given number. | |||
|- | |||
| <code>operator -</code> | |||
| <code>QAngle QAngle - QAngle</code> | |||
| Returns result of the subtraction. | |||
|- | |||
| <code>operator -</code> | |||
| <code>QAngle QAngle - float</code> | |||
| Returns a new QAngle with each component decreased by a given number. | |||
|- | |||
| <code>operator *</code> | |||
| <code>QAngle QAngle * QAngle</code> | |||
| Returns result of the multiplication. | |||
|- | |||
| <code>operator *</code> | |||
| <code>QAngle QAngle * float</code> | |||
| Returns a new QAngle with each component multiplied by a given number. | |||
|- | |||
| <code>operator /</code> | |||
| <code>QAngle QAngle / QAngle</code> | |||
| Returns result of the division. | |||
Throws an error on attempt to divide by zero. | |||
|- | |||
| <code>operator /</code> | |||
| <code>QAngle QAngle / float</code> | |||
| Returns a new QAngle with each component diivided by a given number. | |||
Throws an error on attempt to divide by zero. | |||
|- | |||
| <code>tostring</code> | |||
| <code>string tostring()</code> | |||
| Returns a human readable string. | |||
Example output: <code>(qangle: (0.000000, 0.000000, 0.000000))</code> | |||
|- | |||
| <code>ToKVString</code> | |||
| <code>string ToKVString()</code> | |||
| 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> | |||
|- | |||
| <code>IsValid</code> | |||
| <code>boolean IsValid()</code> | |||
| Returns true if the QAngle is valid, false otherwise. | |||
|- | |||
| <code>Invalidate</code> | |||
| <code>void Invalidate()</code> | |||
| Sets each component to <code>NaN</code>. | |||
|- | |||
| <code>Random</code> | |||
| <code>void Random(float ''min'', float ''max'')</code> | |||
| Randomizes each component's value within the specified range. | |||
|- | |||
| <code>Scale</code> | |||
| <code>QAngle Scale(float ''mult'')</code> | |||
| Returns a new QAngle with each component multiplied by a given number. | |||
|- | |||
| <code>Length</code> | |||
| <code>float Length()</code> | |||
| Returns the length of the QAngle. | |||
|- | |||
| <code>LengthSqr</code> | |||
| <code>float LengthSqr()</code> | |||
| Returns the squared length of the QAngle. | |||
|- | |||
| <code>Normalize</code> | |||
| <code>void Normalize()</code> | |||
| Clamps each component in range (-180..180] | |||
|- | |||
| <code>NormalizePositive</code> | |||
| <code>void NormalizePositive()</code> | |||
| Clamps each component in range [0..360) | |||
|- | |||
| <code>Forward</code> | |||
| <code>Vector Forward()</code> | |||
| Returns a normal vector in the direction that the QAngle points. | |||
|- | |||
| <code>Right</code> | |||
| <code>Vector Right()</code> | |||
| Returns a normal vector pointing to the right of the direction that the QAngle points. | |||
|- | |||
| <code>Up</code> | |||
| <code>Vector Up()</code> | |||
| Returns a normal vector pointing upwards of the direction that the QAngle points. | |||
|- | |||
|} | |||
==== Members ==== | |||
{| class="standard-table" style="width: 100%;" | |||
! Member | |||
! Type | |||
! Description | |||
|- | |||
| <code>x</code> | |||
| <code>float</code> | |||
| Rotation on the X axis. | |||
|- | |||
| <code>y</code> | |||
| <code>float</code> | |||
| Rotation on the Y axis. | |||
|- | |||
| <code>z</code> | |||
| <code>float</code> | |||
| Rotation on the Z axis. | |||
|- | |||
| <code>pitch</code> | |||
| <code>float</code> | |||
| Same as <code>x</code>. | |||
|- | |||
| <code>yaw</code> | |||
| <code>float</code> | |||
| Same as <code>y</code>. | |||
|- | |||
| <code>roll</code> | |||
| <code>float</code> | |||
| Same as <code>z</code>. | |||
|- | |||
|} | |||
== Global classes == | |||
=== g_Clients === | |||
==== Methods ==== | |||
{| class="standard-table" style="width: 100%;" | |||
! Function | |||
! Signature | |||
! Description | |||
|- | |||
| <code>GetLocalPlayer</code> | |||
| <code>handle GetLocalPlayer()</code> | |||
| Client-side only. Gets the local player. | |||
|- | |||
| <code>IsClientConnected</code> | |||
| <code>bool IsClientConnected(int ''index'')</code> | |||
| Server-side only. Returns true if the client at the given index is connected. | |||
|- | |||
| <code>IsClientInGame</code> | |||
| <code>bool IsClientConnected(int ''index'')</code> | |||
| Server-side only. Returns true if the client at the given index is in-game. | |||
|- | |||
| <code>IsFakeClient</code> | |||
| <code>bool IsFakeClient(int ''index'')</code> | |||
| Server-side only. Returns true if the client at the given index is fake. | |||
|- | |||
| <code>IsClientSourceTV</code> | |||
| <code>bool IsClientSourceTV(int ''index'')</code> | |||
| Server-side only. Returns true if the client at the given index is SourceTV. | |||
|- | |||
| <code>GetMaxClients</code> | |||
| <code>int GetMaxClients()</code> | |||
| Returns the maximum number of clients. | |||
|- | |||
| <code>GetPlayerByIndex</code> | |||
| <code>handle GetPlayerByIndex(int ''index'')</code> | |||
| Gets the player at the given index. Index starts at 1. | |||
|- | |||
| <code>GetPlayerByUserID</code> | |||
| <code>handle GetPlayerByUserID(int ''userid'')</code> | |||
| Gets a player from the given user ID. | |||
|- | |||
| <code>GetPlayerBySteamID</code> | |||
| <code>handle GetPlayerBySteamID(string ''steamid'')</code> | |||
| Gets a player from the given Steam ID. Uses the <code>STEAM_X:Y:Z</code> format. | |||
|- | |||
| <code>GetPlayerByAccountID</code> | |||
| <code>handle GetPlayerByAccountID(int ''accountid'')</code> | |||
| Gets a player from the given Steam account ID. | |||
|- | |||
|} | |||
=== g_CVar === | |||
==== Methods ==== | |||
{| class="standard-table" style="width: 100%;" | |||
! Function | |||
! Signature | |||
! Description | |||
|- | |||
| <code>GetFloat</code> | |||
| <code>float GetFloat(string ''convar'')</code> | |||
| Returns the given convar as a float. | |||
|- | |||
| <code>GetString</code> | |||
| <code>string GetString(string ''convar'')</code> | |||
| Returns the given convar as a string. | |||
|- | |||
| <code>GetClientConVarValue</code> | |||
| <code>string GetClientConVarValue(string ''convar'', int ''index'')</code> | |||
| Returns the given convar for the entity at the given index as a string. | |||
|- | |||
| <code>SetValue</code> | |||
| <code>void SetValue(string ''convar'', variant ''value'')</code> | |||
| Sets the value of the given convar to the given value. Supported types are <code>bool</code>, <code>int</code>, <code>float</code>, <code>string</code>. | |||
|- | |||
|} | |||
=== g_GameRules === | |||
==== Methods ==== | |||
{| class="standard-table" style="width: 100%;" | |||
! Function | |||
! Signature | |||
! Description | |||
|- | |||
| <code>IsMultiplayer</code> | |||
| <code>bool IsMultiplayer()</code> | |||
| Returns true if the current gamemode is multiplayer. | |||
|- | |||
| <code>IsTeamplay</code> | |||
| <code>bool IsTeamplay()</code> | |||
| Returns true if the current gamemode is team-based. | |||
|- | |||
| <code>IsCoOp</code> | |||
| <code>bool IsCoOp()</code> | |||
| Returns true if the current gamemode is cooperative. | |||
|- | |||
| <code>GetRoundState</code> | |||
| <code>int GetRoundState()</code> | |||
| Returns the state of the current round. | |||
|- | |||
| <code>IsInWaitingForPlayers</code> | |||
| <code>bool IsInWaitingForPlayers()</code> | |||
| Returns true if the game is currently waiting for players before starting. | |||
|- | |||
| <code>GetModeID</code> | |||
| <code>int GetModeID()</code> | |||
| Returns the ID of the current gamemode. | |||
|- | |||
| <code>GetModeName</code> | |||
| <code>string GetModeName()</code> | |||
| Returns the short name of the current gamemode. | |||
|- | |||
| <code>GetModeNameLong</code> | |||
| <code>string GetModeNameLong()</code> | |||
| Returns the long name of the current gamemode. | |||
|- | |||
| <code>GetRoundMutator</code> | |||
| <code>int GetRoundMutator()</code> | |||
| Returns id of the current round's mutator. | |||
|- | |||
|} | |||
== Global functions == | == Global functions == | ||
=== Printing and drawing === | |||
{| class="standard-table" style="width: 100%;" | |||
! Function | |||
! Signature | |||
! Description | |||
|- | |||
| <code>__DevMsg</code> | |||
| <code>void __DevMsg(int ''developerLevel'', string ''message'')</code> | |||
| Prints the given message to the developer console if the current developer level is equal to or greater than the given developer level. | |||
|- | |||
| <code>DevMsg</code> | |||
| <code>void DevMsg(string ''message'')</code> | |||
| Prints the given message to the developer console if the current developer level is equal to or greater than 1. | |||
|- | |||
| <code>DevMsg2</code> | |||
| <code>void DevMsg2(string ''message'')</code> | |||
| Prints the given message to the developer console if the current developer level is equal to or greater than 2. | |||
|- | |||
| <code>DevMsg3</code> | |||
| <code>void DevMsg3(string ''message'')</code> | |||
| Prints the given message to the developer console if the current developer level is equal to or greater than 3. | |||
|- | |||
| <code>DebugDrawText</code> | |||
| <code>void DebugDrawText(Vector ''origin'', string ''text'', bool ''bViewCheck'', float ''duration'')</code> | |||
| Draw text in 3D, at the given origin. | |||
|- | |||
| <code>DebugDrawScreenTextLine</code> | |||
| <code>void DebugDrawScreenTextLine(float ''x'', float ''y'', int ''lineOffset'', string ''text'', int ''r'', int ''g'', int ''b'', int ''a'', float ''duration'')</code> | |||
| Draw text in 2D, at the given X and Y coordinates, with a line offset. | |||
|- | |||
| <code>DebugDrawLine_vCol</code> | |||
| <code>void DebugDrawLine_vCol(Vector ''start'', Vector ''end'', Vector ''rgb'', bool ''zTest'', float ''duration'')</code> | |||
| Draw a debug line between the given positions. | |||
|- | |||
| <code>DebugDrawCircle</code> | |||
| <code>void DebugDrawCircle(Vector ''center'', float ''radius'', Vector ''rgb'', bool ''zTest'', float ''duration'')</code> | |||
| Draw a debug circle, at the given origin. | |||
|- | |||
| <code>DebugDrawBoxDirection</code> | |||
| <code>void DebugDrawBoxDirection(Vector ''center'', Vector ''min'', Vector ''max'', Vector ''forward'', Vector ''rgb'', float ''alpha'', float ''duration'')</code> | |||
| Draw a debug forward box. | |||
|- | |||
| <code>DebugDrawClear</code> | |||
| <code>void DebugDrawBoxDirection()</code> | |||
| Try to clear all the debug overlay info. | |||
|- | |||
|} | |||
=== Other === | === Other === | ||
Line 60: | Line 864: | ||
! Description | ! Description | ||
|- | |- | ||
| <code> | | <code>IsServerRealm</code> | ||
| <code> | | <code>bool IsServerRealm()</code> | ||
| | | Returns true if the script is running on a server. | ||
|- | |||
| <code>IsDedicatedServer</code> | |||
| <code>bool IsDedicatedServer()</code> | |||
| Returns true if the script is running on a dedicated server. | |||
|- | |- | ||
| <code>DispatchSpawn</code> | | <code>DispatchSpawn</code> | ||
Line 76: | Line 884: | ||
! Signature | ! Signature | ||
! Description | ! Description | ||
! Reason | |||
|- | |- | ||
| <code>CreateProp</code> | | <code>CreateProp</code> | ||
| <code>handle CreateProp(string ''classname'', Vector ''origin'', string ''model'', int ''animation'')</code> | | <code>handle CreateProp(string ''classname'', Vector ''origin'', string ''model'', int ''animation'')</code> | ||
| 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. | | 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 <code>Create</code> and <code>CreateNoSpawn</code>. | |||
|- | |||
| <code>GetDeveloperLevel</code> | |||
| <code>int GetDeveloperLevel()</code> | |||
| Gets the level of the ''developer'' mode. Equivalent to <code>developer()</code>. | |||
| Removed in favor of <code>developer()</code>. | |||
|-> | |||
|} | |||
== Global hooks == | |||
{| class="standard-table" style="width: 100%;" | |||
! Function | |||
! Signature | |||
! Description | |||
|- | |||
| <code>OnGameEvent</code> | |||
| <code>void OnGameEvent(string ''eventName'', table ''eventData'')</code> | |||
| Called whenever an [[Events|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 == | == See also == | ||
*[[VScript]] | * [[VScript]] | ||
*[[VScript Fundamentals]] | * [[VScript Fundamentals]] | ||
*{{sq}} | * {{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}} [[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:Scripting]] |
Latest revision as of 07:41, 12 July 2024


Jabroni Brawl: Episode 3's implementation of VScript is built on
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 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: |
ToKVString | string ToKVString() | Returns a string that can be used when creating an entity or firing an input.
Example output: |
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: |
ToKVString
|
string ToKVString()
|
Returns a string that can be used when creating an entity or firing an input.
Example output: |
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. |