Schema hooks that register the HL2RP voice groups (Combine, Dispatch and Human) and their voice lines with the voices library.

Schema:RegisterVoiceGroups and Schema:RegisterVoices are run by cw.voices when it builds its tables. Each line has a chat command, a phrase and a Half-Life 2 sound, human lines also have a female sound, and the Dispatch phrases are language phrases.

Summary

Hooks

Adds a line to the Combine display of one or all Combine players.
Adds to a player's criminal points with Schema:SetCP.
Registers a custom business permit in Schema.customPermits.
Starts a flash effect on the local player.
Adds to a player's loyalty points with Schema:SetLP.
Starts a stun effect on the local player.
Adds to a player's work points with Schema:SetWorkPoints.
Attaches a Combine lock to a door.
Knocks down a door for five minutes.
Keeps a scanner player in sync with their scanner; does nothing for other players.
Called when a player attempts to use a tool; Wire tools need the w flag.
Returns whether a player may play a Civil Protection character.
Called when the info of a chat box message should be adjusted.
Called when a chat message's info should be adjusted.
Called when Catwork has loaded all of the entities.
Adds a loyalist tier to Schema.LoyalistTiers.
Returns the loyalist tier for a number of loyalty points.
Called just before a player dies.
Downloads a file over HTTP into the data folder, unless it already exists there.
Called when the status of a player under the crosshair should be drawn.
Called when an entity has been breached.
Called when a player chooses an option from an entity's menu.
Called when an entity is removed.
Called when an entity takes damage.
Called when the cinematic intro info is needed.
Returns a player's citizen status, from their CitizenStatus net var.
Returns the colour of a player's citizen status from Schema.CitizenStates.
Returns a player's criminal points, from their CriminalPoints net var.
Returns how long a dexterity action such as tying takes a player, based on their Agility attribute.
Called when an entity's menu options are needed.
Returns how much health a player heals, based on their Medical attribute.
Returns whether a player is jailed, from their Jailed net var.
Returns a player's job, from their Job net var.
Returns a player's loyalty points, from their LoyaltyPoints net var.
Called when the faction shown for a character on the character screen is needed.
Returns a number for a player's Combine rank, used to sort and compare ranks.
Called when a new character's default inventory is needed.
Called when a player's default model is needed; overridden to do nothing so the faction model is used.
Called when the player info text is needed; adds the citizen ID line for citizens.
Called when a player's scoreboard class is needed.
Called when a player's scoreboard options are needed.
Called when the position of a player's typing display is needed.
Returns a player's residence, from their Residence net var.
Returns the scanner a player controls, from their scanner net var.
Called when the full screen text info is needed.
Called when the fade distance of a player's target ID is needed.
Returns a player's work points, from their WorkPoints net var.
Called when an entity's target ID should be painted.
Called when the foreground HUD should be painted; draws the white flash of active stun effects.
Called when the top of the screen HUD should be painted.
Called when the gamemode initializes on the client.
Returns whether a faction is Civil Protection or Overwatch.
Returns whether a Civil Protection or Overwatch player's name contains a Combine rank.
Returns whether a name contains a Combine rank.
Returns whether a text entry has focus and is visible.
Called when a player presses a key.
Spawns the named NPCs saved for the current map by Schema:SaveNPCs.
Loads the Combine objectives from the objectives schema data into Schema.combineObjectives.
Spawns the stationary radios saved for the current map by Schema:SaveRadios.
Spawns the ration dispensers saved for the current map by Schema:SaveRationDispensers.
Spawns the vending machines saved for the current map by Schema:SaveVendingMachines.
Turns a player into a scanner they control.
Called every second for each player.
Called when an NPC is killed.
Called when a text entry gains focus; remembers it for Schema:IsTextEntryBeingUsed.
Called when a text entry loses focus; clears the entry remembered by Schema:OnTextEntryGetFocus.
Permanently kills a player's character.
Called when a character's entry on the character screen should be adjusted.
Called when the model shown for a class in the class menu should be adjusted.
Called when the local player's colour modification should be adjusted.
Called when a player's death info should be adjusted; permakilled characters get no respawn time.
Called when the info of a weapon a player drops should be adjusted.
Called when the local player's motion blurs should be adjusted.
Called when a player's radio message info should be adjusted.
Called when a player's attribute is updated; shows an attribute line on a Combine player's display.
Called when the local player's business menu is rebuilt.
Called when a player attempts to be given a weapon; scanner players cannot.
Called when a player attempts to breach an entity; any real door except rotating ones may be breached.
Called when a player attempts to change class.
Called when a player attempts to delete a character; permakilled characters can always be deleted.
Called when a player attempts to destroy an item; scanners and tied players cannot.
Called when a player attempts to drop an item; scanners and tied players cannot.
Called when a player attempts to earn cash from a generator; Combine players cannot.
Called when a player attempts to lock an entity.
Called when a player attempts to use the radio.
Called when a player attempts to be ragdolled; scanners cannot.
Called when a player attempts to restore a recognised name; Combine names are never restored.
Called when a player attempts to save a recognised name; Combine names are never saved.
Called when the local player attempts to see a class in the class menu.
Called when a player attempts to switch characters.
Called when a player attempts to unlock an entity.
Called when a player attempts to use a character.
Called when a player attempts to use a command.
Called when a player attempts to open a door with the use key.
Called when a player attempts to use an entity from a vehicle; allows players and their ragdolls.
Called when a player attempts to use an item.
Called when the local player attempts to zoom; only Combine players may zoom.
Called when a player's character has initialized.
Called when a player's character has loaded.
Called when a player's character has unloaded; removes their scanner.
Called each frame a player is dead; permakilled characters cannot respawn.
Called when a player destroys a generator.
Called to check whether a player has a flag.
Called to check whether a player recognises another player.
Called when a player stops typing; plays the radio-off sound for Combine players who sent a message.
Called when a player's footstep sound should be played.
Returns the name of the area a player is in, using the Area Names plugin.
Called when a player's spawn weapons should be given.
Called when a player's inventory contains an item that no longer exists.
Called when a player has been healed.
Called when a player's health is set; copies it to their scanner.
Called when a player first spawns; exchanges custom scoreboard icons with them two seconds later.
Called when an item in a player's inventory is updated.
Returns whether a player is Combine, using Player:IsCombine.
Returns whether a player's character belongs to the Civil Workers' Union.
Returns whether the tier of a player's loyalty points has a name containing the given text.
Called when a player's limb damage is healed; removes the limb's attribute penalties.
Called when a player's limb damage is reset; removes every limb damage attribute penalty.
Called when a player's limb takes damage.
Called when a player's name changes.
Called when a player attempts to noclip; scanners cannot.
Called when a player's death sound should be played.
Called when a player's pain sound should be played; Combine players use Civil Protection sounds.
Called when a player punches an entity; progresses Strength, twice as much for players and NPCs.
Called when a player throws a punch; progresses their Strength.
Called after a player has used the radio.
Called when a player's character data is restored.
Called when a player's data is restored.
Called when a player's data should be saved; drops an empty server whitelist.
Called when a player's damage should be scaled by hit group.
Called when the local player's default colour modification should be set.
Called when a player attempts to spawn an object; tied players and scanners cannot.
Called when a player attempts to spawn a prop.
Called when a player attempts to spray; only untied players with a spray can may spray.
Called when a player starts typing; plays the radio-on sound for Combine players typing a message.
Called to check whether a player's storage should close.
Called when a player hits an entity with a stunstick.
Called when a player switches their flashlight; scanner players and tied players cannot turn it on.
Called when a player takes damage; stuns their view, longer when they have armour.
Called at an interval while a player is connected.
Called when a player attempts to use an entity.
Called when a player uses a door.
Puts clothes on a player, or takes off the clothes they wear.
Called after a player light-spawns; reapplies the clothes they wear.
Called just after a player spawns.
Called just after data has been saved.
Called when voice groups should be registered.
Called when voices should be registered.
Called when screen space effects should be rendered.
Removes a player's scanner and its follow marker; does nothing when they have none.
Called when data should be saved; the schema saves its entities in Schema:PostSaveData instead.
Saves every NPC with a name and title (set with the SetNPCName command) for the current map.
Saves the position, owner, frequency and state of every stationary radio for the current map.
Saves the position, angles and lock state of every ration dispenser for the current map.
Saves the position, angles and stock of every vending machine for the current map.
Sends a broadcast message from a player to everyone.
Sends a message to everyone under the name of Dispatch.
Sends a message through a player's request device.
Called when a player's scoreboard info should be adjusted.
Called when the players of a scoreboard class should be sorted.
Sends custom scoreboard icons over the PlayerSetCustomIcon Cable message.
Sets a player's citizen status in their character data and CitizenStatus net var.
Sets a player's criminal points, rounded, in their character data and CriminalPoints net var.
Sets whether a player is jailed, in their character data and Jailed net var.
Sets a player's job in their character data and Job net var.
Sets a player's loyalty points, rounded, in their character data and LoyaltyPoints net var.
Sets a player's residence in their character data and Residence net var.
Called when a player's visibility is set up; adds a scanner player's scanner to their PVS.
Sets a player's work points, rounded, in their character data and WorkPoints net var.
Called when a player presses F3; uses the player's zip tie, or tells them they have none.
Called when a player presses F4; runs the CharSearch command.
Subtracts from a player's criminal points with Schema:AddCP.
Subtracts from a player's loyalty points with Schema:AddLP.
Tick()shared
Called every tick.
Ties or unties a player.

Hooks

Schema:AddCombineDisplayLine(text, color, player, exclude)

shared gamemodes/cwhl2rp/schema/sv_schema.lua:486

On the server

Adds a line to the Combine display of one or all Combine players.

Sent with the CombineDisplayLine Cable message; the client side is Schema:AddCombineDisplayLine in cl_schema.lua.

Parameters

  • text String The text or language key to show
  • color Color optional, defaults to nil Colour of the line; white when nil
  • player Player optional, defaults to nil Only send the line to this player
  • exclude Player optional, defaults to nil A Combine player who does not receive the line

On the client

Adds a line to the local player's Combine display; does nothing for non-Combine players.

The text is translated and shown for eight seconds by Schema:HUDPaintTopScreen. Uncoloured lines are suppressed while the player's biosignal is gone, and also refresh the biosignal locations of the cwCTO plugin. Sent from the server with the CombineDisplayLine Cable message.

Parameters

  • text String The text or language key to show
  • color Color optional, defaults to nil Colour of the line; white when nil

Defined in

Schema:AddCP(player, amt)

server gamemodes/cwhl2rp/schema/sv_schema.lua:267

Adds to a player's criminal points with Schema:SetCP.

Parameters

  • player Player The player
  • amt Number The amount to add; may be negative

Schema:AddCustomPermit(name, flag, model)

shared gamemodes/cwhl2rp/schema/sh_schema.lua:212

Registers a custom business permit in Schema.customPermits.

Citizens can buy the permit from the business menu while permits are enabled, gaining the flag. The permit is stored under its lowercased name without spaces or punctuation, which is also the argument the PermitBuy command expects.

Schema:AddCustomPermit('Literature', '3', 'models/props_lab/bindergreenlabel.mdl')

Parameters

  • name String Display name of the permit
  • flag String The flag the permit grants
  • model String Model shown for the permit in the business menu

Schema:AddFlashEffect()

client gamemodes/cwhl2rp/schema/cl_schema.lua:169

Starts a flash effect on the local player.

Adds a ten second white-out (see Schema:HUDPaintForeground), a twenty second colour shift and motion blur (see Schema:RenderScreenspaceEffects) and plays a flatline sound. Triggered by the Flashed Cable message.

Schema:AddLP(player, amt)

server gamemodes/cwhl2rp/schema/sv_schema.lua:256

Adds to a player's loyalty points with Schema:SetLP.

Parameters

  • player Player The player
  • amt Number The amount to add; may be negative

Schema:AddStunEffect(duration)

client gamemodes/cwhl2rp/schema/cl_schema.lua:183

Starts a stun effect on the local player.

Adds a white-out lasting duration seconds and a flash blur lasting twice as long. Triggered by the Stunned Cable message.

Parameters

  • duration Number optional, defaults to 1 Length of the white-out in seconds; 0 also means one second

Schema:AddWorkPoints(player, amt)

server gamemodes/cwhl2rp/schema/sv_schema.lua:340

Adds to a player's work points with Schema:SetWorkPoints.

Parameters

  • player Player The player
  • amt Number The amount to add; may be negative

Schema:ApplyCombineLock(entity, position, angles)

server gamemodes/cwhl2rp/schema/sv_schema.lua:866

Attaches a Combine lock to a door.

Parameters

  • entity Entity The door
  • position Vector optional, defaults to nil Position of the lock; a trace result places it at the default spot on the door, moved out along the hit normal
  • angles Angle optional, defaults to nil Angles of the lock

Returns

Schema:BustDownDoor(player, door, force)

server gamemodes/cwhl2rp/schema/sv_schema.lua:948

Knocks down a door for five minutes.

Hides and unlocks the door, destroys its Combine lock, triggers its breach and throws a decaying physics copy of it, away from the player unless a force is given. The door returns after 300 seconds.

Parameters

  • player Player The player busting the door down, or nil
  • door Entity The door
  • force Vector optional, defaults to nil Force applied to the fake door instead of pushing it away from the player

Schema:CalculateScannerThink(player, curTime)

server gamemodes/cwhl2rp/schema/sv_schema.lua:354

Keeps a scanner player in sync with their scanner; does nothing for other players.

Copies the scanner's health to the player, keeps them in observer movement and plays a random scanner sound every 8 to 48 seconds.

Parameters

  • player Player The player controlling the scanner
  • curTime Number The current CurTime()

Schema:CanTool(player, trace, tool)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:976

Called when a player attempts to use a tool; Wire tools need the w flag.

Parameters

  • player Player The player
  • trace Map The player's eye trace
  • tool String The tool mode

Returns

  • Boolean false to block the tool

Schema:CanUseCP(player)

shared gamemodes/cwhl2rp/schema/sh_schema.lua:195

Returns whether a player may play a Civil Protection character.

Characters below rank 6 are marked as unavailable on the character screen when this is false; the schema always allows it.

Parameters

  • player Player The player

Returns

  • Boolean Always true

Schema:ChatBoxAdjustInfo(info)

client gamemodes/cwhl2rp/schema/cl_hooks.lua:812

Called when the info of a chat box message should be adjusted.

Hides the speaker's name for anonymous messages and shows scanner units as Dispatch on the radio.

Parameters

  • info Map The message info: speaker, class, data and name, which may be replaced

Schema:ChatboxAdjustMessageInfo(info, listeners)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1620

Implements hook ChatboxAdjustMessageInfo

Called when a chat message's info should be adjusted.

In-character messages starting with ? are sent anonymously, without the ?.

Parameters

  • info Map The message: filter, sender, text and data, changed in place
  • listeners List<Player> The players who will receive it

Schema:ClockworkInitPostEntity()

server gamemodes/cwhl2rp/schema/sv_hooks.lua:23

Implements hook ClockworkInitPostEntity

Called when Catwork has loaded all of the entities.

Loads the saved ration dispensers, vending machines, Combine objectives, radios and named NPCs.

Schema:DefineLoyalistTier(name, description, color, min, max)

shared gamemodes/cwhl2rp/schema/sh_schema.lua:130

Adds a loyalist tier to Schema.LoyalistTiers.

Tiers are matched against a character's loyalty points by Schema:DetermineLoyalistTier; define them in ascending order of points.

Schema:DefineLoyalistTier('#Loyalist_Red', '#Loyalist_Red_Desc', Color(210, 100, 100), 150, -1)

Parameters

  • name String Name or language key of the tier
  • description String Description or language key of the tier
  • color Color Colour the tier is shown in
  • min Number Lowest number of loyalty points in the tier
  • max Number Highest number of loyalty points in the tier, or -1 for no limit

Schema:DetermineLoyalistTier(num)

shared gamemodes/cwhl2rp/schema/sh_schema.lua:146

Returns the loyalist tier for a number of loyalty points.

When several tiers match, the last defined one wins.

Parameters

  • num Number The loyalty points

Returns

  • Map The tier (name, description, color, min, max); the first tier when none match, or a magenta ERROR tier when none are defined

Schema:DoPlayerDeath(player, attacker, damageInfo)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1666

Implements hook DoPlayerDeath

Called just before a player dies.

Returns worn clothes to the inventory, ends any search and unties the player without a respawn.

Parameters

  • player Player The player
  • attacker Entity The attacker
  • damageInfo CTakeDamageInfo The damage

Schema:DownloadMaterial(url, path)

client gamemodes/cwhl2rp/schema/cl_schema.lua:148

Downloads a file over HTTP into the data folder, unless it already exists there.

The download is asynchronous and the response body is written as is. Used for scoreboard icons, which are then referenced as data/<path>.

Parameters

  • url String The URL to download
  • path String The destination, relative to the DATA folder

Schema:DrawTargetPlayerStatus(target, alpha, x, y)

client gamemodes/cwhl2rp/schema/cl_hooks.lua:532

Implements hook DrawTargetPlayerStatus

Called when the status of a player under the crosshair should be drawn.

Draws whether the target is in critical condition, unconscious, tied or being tied or untied, with an untie prompt when the local player is close enough.

Parameters

  • target Player The player being looked at
  • alpha Number The alpha to draw with
  • x Number The X position to draw at
  • y Number The Y position to draw at

Returns

  • Number The Y position after the drawn text, or nil when the target is dead

Schema:EntityBreached(entity, activator)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1861

Implements hook EntityBreached

Called when an entity has been breached.

Opens doors without a Combine lock, busting down rotating doors breached by a player. A Combine lock breached by a Combine player is blown off a rotating door with a smoke charge; otherwise it flashes.

Parameters

  • entity Entity The breached entity
  • activator Entity Who breached it, if anyone

Schema:EntityHandleMenuOption(player, entity, option, arguments)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:58

Implements hook EntityHandleMenuOption

Called when a player chooses an option from an entity's menu.

Opens corpse loot and belongings storage, charges breaches and handles the stationary radio options: setting a frequency in the 1X1.X format, toggling it and picking it up as an item. Empty belongings are removed when closed.

Parameters

  • player Player The player who chose the option
  • entity Entity The entity
  • option String The option's name
  • arguments Any The option's menu string, such as 'cw_radioToggle', or the typed frequency

Schema:EntityRemoved(entity)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1064

Called when an entity is removed.

When a ragdoll holding belongings (see Schema:PermaKillPlayer) is removed, they are left behind as a cw_belongings entity.

Parameters

  • entity Entity The entity

Schema:EntityTakeDamage(entity, damageInfo)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1971

Implements hook EntityTakeDamage

Called when an entity takes damage.

Progresses the victim's Endurance, plays scanner pain sounds and warns the Combine when a unit is attacked. Scales damage by the attacker's weapon, melee Strength and explosions (NPC damage is halved), and lets shots at the handle, shotguns and explosions open or bust down rotating doors.

Parameters

  • entity Entity The damaged entity
  • damageInfo CTakeDamageInfo The damage, scaled in place

Schema:GetCinematicIntroInfo()

client gamemodes/cwhl2rp/schema/cl_hooks.lua:293

Implements hook GetCinematicIntroInfo

Called when the cinematic intro info is needed.

Returns

  • Map The intro's credits, title and text, taken from the intro_text_big and intro_text_small config values

Schema:GetCitizenStatus(player)

shared gamemodes/cwhl2rp/schema/sh_schema.lua:353

Returns a player's citizen status, from their CitizenStatus net var.

Parameters

  • player Player The player

Returns

  • String A key of Schema.CitizenStates, 'Unknown' by default

Schema:GetCitizenStatusColor(player)

shared gamemodes/cwhl2rp/schema/sh_schema.lua:388

Returns the colour of a player's citizen status from Schema.CitizenStates.

Parameters

  • player Player The player

Returns

  • Color The status colour, or white for an unknown status

Schema:GetCP(player)

shared gamemodes/cwhl2rp/schema/sh_schema.lua:346

Returns a player's criminal points, from their CriminalPoints net var.

Parameters

  • player Player The player

Returns

  • Number The criminal points, 0 by default

Schema:GetDexterityTime(player)

server gamemodes/cwhl2rp/schema/sv_schema.lua:937

Returns how long a dexterity action such as tying takes a player, based on their Agility attribute.

Parameters

  • player Player The player

Returns

  • Number The time in seconds, from 7 down to 2 with full Agility

Schema:GetEntityMenuOptions(entity, options)

client gamemodes/cwhl2rp/schema/cl_hooks.lua:128

Implements hook GetEntityMenuOptions

Called when an entity's menu options are needed.

Adds the Loot option to corpses, Open to belongings, Charge to breaches and turn on/off, set frequency and take options to stationary radios.

Parameters

  • entity Entity The entity the menu is for
  • options Map Option names mapped to a menu option string or a callback, filled in place

Schema:GetHealAmount(player, scale)

server gamemodes/cwhl2rp/schema/sv_schema.lua:927

Returns how much health a player heals, based on their Medical attribute.

Parameters

  • player Player The player doing the healing
  • scale Number optional, defaults to 1 Multiplier for the amount

Returns

  • Number 15 plus up to 35 for the Medical attribute, times scale

Schema:GetJailed(player)

shared gamemodes/cwhl2rp/schema/sh_schema.lua:367

Returns whether a player is jailed, from their Jailed net var.

Parameters

  • player Player The player

Returns

  • Boolean Whether the player is jailed, false by default

Schema:GetJob(player)

shared gamemodes/cwhl2rp/schema/sh_schema.lua:374

Returns a player's job, from their Job net var.

Parameters

  • player Player The player

Returns

  • String The job, 'None' by default

Schema:GetLP(player)

shared gamemodes/cwhl2rp/schema/sh_schema.lua:339

Returns a player's loyalty points, from their LoyaltyPoints net var.

Parameters

  • player Player The player

Returns

  • Number The loyalty points, 0 by default

Schema:GetPlayerCharacterScreenFaction(character)

client gamemodes/cwhl2rp/schema/cl_hooks.lua:344

Implements hook GetPlayerCharacterScreenFaction

Called when the faction shown for a character on the character screen is needed.

Parameters

  • character Character The character's data

Returns

  • String The character's custom class, or nil when it has none

Schema:GetPlayerCombineRank(player)

shared gamemodes/cwhl2rp/schema/sh_schema.lua:285

Returns a number for a player's Combine rank, used to sort and compare ranks.

Overwatch ranks are 0 (OWS) to 3 (other). Civil Protection ranks are 0 (RCT), 1-4 (04-01), 5 (no rank found), 6 (GHOST), 7 (OfC), 8 (EpU), 9 (DvL), 10 (CmD), 11 (SCN) and 12 (SYNTH scanner).

Parameters

  • player Player The player

Returns

  • Number The rank number; higher is more senior

Schema:GetPlayerDefaultInventory(player, character, inventory)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:258

Implements hook GetPlayerDefaultInventory

Called when a new character's default inventory is needed.

Gives administrators a radio, Civil Protection a radio and stunstick, Overwatch a radio, pistol, MP7 and ammunition, and everyone else a suitcase.

Parameters

  • player Player The player
  • character Character The new character
  • inventory Inventory The inventory, filled in place

Schema:GetPlayerDefaultModel(player)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:46

Implements hook GetPlayerDefaultModel

Called when a player's default model is needed; overridden to do nothing so the faction model is used.

Parameters

  • player Player The player

Schema:GetPlayerInfoText(playerInfoText)

client gamemodes/cwhl2rp/schema/cl_hooks.lua:585

Implements hook GetPlayerInfoText

Called when the player info text is needed; adds the citizen ID line for citizens.

Parameters

  • playerInfoText Map The info text object, with an Add(id, text) method

Schema:GetPlayerScoreboardClass(player)

client gamemodes/cwhl2rp/schema/cl_hooks.lua:326

Implements hook GetPlayerScoreboardClass

Called when a player's scoreboard class is needed.

Uses the player's custom class when set, and groups Civil Protection and Overwatch under their faction.

Parameters

  • player Player The player on the scoreboard

Returns

  • String The scoreboard class name, or nil for the default

Schema:GetPlayerScoreboardOptions(player, options, menu)

client gamemodes/cwhl2rp/schema/cl_hooks.lua:365

Implements hook GetPlayerScoreboardOptions

Called when a player's scoreboard options are needed.

Adds server whitelist, custom class and permakill options, each only when the command exists and the local player has its access flags. The options run the matching commands.

Parameters

  • player Player The player the options are for
  • options Map Option names mapped to callbacks or sub-option maps, filled in place
  • menu Panel The scoreboard menu

Schema:GetPlayerTypingDisplayPosition(player)

client gamemodes/cwhl2rp/schema/cl_hooks.lua:163

Implements hook GetPlayerTypingDisplayPosition

Called when the position of a player's typing display is needed.

Places the display above the body bone of the player's scanner when they control one.

Parameters

  • player Player The player who is typing

Returns

  • Vector The display position, or nil for the default

Schema:GetResidence(player)

shared gamemodes/cwhl2rp/schema/sh_schema.lua:360

Returns a player's residence, from their Residence net var.

Parameters

  • player Player The player

Returns

  • String The residence, 'Unknown' by default

Schema:GetScannerEntity(player)

client gamemodes/cwhl2rp/schema/cl_schema.lua:206

Returns the scanner a player controls, from their scanner net var.

Parameters

  • player Player The player

Returns

  • Entity The scanner, or nil when the player controls no valid scanner

Schema:GetScreenTextInfo()

client gamemodes/cwhl2rp/schema/cl_hooks.lua:786

Implements hook GetScreenTextInfo

Called when the full screen text info is needed.

Shows a message while the local player's character is permakilled, being tied or tied.

Returns

  • Map The text's alpha, title and optional text, or nil for none

Schema:GetTargetPlayerFadeDistance(player)

client gamemodes/cwhl2rp/schema/cl_hooks.lua:116

Implements hook GetTargetPlayerFadeDistance

Called when the fade distance of a player's target ID is needed.

Returns 512 while the local player controls a scanner, so targets stay visible from further away.

Parameters

  • player Player The player being looked at

Returns

  • Number The fade distance, or nil for the default

Schema:GetWorkPoints(player)

shared gamemodes/cwhl2rp/schema/sh_schema.lua:381

Returns a player's work points, from their WorkPoints net var.

Parameters

  • player Player The player

Returns

  • Number The work points, 0 by default

Schema:HUDPaintEntityTargetID(entity, info)

client gamemodes/cwhl2rp/schema/cl_hooks.lua:189

Implements hook HUDPaintEntityTargetID

Called when an entity's target ID should be painted.

Draws the physical description of props and the name and title of named NPCs.

Parameters

  • entity Entity The entity being looked at
  • info Map Drawing state with x, y and alpha; y is advanced past each drawn line

Schema:HUDPaintForeground()

client gamemodes/cwhl2rp/schema/cl_hooks.lua:702

Implements hook HUDPaintForeground

Called when the foreground HUD should be painted; draws the white flash of active stun effects.

Schema:HUDPaintTopScreen(info)

client gamemodes/cwhl2rp/schema/cl_hooks.lua:731

Implements hook HUDPaintTopScreen

Called when the top of the screen HUD should be painted.

Draws the Combine display lines for Combine players, typing each line out a character per frame and removing it when it expires.

Parameters

  • info Map Drawing state with x and y; y is advanced past each line

Schema:Initialize()

client gamemodes/cwhl2rp/schema/cl_hooks.lua:12

Called when the gamemode initializes on the client.

Creates the catwork data folder and downloads the developer scoreboard icons into it with Schema:DownloadMaterial.

Schema:IsCombineFaction(faction)

shared gamemodes/cwhl2rp/schema/sh_schema.lua:332

Returns whether a faction is Civil Protection or Overwatch.

Parameters

  • faction String The faction name

Returns

  • Boolean Whether the faction is FACTION_MPF or FACTION_OTA

Schema:IsPlayerCombineRank(player, rank, realRank)

shared gamemodes/cwhl2rp/schema/sh_schema.lua:256

Returns whether a Civil Protection or Overwatch player's name contains a Combine rank.

Works like Schema:IsStringCombineRank on the player's name, and is always nil for players outside the Combine factions.

Parameters

  • player Player The player to check
  • rank String The rank, or a List of ranks of which any may match
  • realRank Boolean optional, defaults to nil When true, EpU matches only the literal EpU rank

Returns

  • Any A truthy value (true or the match position) when the player has the rank, otherwise nil

Schema:IsStringCombineRank(text, rank)

shared gamemodes/cwhl2rp/schema/sh_schema.lua:231

Returns whether a name contains a Combine rank.

Ranks appear in Combine names between punctuation, as in C24.MPF-RCT.1234. The rank EpU also matches the SeC, DvL and CmD ranks.

Parameters

  • text String The name to search
  • rank String The rank, or a List of ranks of which any may match

Returns

  • Any A truthy value (true or the match position) when the rank is found, otherwise nil

See also

Schema:IsTextEntryBeingUsed()

client gamemodes/cwhl2rp/schema/cl_schema.lua:220

Returns whether a text entry has focus and is visible.

The entry is tracked by Schema:OnTextEntryGetFocus and Schema:OnTextEntryLoseFocus.

Returns

  • Boolean true when one is in use, otherwise nil

Schema:KeyPress(player, key)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:643

Called when a player presses a key.

Use starts untying the tied player being looked at. Scanner players play a scanner sound with the attack keys, take a photo with reload (every two seconds at most) that stuns facing non-Combine players nearby, and follow the player they look at with walk (see the CharFollow command).

Parameters

  • player Player The player
  • key Number The IN_* key

Spawns the named NPCs saved for the current map by Schema:SaveNPCs.

Schema:LoadObjectives()

server gamemodes/cwhl2rp/schema/sv_schema.lua:503

Loads the Combine objectives from the objectives schema data into Schema.combineObjectives.

Schema:LoadRadios()

server gamemodes/cwhl2rp/schema/sv_schema.lua:568

Spawns the stationary radios saved for the current map by Schema:SaveRadios.

Restores each radio's owner, frequency and on/off state, and freezes radios that were frozen.

Schema:LoadRationDispensers()

server gamemodes/cwhl2rp/schema/sv_schema.lua:596

Spawns the ration dispensers saved for the current map by Schema:SaveRationDispensers.

Schema:LoadVendingMachines()

server gamemodes/cwhl2rp/schema/sv_schema.lua:633

Spawns the vending machines saved for the current map by Schema:SaveVendingMachines.

Schema:MakePlayerScanner(player, noMessage, lightSpawn)

server gamemodes/cwhl2rp/schema/sv_schema.lua:414

Turns a player into a scanner they control.

Replaces any existing scanner (see Schema:ResetPlayerScanner), spawns an npc_cscanner (or an npc_clawscanner for the SYNTH rank) that follows a marker, and makes the player spectate it with their weapons and armour stripped. The scanner's entity index is stored in the scanner net var.

Parameters

  • player Player The player
  • noMessage Boolean optional, defaults to nil Passed to Schema:ResetPlayerScanner for the old scanner
  • lightSpawn Boolean optional, defaults to nil Whether this is a light spawn; skips turning off the flashlight, unducking and the shield scanner's 200 health

Schema:OnePlayerSecond(player, curTime)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1012

Implements hook OnePlayerSecond

Called every second for each player.

Networks the custom class, citizen ID, clothes and icon character data, and progresses Strength while the player moves carrying at least a quarter of their maximum weight.

Parameters

  • player Player The player
  • curTime Number The current CurTime()

Schema:OnNPCKilled(npc, attacker, inflictor)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:153

Called when an NPC is killed.

When the NPC is a player's scanner, the player dies with it and the scanner is reset.

Parameters

  • npc NPC The NPC
  • attacker Entity The attacker
  • inflictor Entity The inflictor

Schema:OnTextEntryGetFocus(panel)

client gamemodes/cwhl2rp/schema/cl_hooks.lua:209

Called when a text entry gains focus; remembers it for Schema:IsTextEntryBeingUsed.

Parameters

  • panel Panel The focused text entry

Schema:OnTextEntryLoseFocus(panel)

client gamemodes/cwhl2rp/schema/cl_hooks.lua:215

Called when a text entry loses focus; clears the entry remembered by Schema:OnTextEntryGetFocus.

Parameters

  • panel Panel The text entry that lost focus

Schema:PermaKillPlayer(player, ragdoll)

server gamemodes/cwhl2rp/schema/sv_schema.lua:1008

Permanently kills a player's character.

Kills the player if alive and, unless the character is already permakilled, marks it permakilled and moves its inventory and cash onto the ragdoll as belongings, or into a cw_belongings entity when there is no ragdoll. Items with allowStorage = false are lost. Runs the PlayerAdjustPermaKillInfo hook with the inventory, cash and entity info, and saves the character.

Parameters

  • player Player The player
  • ragdoll Entity optional, defaults to nil The player's ragdoll, if they are already dead

Schema:PlayerAdjustCharacterScreenInfo(player, character, info)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:860

Implements hook PlayerAdjustCharacterScreenInfo

Called when a character's entry on the character screen should be adjusted.

Marks permakilled characters, shows Overwatch availability, shows the elite Overwatch and scanner models and passes on the character's custom class.

Parameters

  • player Player The player whose characters are listed
  • character Character The character
  • info Map The entry: name, faction, and details, model and customClass, which may be set

Schema:PlayerAdjustClassModelInfo(class, info)

client gamemodes/cwhl2rp/schema/cl_hooks.lua:441

Implements hook PlayerAdjustClassModelInfo

Called when the model shown for a class in the class menu should be adjusted.

Shows the scanner class with the scanner or shield scanner model.

Parameters

  • class Number The class index, compared against CLASS_MPS
  • info Map The model info; model may be replaced

Schema:PlayerAdjustColorModify(colorModify)

client gamemodes/cwhl2rp/schema/cl_hooks.lua:466

Implements hook PlayerAdjustColorModify

Called when the local player's colour modification should be adjusted.

While antidepressants are active the colours fade towards normal, and back to the default afterwards.

Parameters

  • colorModify Map $pp_colour_* values, adjusted in place

Schema:PlayerAdjustDeathInfo(player, info)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:847

Implements hook PlayerAdjustDeathInfo

Called when a player's death info should be adjusted; permakilled characters get no respawn time.

Parameters

  • player Player The player
  • info Map The death info; spawnTime may be replaced

Schema:PlayerAdjustDropWeaponInfo(player, info)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:186

Implements hook PlayerAdjustDropWeaponInfo

Called when the info of a weapon a player drops should be adjusted.

Drops the active weapon from the player's eyes and holstered weapons from where their gear model is.

Parameters

  • player Player The player
  • info Map The drop info: itemTable, and position and angles, which are set in place

Schema:PlayerAdjustMotionBlurs(motionBlurs)

client gamemodes/cwhl2rp/schema/cl_hooks.lua:275

Implements hook PlayerAdjustMotionBlurs

Called when the local player's motion blurs should be adjusted.

Adds the flash blur while a stun-style flash effect (see Schema:AddStunEffect) is active.

Parameters

  • motionBlurs Map Motion blur state; its blurTable maps blur names to amounts

Schema:PlayerAdjustRadioInfo(player, info)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:953

Implements hook PlayerAdjustRadioInfo

Called when a player's radio message info should be adjusted.

Combine players reach every Combine player; a player with a frequency also reaches untied players with a handheld radio on the same frequency.

Parameters

  • player Player The player sending the message
  • info Map The radio info; players are added to its listeners

Schema:PlayerAttributeUpdated(player, attributeTable, amount)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1159

Implements hook PlayerAttributeUpdated

Called when a player's attribute is updated; shows an attribute line on a Combine player's display.

Parameters

  • player Player The player
  • attributeTable Attribute The attribute
  • amount Number The change in the attribute

Schema:PlayerBusinessRebuilt(panel, categories)

client gamemodes/cwhl2rp/schema/cl_hooks.lua:28

Implements hook PlayerBusinessRebuilt

Called when the local player's business menu is rebuilt.

Remembers the panel in Schema.businessPanel and, when permits are enabled and the local player is a citizen, adds a permits form listing the total cost of each permit they lack (general goods and Schema.customPermits). Players without the x flag see a single entry for creating a business.

Parameters

  • panel Panel The business menu panel
  • categories List<Map> The orderable item categories, each with category and itemsList

Schema:PlayerCanBeGivenWeapon(player, class, uniqueID, forceReturn)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:813

Implements hook PlayerCanBeGivenWeapon

Called when a player attempts to be given a weapon; scanner players cannot.

Parameters

  • player Player The player
  • class String The weapon class
  • uniqueID String The item's unique ID
  • forceReturn Boolean Whether the weapon is being returned forcibly

Returns

  • Boolean false to block the weapon

Schema:PlayerCanBreachEntity(player, entity)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:503

Implements hook PlayerCanBreachEntity

Called when a player attempts to breach an entity; any real door except rotating ones may be breached.

Parameters

  • player Player The player
  • entity Entity The entity

Returns

  • Boolean Whether the entity can be breached, or nil for the default

Schema:PlayerCanChangeClass(player, class)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1303

Implements hook PlayerCanChangeClass

Called when a player attempts to change class.

Tied players cannot, and Combine players can only join the classes their rank allows; the player is told why.

Parameters

  • player Player The player
  • class Number The class index

Returns

  • Boolean false to block the change

Schema:PlayerCanDeleteCharacter(player, character)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1184

Implements hook PlayerCanDeleteCharacter

Called when a player attempts to delete a character; permakilled characters can always be deleted.

Parameters

  • player Player The player
  • character Character The character

Returns

  • Boolean true to allow the deletion, or nil for the default

Schema:PlayerCanDestroyItem(player, itemTable, noMessage)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1421

Implements hook PlayerCanDestroyItem

Called when a player attempts to destroy an item; scanners and tied players cannot.

Parameters

  • player Player The player
  • itemTable Item The item
  • noMessage Boolean Whether to skip telling the player why

Returns

  • Boolean false to block it

Schema:PlayerCanDropItem(player, itemTable, noMessage)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1442

Implements hook PlayerCanDropItem

Called when a player attempts to drop an item; scanners and tied players cannot.

Parameters

  • player Player The player
  • itemTable Item The item
  • noMessage Boolean Whether to skip telling the player why

Returns

  • Boolean false to block it

Schema:PlayerCanEarnGeneratorCash(player, info, cash)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1530

Called when a player attempts to earn cash from a generator; Combine players cannot.

Parameters

  • player Player The player
  • info Map The generator info
  • cash Number The amount

Returns

  • Boolean false to block it

Schema:PlayerCanLockEntity(player, entity)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1267

Called when a player attempts to lock an entity.

Doors with a Combine lock cannot be locked with keys while the lock is locked or the combine_lock_overrides config is enabled.

Parameters

  • player Player The player
  • entity Entity The entity

Returns

  • Boolean false to block it

Schema:PlayerCanRadio(player, text, listeners, eavesdroppers)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:543

Implements hook PlayerCanRadio

Called when a player attempts to use the radio.

Combine players and scanners can always use it; everyone else needs a handheld radio and a frequency.

Parameters

  • player Player The player
  • text String The message
  • listeners Map The players who will hear the message
  • eavesdroppers Map The players who will overhear it

Returns

  • Boolean false to block the message

Schema:PlayerCanRagdoll(player, state, delay, decay, ragdoll)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1091

Implements hook PlayerCanRagdoll

Called when a player attempts to be ragdolled; scanners cannot.

Parameters

  • player Player The player
  • state Number The RAGDOLL_* state
  • delay Number How long the ragdoll lasts
  • decay Number How long the ragdoll takes to decay
  • ragdoll Entity The existing ragdoll, if any

Returns

  • Boolean false to block it

Schema:PlayerCanRestoreRecognisedName(player, target)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:519

Implements hook PlayerCanRestoreRecognisedName

Called when a player attempts to restore a recognised name; Combine names are never restored.

Parameters

  • player Player The player
  • target Player The recognised player

Returns

  • Boolean false to forget the name

Schema:PlayerCanSaveRecognisedName(player, target)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:529

Implements hook PlayerCanSaveRecognisedName

Called when a player attempts to save a recognised name; Combine names are never saved.

Parameters

  • player Player The player
  • target Player The recognised player

Returns

  • Boolean false to not save the name

Schema:PlayerCanSeeClass(class)

client gamemodes/cwhl2rp/schema/cl_hooks.lua:502

Implements hook PlayerCanSeeClass

Called when the local player attempts to see a class in the class menu.

Hides the Combine classes whose rank the local player does not hold.

Parameters

  • class Class The class

Returns

  • Boolean false to hide the class

Schema:PlayerCanSwitchCharacter(player, character)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:834

Implements hook PlayerCanSwitchCharacter

Called when a player attempts to switch characters.

Permakilled characters can always be switched from; tied characters cannot.

Parameters

  • player Player The player
  • character Character The character to switch to

Returns

  • Boolean Whether the switch is allowed
  • String The reason when it is not

Schema:PlayerCanUnlockEntity(player, entity)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1282

Implements hook PlayerCanUnlockEntity

Called when a player attempts to unlock an entity.

Doors with a Combine lock cannot be unlocked with keys while the lock is locked or the combine_lock_overrides config is enabled.

Parameters

  • player Player The player
  • entity Entity The entity

Returns

  • Boolean false to block it

Schema:PlayerCanUseCharacter(player, character)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1197

Implements hook PlayerCanUseCharacter

Called when a player attempts to use a character.

Refuses permakilled characters, Civil Protection characters while Schema:CanUseCP is false (below rank 6) and scanner characters while three scanners are online.

Parameters

  • player Player The player
  • character Character The character

Returns

  • String The reason the character cannot be used, or nil to allow it

Schema:PlayerCanUseCommand(player, commandTable, arguments)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1238

Implements hook PlayerCanUseCommand

Called when a player attempts to use a command.

Tied players cannot order shipments, broadcast, dispatch, request or use the radio.

Parameters

  • player Player The player
  • commandTable Command The command
  • arguments List<String> The command's arguments

Returns

  • Boolean false to block the command

Schema:PlayerCanUseDoor(player, door)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1252

Implements hook PlayerCanUseDoor

Called when a player attempts to open a door with the use key.

Only untied Combine players, administrators and holders of a combine_lock_access_x card may.

Parameters

  • player Player The player
  • door Entity The door

Returns

  • Boolean false to block it

Schema:PlayerCanUseEntityInVehicle(player, entity, vehicle)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:630

Implements hook PlayerCanUseEntityInVehicle

Called when a player attempts to use an entity from a vehicle; allows players and their ragdolls.

Parameters

  • player Player The player
  • entity Entity The entity
  • vehicle Vehicle The vehicle

Returns

  • Boolean true to allow it

Schema:PlayerCanUseItem(player, itemTable, noMessage)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1466

Implements hook PlayerCanUseItem

Called when a player attempts to use an item.

Scanners and tied players cannot use items. Players can equip one secondary weapon (weight 1 to 2), one primary weapon (heavier) and one melee or light weapon (lighter than 1) at a time.

Parameters

  • player Player The player
  • itemTable Item The item
  • noMessage Boolean Whether to skip telling the player why

Returns

  • Boolean false to block it

Schema:PlayerCanZoom()

client gamemodes/cwhl2rp/schema/cl_hooks.lua:352

Implements hook PlayerCanZoom

Called when the local player attempts to zoom; only Combine players may zoom.

Returns

  • Boolean false to block the zoom

Schema:PlayerCharacterInitialized(player)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:564

Implements hook PlayerCharacterInitialized

Called when a player's character has initialized.

Puts Combine players in the class matching their rank when it has room, and adds a database line to the Combine display for citizens.

Parameters

  • player Player The player

Schema:PlayerCharacterLoaded(player)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1752

Implements hook PlayerCharacterLoaded

Called when a player's character has loaded.

Resets the permakill and tied state and networks the loyalty, criminal and work points, citizen status, residence, jail state and job from the character data.

Parameters

  • player Player The player

Schema:PlayerCharacterUnloaded(player)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1292

Implements hook PlayerCharacterUnloaded

Called when a player's character has unloaded; removes their scanner.

Parameters

  • player Player The player

Schema:PlayerDeath(player, inflictor, attacker, damageInfo)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1690

Implements hook PlayerDeath

Called when a player dies.

Combine deaths trigger the cwCTO biosignal loss and a radio announcement, and destroy the unit's scanner. Deaths at the hands of a player or NPC permakill the character when enable_permakill is on and the player lacks the d flag. Other deaths lose each item with a one in four chance and 40 to 60 percent of the cash.

Parameters

  • player Player The player
  • inflictor Entity The inflictor
  • attacker Entity The attacker
  • damageInfo CTakeDamageInfo The damage, or true when the player's scanner was destroyed

Schema:PlayerDeathThink(player)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:822

Called each frame a player is dead; permakilled characters cannot respawn.

Parameters

  • player Player The player

Returns

  • Boolean true to stop the player respawning

Schema:PlayerDestroyGenerator(player, entity, generator)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1638

Called when a player destroys a generator.

Pays a quarter of the generator's cash to the player, or to every Combine player when a Combine player destroyed it.

Parameters

  • player Player The player
  • entity Entity The generator entity
  • generator Map The generator info, with cash and name

Schema:PlayerDoesHaveFlag(player, flag)

shared gamemodes/cwhl2rp/schema/sv_hooks.lua:1141

Implements hook PlayerDoesHaveFlag

Called to check whether a player has a flag.

When permits are disabled, denies the business flag x, the general goods flag 1 and every custom permit flag.

Parameters

  • player Player The player to check
  • flag String The flag

Returns

  • Boolean false to deny the flag, or nil to leave it to the flag system

Defined in

Schema:PlayerDoesRecognisePlayer(player, target, status, isAccurate, realValue)

shared gamemodes/cwhl2rp/schema/sv_hooks.lua:1174

Implements hook PlayerDoesRecognisePlayer

On the server

Called to check whether a player recognises another player.

Combine players and administrators are always recognised.

Parameters

  • player Player The player who may recognise the target
  • target Player The player to be recognised
  • status Number The RECOGNISE_* level being checked
  • isAccurate Boolean Whether the level must match exactly
  • realValue Boolean The result of the recognition system

Returns

  • Boolean true to recognise the target, or nil to keep realValue

On the client

Called to check whether the local player recognises another player.

Combine players and administrators are always recognised.

Parameters

  • player Player The player to be recognised
  • status Number The RECOGNISE_* level being checked
  • isAccurate Boolean Whether the level must match exactly
  • realValue Boolean The result of the recognition system

Returns

  • Boolean true to recognise the player, or nil to keep realValue

Defined in

Schema:PlayerFinishTypingDisplay(player, textTyped)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:311

Implements hook PlayerFinishTypingDisplay

Called when a player stops typing; plays the radio-off sound for Combine players who sent a message.

Parameters

  • player Player The player
  • textTyped Boolean Whether the player sent a message

Schema:PlayerFootstep(player, position, foot, sound, volume, recipientFilter)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:2143

Called when a player's footstep sound should be played.

Running Civil Protection and Overwatch players play gear sounds; everyone else plays the normal sound.

Parameters

  • player Player The player
  • position Vector The footstep position
  • foot Number 0 for the left foot, 1 for the right
  • sound String The default sound
  • volume Number The default volume
  • recipientFilter CRecipientFilter Who would hear the sound

Returns

  • Boolean Always true, replacing the engine's sound

Schema:PlayerGetLocation(player)

server gamemodes/cwhl2rp/schema/sv_schema.lua:774

Returns the name of the area a player is in, using the Area Names plugin.

When the player is in no area, the area whose minimum corner is closest is used. A leading "the " is removed from the name.

Parameters

  • player Player The player

Returns

  • String The area name, or '#Location_Unknown' without the plugin or any areas

Schema:PlayerGiveWeapons(player)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:357

Implements hook PlayerGiveWeapons

Called when a player's spawn weapons should be given.

Gives GHOST units a sniper rifle, vortigaunts their vortigaunt weapon and enslaved vortigaunts a broom.

Parameters

  • player Player The player

Schema:PlayerHasUnknownInventoryItem(player, inventory, item, amount)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:245

Called when a player's inventory contains an item that no longer exists.

Replaces the old radio item with handheld_radio.

Parameters

  • player Player The player
  • inventory Inventory The inventory being restored
  • item String The unique ID of the unknown item
  • amount Number How many of the item there are

Schema:PlayerHealed(player, healer, itemTable)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:993

Implements hook PlayerHealed

Called when a player has been healed.

Boosts the healer's Agility and progresses their Medical attribute, more for a health kit than a health vial and least for a bandage.

Parameters

  • player Player The player who was healed
  • healer Player The player who healed them
  • itemTable Item The item used

Schema:PlayerHealthSet(player, newHealth, oldHealth)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:799

Implements hook PlayerHealthSet

Called when a player's health is set; copies it to their scanner.

Parameters

  • player Player The player
  • newHealth Number The new health
  • oldHealth Number The old health

Schema:PlayerInitialSpawn(player, bOneWay)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:12

Called when a player first spawns; exchanges custom scoreboard icons with them two seconds later.

Parameters

  • player Player The player
  • bOneWay Boolean Unused

Schema:PlayerInventoryItemUpdated(player, itemTable, amount, force)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:376

Called when an item in a player's inventory is updated.

Takes off the player's clothes when they no longer have the clothes item.

Parameters

  • player Player The player
  • itemTable Item The item
  • amount Number The change in amount
  • force Boolean Whether the update was forced

Schema:PlayerIsCombine(player)

shared gamemodes/cwhl2rp/schema/sv_schema.lua:843

On the server

Returns whether a player is Combine, using Player:IsCombine.

Parameters

  • player Player The player to check

Returns

  • Boolean Whether the player is Combine, or nil for an invalid player

On the client

Returns whether a player is Combine, using Player:IsCombine.

Parameters

  • player Player The player to check
  • bHuman Boolean optional, defaults to nil Unused

Returns

  • Boolean Whether the player is Combine, or nil for an invalid player

Defined in

Schema:PlayerIsCWU(player)

server gamemodes/cwhl2rp/schema/sv_schema.lua:852

Returns whether a player's character belongs to the Civil Workers' Union.

Parameters

  • player Player The player to check

Returns

  • Boolean Whether the player is in FACTION_CWU, or nil without a valid player and character

Schema:PlayerIsLoyalistTier(player, tier)

shared gamemodes/cwhl2rp/schema/sh_schema.lua:171

Returns whether the tier of a player's loyalty points has a name containing the given text.

The comparison is case-insensitive and uses the LoyaltyPoints character data. Tier names are language keys such as #Loyalist_Grey, so 'grey' matches the first tier.

Parameters

  • player Player The player to check
  • tier String Text to look for in the tier name, used as a Lua pattern

Returns

  • Number The position of the match, or nil when the name does not contain it

Schema:PlayerLimbDamageHealed(player, hitGroup, amount)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1899

Implements hook PlayerLimbDamageHealed

Called when a player's limb damage is healed; removes the limb's attribute penalties.

Parameters

  • player Player The player
  • hitGroup Number The HITGROUP_* limb
  • amount Number The amount healed

Schema:PlayerLimbDamageReset(player)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1914

Implements hook PlayerLimbDamageReset

Called when a player's limb damage is reset; removes every limb damage attribute penalty.

Parameters

  • player Player The player

Schema:PlayerLimbTakeDamage(player, hitGroup, damage)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1925

Implements hook PlayerLimbTakeDamage

Called when a player's limb takes damage.

Lowers the attributes the limb affects by its damage: Medical for the head, Endurance for the body, Agility for the legs and Agility and Strength for the arms.

Parameters

  • player Player The player
  • hitGroup Number The HITGROUP_* limb
  • damage Number The damage taken

Schema:PlayerNameChanged(player, previousName, newName)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:595

Implements hook PlayerNameChanged

Called when a player's name changes.

Moves Combine players to the class of a newly gained rank. Civil Protection units who become scanners are turned into one with Schema:MakePlayerScanner.

Parameters

  • player Player The player
  • previousName String The old name
  • newName String The new name

Schema:PlayerNoClip(player)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1100

Called when a player attempts to noclip; scanners cannot.

Parameters

  • player Player The player

Returns

  • Boolean false to block it

Schema:PlayerPlayDeathSound(player, gender)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1565

Implements hook PlayerPlayDeathSound

Called when a player's death sound should be played.

For Combine players whose biosignal is still active, every such Combine player hears the lost biosignal announcement with the digits among the last three characters of the dead unit's name.

Parameters

  • player Player The player
  • gender String The player's gender

Returns

  • String A Civil Protection death sound, or nil for the default

Schema:PlayerPlayPainSound(player, gender, damageInfo, hitGroup)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1609

Implements hook PlayerPlayPainSound

Called when a player's pain sound should be played; Combine players use Civil Protection sounds.

Parameters

  • player Player The player
  • gender String The player's gender
  • damageInfo CTakeDamageInfo The damage
  • hitGroup Number The HITGROUP_* hit

Returns

  • String The sound, or nil for the default

Schema:PlayerPunchEntity(player, entity)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1847

Implements hook PlayerPunchEntity

Called when a player punches an entity; progresses Strength, twice as much for players and NPCs.

Parameters

  • player Player The player
  • entity Entity The entity

Schema:PlayerPunchThrown(player)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1840

Implements hook PlayerPunchThrown

Called when a player throws a punch; progresses their Strength.

Parameters

  • player Player The player

Schema:PlayerRadioUsed(player, text, listeners, eavesdroppers)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:899

Implements hook PlayerRadioUsed

Called after a player has used the radio.

Sends the message to players near switched-on stationary radios tuned to the player's frequency, within twice the talk radius, unless they heard or overheard it already.

Parameters

  • player Player The player
  • text String The message
  • listeners List<Player> The players who heard the message
  • eavesdroppers List<Player> The players who overheard it

Schema:PlayerRestoreCharacterData(player, data)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:491

Implements hook PlayerRestoreCharacterData

Called when a player's character data is restored.

Gives non-Combine characters a random five-digit citizen ID when they have none, or an old four-digit one.

Parameters

  • player Player The player
  • data Map The character data, changed in place

Schema:PlayerRestoreData(player, data)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1120

Implements hook PlayerRestoreData

Called when a player's data is restored.

Kicks players missing from the whitelist named by the server_whitelist_identity config, when set.

Parameters

  • player Player The player
  • data Map The player data; serverwhitelist is created when missing

Schema:PlayerSaveData(player, data)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1109

Implements hook PlayerSaveData

Called when a player's data should be saved; drops an empty server whitelist.

Parameters

  • player Player The player
  • data Map The player data, changed in place

Schema:PlayerScaleDamageByHitGroup(player, attacker, hitGroup, damageInfo, baseDamage)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1949

Implements hook PlayerScaleDamageByHitGroup

Called when a player's damage should be scaled by hit group.

Scales damage by 1.5 minus up to 0.75 for Endurance, and reduces bullet damage by the protection of the clothes the player wears.

Parameters

  • player Player The player
  • attacker Entity The attacker
  • hitGroup Number The HITGROUP_* hit
  • damageInfo CTakeDamageInfo The damage, scaled in place
  • baseDamage Number The damage before scaling

Schema:PlayerSetDefaultColorModify(colorModify)

client gamemodes/cwhl2rp/schema/cl_hooks.lua:456

Implements hook PlayerSetDefaultColorModify

Called when the local player's default colour modification should be set.

Darkens and desaturates the screen for the schema's look.

Parameters

  • colorModify Map $pp_colour_* values, set in place

Schema:PlayerSpawnObject(player)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:477

Called when a player attempts to spawn an object; tied players and scanners cannot.

Parameters

  • player Player The player

Returns

  • Boolean false to block the spawn

Schema:PlayerSpawnProp(player, model)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:448

Called when a player attempts to spawn a prop.

While the cwu_props config is enabled, citizens outside the Civil Worker's Union cannot spawn beds or the furniture in Schema.cwuProps. Admins are exempt.

Parameters

  • player Player The player
  • model String The prop's model

Returns

  • Boolean false to block the spawn

Schema:PlayerSpray(player)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:415

Called when a player attempts to spray; only untied players with a spray can may spray.

Parameters

  • player Player The player

Returns

  • Boolean true to block the spray

Schema:PlayerStartTypingDisplay(player, code)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:296

Implements hook PlayerStartTypingDisplay

Called when a player starts typing; plays the radio-on sound for Combine players typing a message.

Parameters

  • player Player The player
  • code String The typing display code, such as 'n' for normal speech or 'r' for the radio

Schema:PlayerStorageShouldClose(player, storage)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:404

Implements hook PlayerStorageShouldClose

Called to check whether a player's storage should close.

Closes a search of another player once the searched player is no longer tied.

Parameters

  • player Player The player
  • storage Map The open storage

Returns

  • Boolean true to close the storage

Schema:PlayerStunEntity(player, entity)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:327

Implements hook PlayerStunEntity

Called when a player hits an entity with a stunstick.

Progresses the player's Strength and punches the view of a hit player. Four hits less than two seconds apart knock the target out for the knockout_time config value.

Parameters

  • player Player The player with the stunstick
  • entity Entity The entity that was hit

Schema:PlayerSwitchFlashlight(player, on)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:392

Called when a player switches their flashlight; scanner players and tied players cannot turn it on.

Parameters

  • player Player The player
  • on Boolean Whether the flashlight is being turned on

Returns

  • Boolean false to block the switch

Schema:PlayerTakeDamage(player, inflictor, attacker, hitGroup, damageInfo)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1887

Implements hook PlayerTakeDamage

Called when a player takes damage; stuns their view, longer when they have armour.

Parameters

  • player Player The player
  • inflictor Entity The inflictor
  • attacker Entity The attacker
  • hitGroup Number The HITGROUP_* hit
  • damageInfo CTakeDamageInfo The damage

Schema:PlayerThink(player, curTime, infoTable)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1035

Implements hook PlayerThink

Called at an interval while a player is connected.

Progresses Agility while jumping or running, runs Schema:CalculateScannerThink for scanners, and raises carry weight, jump power and run speed from the Strength and Agility attributes. Combine players carry 8 more.

Parameters

  • player Player The player
  • curTime Number The current CurTime()
  • infoTable Map The player's movement info, adjusted in place

Schema:PlayerUse(player, entity)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1351

Implements hook PlayerUse

Called when a player attempts to use an entity.

Restricts entities whose overlay text contains CA, OTA, MPF or CWU to those factions (and those above them), and blocks scanners, busted-down doors and tied players (who may still use seats). Sprint and use toggles a door's Combine lock for players with access, every three seconds at most.

Parameters

  • player Player The player
  • entity Entity The entity

Returns

  • Boolean false to block the use

Schema:PlayerUseDoor(player, door)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:222

Implements hook PlayerUseDoor

Called when a player uses a door.

On rp_c18_v1, closes certain doors automatically ten seconds after they are used.

Parameters

  • player Player The player
  • door Entity The door

Schema:PlayerWearClothes(player, itemTable, noMessage)

server gamemodes/cwhl2rp/schema/sv_schema.lua:899

Puts clothes on a player, or takes off the clothes they wear.

Clothes are only put on when the player's class has no model of its own. The worn item is stored in the clothes character data and net var, and the item's OnChangeClothes is called.

Parameters

  • player Player The player
  • itemTable Item optional, defaults to nil The clothes to wear; nil takes off the current clothes
  • noMessage Boolean optional, defaults to nil Unused

Schema:PostPlayerLightSpawn(player, weapons, ammo, special)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1826

Implements hook PostPlayerLightSpawn

Called after a player light-spawns; reapplies the clothes they wear.

Parameters

  • player Player The player
  • weapons Boolean Whether weapons were restored
  • ammo Boolean Whether ammunition was restored
  • special Boolean Whether this was a special light spawn

Schema:PostPlayerSpawn(player, lightSpawn, changeClass, firstSpawn)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:1773

Implements hook PostPlayerSpawn

Called just after a player spawns.

On a full spawn, clears effects and searches and gives Combine and administrators their armour (and Overwatch 150 health). Turns scanner ranks into scanners, re-ties tied players and puts worn clothes back on.

Parameters

  • player Player The player
  • lightSpawn Boolean Whether this is a light spawn
  • changeClass Boolean Whether the player changed class
  • firstSpawn Boolean Whether this is the character's first spawn

Schema:PostSaveData()

server gamemodes/cwhl2rp/schema/sv_hooks.lua:37

Implements hook PostSaveData

Called just after data has been saved.

Saves the ration dispensers, vending machines, radios and named NPCs of the current map.

Schema:RegisterVoiceGroups(voices)

shared gamemodes/cwhl2rp/schema/libraries/sh_voices.lua:13

Implements hook RegisterVoiceGroups

Called when voice groups should be registered.

Adds the Combine and Dispatch groups for Combine players and the gendered Human group for everyone else.

Parameters

Schema:RegisterVoices(voices)

shared gamemodes/cwhl2rp/schema/libraries/sh_voices.lua:32

Implements hook RegisterVoices

Called when voices should be registered.

Adds the schema's Dispatch announcements, Combine lines and human lines, each with its chat command, phrase and Half-Life 2 sound; human lines also have a female sound.

Parameters

Schema:RenderScreenspaceEffects()

client gamemodes/cwhl2rp/schema/cl_hooks.lua:235

Called when screen space effects should be rendered.

Draws the colour shift and motion blur of an active flash effect and the Combine visor overlay for Combine players, unless the screen is faded to black.

Schema:ResetPlayerScanner(player, noMessage)

server gamemodes/cwhl2rp/schema/sv_schema.lua:380

Removes a player's scanner and its follow marker; does nothing when they have none.

Unless noMessage is set, the player is also returned to walking, stops spectating and is killed silently.

Parameters

  • player Player The player controlling the scanner
  • noMessage Boolean optional, defaults to nil Only remove the entities, leaving the player as they are

Schema:SaveData()

server gamemodes/cwhl2rp/schema/sv_hooks.lua:32

Implements hook SaveData

Called when data should be saved; the schema saves its entities in Schema:PostSaveData instead.

Saves every NPC with a name and title (set with the SetNPCName command) for the current map.

Schema:SaveRadios()

server gamemodes/cwhl2rp/schema/sv_schema.lua:666

Saves the position, owner, frequency and state of every stationary radio for the current map.

Schema:SaveRationDispensers()

server gamemodes/cwhl2rp/schema/sv_schema.lua:618

Saves the position, angles and lock state of every ration dispenser for the current map.

Schema:SaveVendingMachines()

server gamemodes/cwhl2rp/schema/sv_schema.lua:650

Saves the position, angles and stock of every vending machine for the current map.

Schema:SayBroadcast(player, text)

server gamemodes/cwhl2rp/schema/sv_schema.lua:812

Sends a broadcast message from a player to everyone.

Parameters

  • player Player The player broadcasting
  • text String The message

Schema:SayDispatch(player, text)

server gamemodes/cwhl2rp/schema/sv_schema.lua:826

Sends a message to everyone under the name of Dispatch.

Parameters

  • player Player The player sending the message
  • text String The message

Schema:SayRequest(player, text)

server gamemodes/cwhl2rp/schema/sv_schema.lua:697

Sends a message through a player's request device.

The request is shown on the Combine display and sent to Combine players, administrators, CWU and anyone carrying a request device. When a citizen sends it, nearby citizens overhear it.

Parameters

  • player Player The player sending the request
  • text String The message

Schema:ScoreboardAdjustPlayerInfo(info)

client gamemodes/cwhl2rp/schema/cl_hooks.lua:426

Implements hook ScoreboardAdjustPlayerInfo

Called when a player's scoreboard info should be adjusted.

Shows scanner units with the scanner or shield scanner model.

Parameters

  • info Map The scoreboard entry; player is the player and model may be replaced

Schema:ScoreboardSortClassPlayers(class, a, b)

client gamemodes/cwhl2rp/schema/cl_hooks.lua:308

Implements hook ScoreboardSortClassPlayers

Called when the players of a scoreboard class should be sorted.

Sorts Civil Protection and Overwatch players by Combine rank, then by name.

Parameters

  • class String The scoreboard class name
  • a Player The first player to compare
  • b Player The second player to compare

Returns

  • Boolean Whether a comes before b, or nil for other classes

Schema:SendIconData(player, bOneWay)

server gamemodes/cwhl2rp/schema/sv_schema.lua:198

Sends custom scoreboard icons over the PlayerSetCustomIcon Cable message.

The player's own CustomIcon data is sent to everyone; unless bOneWay is set, every other player's icon is then sent to this player, as needed when they have just connected.

Parameters

  • player Player The player whose icon is sent
  • bOneWay Boolean optional, defaults to nil Only broadcast this player's icon, and make clients re-download it

Schema:SetCitizenStatus(player, status)

server gamemodes/cwhl2rp/schema/sv_schema.lua:292

Sets a player's citizen status in their character data and CitizenStatus net var.

Parameters

  • player Player The player
  • status String A key of Schema.CitizenStates; any other value is stored as 'Unknown'

Schema:SetCP(player, amt)

server gamemodes/cwhl2rp/schema/sv_schema.lua:244

Sets a player's criminal points, rounded, in their character data and CriminalPoints net var.

Parameters

  • player Player The player
  • amt Number The new amount; numeric strings are converted, anything else is ignored

Schema:SetJailed(player, value)

server gamemodes/cwhl2rp/schema/sv_schema.lua:310

Sets whether a player is jailed, in their character data and Jailed net var.

Parameters

  • player Player The player
  • value Boolean Whether the player is jailed; converted with tobool

Schema:SetJob(player, value)

server gamemodes/cwhl2rp/schema/sv_schema.lua:320

Sets a player's job in their character data and Job net var.

Parameters

  • player Player The player
  • value String The job

Schema:SetLP(player, amt)

server gamemodes/cwhl2rp/schema/sv_schema.lua:232

Sets a player's loyalty points, rounded, in their character data and LoyaltyPoints net var.

Parameters

  • player Player The player
  • amt Number The new amount; numeric strings are converted, anything else is ignored

Schema:SetResidence(player, value)

server gamemodes/cwhl2rp/schema/sv_schema.lua:302

Sets a player's residence in their character data and Residence net var.

Parameters

  • player Player The player
  • value String The residence

Schema:SetupPlayerVisibility(player)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:171

Called when a player's visibility is set up; adds a scanner player's scanner to their PVS.

Parameters

  • player Player The player

Schema:SetWorkPoints(player, value)

server gamemodes/cwhl2rp/schema/sv_schema.lua:328

Sets a player's work points, rounded, in their character data and WorkPoints net var.

Parameters

  • player Player The player
  • value Number The new amount; numeric strings are converted, anything else is ignored

Schema:ShowSpare1(player)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:423

Called when a player presses F3; uses the player's zip tie, or tells them they have none.

Parameters

  • player Player The player

Schema:ShowSpare2(player)

server gamemodes/cwhl2rp/schema/sv_hooks.lua:437

Called when a player presses F4; runs the CharSearch command.

Parameters

  • player Player The player

Schema:SubstractCP(player, amt)

server gamemodes/cwhl2rp/schema/sv_schema.lua:285

Subtracts from a player's criminal points with Schema:AddCP.

Parameters

  • player Player The player
  • amt Number The amount to subtract

Schema:SubstractLP(player, amt)

server gamemodes/cwhl2rp/schema/sv_schema.lua:278

Subtracts from a player's loyalty points with Schema:AddLP.

Parameters

  • player Player The player
  • amt Number The amount to subtract

On the server

Called every tick.

Moves each scanner's follow marker while its player holds forward (slower with sprint), replaces a scanner whose class no longer matches its player's SYNTH rank and removes the scanners of players who left.

On the client

Called every tick.

For Combine players, adds Combine display lines when health or armour changes and a random display line every three seconds.

Defined in

Schema:TiePlayer(player, isTied, reset, combine)

server gamemodes/cwhl2rp/schema/sv_schema.lua:1067

Ties or unties a player.

Sets the tied net var to 0 (untied), 1 (tied) or 2 (tied by the Combine). Tying drops and strips the player's weapons; untying light-spawns them to give their weapons back. Both are logged.

Parameters

  • player Player The player
  • isTied Boolean Whether to tie the player
  • reset Boolean optional, defaults to nil When untying, skip the light spawn and the log entry
  • combine Boolean optional, defaults to nil Whether the Combine tied the player

Defined in