Hooks hooks
Part of Flow
Hooks called by Flow
Summary
Hooks
immunity set is about to be run on, when the command was not run from the server console.DrawPlayerTargetID does not apply to it and it has no DrawTargetID method of its own.Entity:freeze, on the realm that function was called on (it is meant for the server).Entity:unfreeze, on the realm that function was called on (it is meant for the server).Initialize handler, on both realms.InitPostEntity handler, right after LoadData, on both realms.spawn_sweps permission.PlayerShouldTakeDamage handler, when a player is about to take damage from an attacker.spawn_entities permission.spawn_npcs permission.spawn_entities permission.spawn_props permission.spawn_ragdolls permission.spawn_entities permission.spawn_sweps permission.spawn_vehicles permission.data_save_interval seconds unless FLShouldSaveData returns false, when the server shuts down or changes the map, and by the restart command of the admin plugin.ClientIncludedSchema there).FluxPackageLoaded and after a Lua refresh, once the shared data, the settings and the language phrases have been written.t translates to has changed, because the player picked another one with Flux.Lang:set_language or changed the language of the game.Log:replicate arrives, before it is output.Flux.Command:create.PersistenceSave hook, which saves the persistent entities.user role and right before it is saved.PlayerDisconnected hook, which the game only runs on the server.PlayerInitialSpawn hook, which the game only runs on the server.Flux.Lang:set_language, or else the language of their game.PlayerThink.actor.record.PlayerSetModel hook, run by Flux on the server every time a player spawns, before the rest of their state is reset.Initialized variable.EntityTakeDamage handler.spawnmenu_reload console command.PopulateToolMenu hook, run once more by Flux on the client when the server has initialized the local player, after the spawn menu reload has been requested.SaveData handler has run.Player:save_player has saved the database record of a player.GetDrawPlayerInfo and before they are drawn.Player:save_player saves the database record of a player.FLSaveData handler after the config has been saved.gmod_undo).Tool:CreateConVars.Hooks
Called on the server when the client of a player reports that it has included the
schema files. FluxClientSchemaLoaded is its client-side counterpart.
Parameters
- actor Player The player whose client has loaded the schema
Call sites
Called for every player a command with immunity set is about to be run on, when
the command was not run from the server console. The actor themselves can be among
the targets; the admin plugin's handler always lets that pass, and lets root players
target anyone.
Parameters
- actor Player Player who runs the command
- target Player Player the command targets
- can_equal Boolean The command's
can_equalsetting: whether a target of the same standing as the actor may be affected
Returns
- Boolean Return false if the target is immune to the actor; the command is then not run and the actor is notified
Called from
find_targets
Call sites
Called on the client when the local player presses the use key on an entity that is not a player, to fill the interaction menu. The menu opens in the middle of the screen if a handler has added anything to it and is removed otherwise. The server triggers this at most once a second for each player.
Parameters
- menu Panel The
DermaMenuto add options to - entity Entity The entity being used
Call sites
Called on the client when the local player presses the use key on another player, to fill the interaction menu. The menu opens in the middle of the screen if a handler has added anything to it and is removed otherwise. The server triggers this at most once a second for each player.
Parameters
- menu Panel The
DermaMenuto add options to - target Player The player being used
Call sites
Called on the client every frame to draw the target ID of the entity that the local
player is looking at, or has closest to the crosshair, when DrawPlayerTargetID
does not apply to it and it has no DrawTargetID method of its own. Nothing is
drawn unless a handler does it.
Parameters
- entity Entity The entity being looked at
- x Number Screen x of the point above the entity to center the text on
- y Number Screen y of that point
- distance Number Distance from the camera to the entity in units
Called from
Call sites
Called on the client every frame to draw the target ID of the player that the local
player is looking at, or has closest to the crosshair. Only happens while the local
player is alive and for targets that are alive, initialized and not obstructed. The
gamemode's handler draws the lines collected with GetDrawPlayerInfo.
Parameters
- target Player The player being looked at
- x Number Screen x of the point above the target to center the text on
- y Number Screen y of that point
- distance Number Distance from the camera to the target's eyes in units
Called from
Call sites
Called after an entity has been frozen with Entity:freeze, on the realm that
function was called on (it is meant for the server).
Parameters
- entity Entity The entity that has been frozen; can be a player
Called from
Call sites
Called after an entity has been unfrozen with Entity:unfreeze, on the realm that
function was called on (it is meant for the server).
Parameters
- entity Entity The entity that has been unfrozen; can be a player
Called from
Call sites
Lets plugins set the damage a player takes from a fall. Called on the server from the
gamemode's GetFallDamage handler.
Parameters
- actor Player The player who has hit the ground
- speed Number Speed at which the player hit the ground
Returns
- Number Damage to deal; when nothing or false is returned, the damage is calculated from the speed
Called from
Call sites
Called on the client every frame while the local player is alive and the HUD is
shown, for drawing HUD elements. Runs after the damage flash and before the info
displays (InfoDisplay) and the top bars (Flux.Bars) are drawn. The gamemode's
handler draws the circular action indicator.
Parameters
- cur_time Number CurTime() of the frame
- scrw Number Screen width
- scrh Number Screen height
Returns
- Boolean Return true to keep the info displays and the top bars from being drawn
Called from
Call sites
Called at the end of the gamemode's Initialize handler, on both realms.
On the server the config has been loaded, the connection to the database has been
started and the Discord webhooks from the settings have been registered by then.
Called from
Call sites
Called at the end of the gamemode's InitPostEntity handler, right after LoadData,
on both realms. The Flux tools have been registered with the tool gun by then, and on
the client the PLAYER global has been set. Gamemode (GM) handlers are not called.
Called from
Call sites
Called on the server when a player tries to give themselves a weapon from the spawn
menu, after the gamemode has checked that they have the spawn_sweps permission.
Parameters
- actor Player The player taking the weapon
- weapon String Class of the weapon
- swep Map Information about the weapon from the weapon list
Returns
- Boolean Return false to prevent the weapon from being given
Called from
Call sites
Called on the server from the gamemode's PlayerShouldTakeDamage handler, when a
player is about to take damage from an attacker.
Parameters
- victim Player The player about to take damage
- attacker Entity The entity dealing the damage
Returns
- Boolean Return false to prevent the damage. The player takes the damage when anything else or nothing is returned
Called from
Call sites
Called on the server when a player tries to spawn an effect, after the gamemode has
checked that they have the spawn_entities permission.
Parameters
- actor Player The player spawning the effect
- model String Model of the effect
Returns
- Boolean Return false to prevent the effect from being spawned
Called from
Call sites
Called on the server when a player tries to spawn an NPC, after the gamemode has
checked that they have the spawn_npcs permission.
Parameters
- actor Player The player spawning the NPC
- npc String Type of the NPC
- weapon String Class of the weapon given to the NPC
Returns
- Boolean Return false to prevent the NPC from being spawned
Called from
Call sites
Called on the server when a player tries to spawn a prop, a ragdoll or an effect,
after the gamemode has checked that they have the spawn_entities permission.
Parameters
- actor Player The player spawning the object
- model String Model of the object
- skin Number Skin of the object
Returns
- Boolean Return false to prevent the object from being spawned
Called from
Call sites
Called on the server when a player tries to spawn a prop, after the gamemode has
checked that they have the spawn_props permission.
Parameters
- actor Player The player spawning the prop
- model String Model of the prop
Returns
- Boolean Return false to prevent the prop from being spawned
Called from
Call sites
Called on the server when a player tries to spawn a ragdoll, after the gamemode has
checked that they have the spawn_ragdolls permission.
Parameters
- actor Player The player spawning the ragdoll
- model String Model of the ragdoll
Returns
- Boolean Return false to prevent the ragdoll from being spawned
Called from
Call sites
Called on the server when a player tries to spawn a scripted entity, after the
gamemode has checked that they have the spawn_entities permission.
Parameters
- actor Player The player spawning the entity
- class String Class of the entity
Returns
- Boolean Return false to prevent the entity from being spawned
Called from
Call sites
Called on the server when a player tries to spawn a weapon, after the gamemode has
checked that they have the spawn_sweps permission.
Parameters
- actor Player The player spawning the weapon
- weapon String Class of the weapon
- swep Map Information about the weapon from the weapon list
Returns
- Boolean Return false to prevent the weapon from being spawned
Called from
Call sites
Called on the server when a player tries to spawn a vehicle, after the gamemode has
checked that they have the spawn_vehicles permission.
Parameters
- actor Player The player spawning the vehicle
- model String Model of the vehicle
- name String Name of the vehicle in the vehicle list
- tab Map Vehicle table from the vehicle list
Returns
- Boolean Return false to prevent the vehicle from being spawned
Called from
Call sites
Called on the server when all persistent data has to be saved: every
data_save_interval seconds unless FLShouldSaveData returns false, when the
server shuts down or changes the map, and by the restart command of the admin
plugin. The gamemode's handler saves the config and runs SaveData, which is the
hook that plugins normally implement, followed by PostSaveData.
Called from
Call sites
Asks whether the periodic data save may happen now. Called on the server every
data_save_interval seconds (360 unless configured), for the first time about ten
seconds after the server has started.
Returns
- Boolean Return false to skip this save
Called from
Call sites
Called on the client shortly after the schema files have been included, right after
the server has been told about it (which runs ClientIncludedSchema there). The
gamemode's handler creates the fonts.
Call sites
Called on the server while the files that get sent to the clients are written, on
FluxPackageLoaded and after a Lua refresh, once the shared data, the settings and
the language phrases have been written. Packages and plugins that generate clientside
code of their own, such as the compiled templates of Lumen, write it here with
Flux.write_client_file.
Called from
write_client_files
Call sites
Collects the lines of text shown in the target ID of a player. Called on the client
every frame the gamemode draws a player's target ID. Handlers add their entries to
lines and should not return anything, so that the other handlers run too; the
gamemode's handler adds the name line.
Parameters
- target Player The player being looked at
- x Number Screen x of the target ID
- y Number Screen y of the target ID
- distance Number Distance to the player in units
- lines Map Lines to draw by ID. Each one is a table with the
textandpriorityfields (lines with a lower priority are drawn first) and optionallycolor(white by default),font,offset_xandoffset_y
Called from
Call sites
Lets plugins give a display name to an entity that is not a player. Called on
both realms by Entity:get_name, and on the client for entities passed as
arguments of a notification.
Parameters
- entity Entity The entity whose name is requested
Returns
- String Name to show; when nothing is returned, the string representation of the entity is used
Called from
Call sites
Lets plugins replace the status text and the progress shown on the loading screen.
Called on the client every frame while the loading screen is drawn. Gamemode (GM)
handlers are not called.
Returns
- String Text to show instead of the default status
- Number Progress of the bar from 0 to 100; optional and only used along with a text
Called from
Call sites
Lets plugins replace the name a player is shown under, for example with the name of
their character. Called on both realms whenever the name of a player is requested
with Player:Name (unless the true name is forced) or Entity:get_name, and on the
client for players passed as arguments of a notification. Inside a handler, use
target:name(true) to get the unmodified name: target:name() would run the hook
again.
Parameters
- target Player The player whose name is requested
Returns
- String Name to show; when nothing is returned, the player's
namenetworked variable or else their Steam name is used
Called from
Call sites
Called twice a second on both realms.
Call sites
Called on the client every frame while the local player is dead, before the theme paints the death screen, for drawing behind it. The gamemode's handler draws a red blood overlay.
Parameters
- cur_time Number CurTime() of the frame
- scrw Number Screen width
- scrh Number Screen height
Called from
Call sites
Called on the client every frame while the local player is dead, after the theme has painted the death screen, for drawing on top of it.
Parameters
- cur_time Number CurTime() of the frame
- scrw Number Screen width
- scrh Number Screen height
Called from
Call sites
Called on the client when the language that t translates to has changed, because
the player picked another one with Flux.Lang:set_language or changed the language
of the game. Interface elements that keep translated text can rebuild it here.
Parameters
- new_lang String New language code
- old_lang String Previous language code
Called from
apply_language
Call sites
Called eight times a second on both realms. A cheaper alternative to Tick and
Think for work that has to happen often, but not on every tick or frame.
Call sites
Called once the map's entities have been created, for plugins to load their saved
data. Runs on both realms, from the server-side and from the client-side
InitPostEntity handler of the gamemode. The counterpart of SaveData, which only
runs on the server.
Called from
Call sites
Called on the client when a log entry sent with Log:replicate arrives, before it is
output. Gamemode (GM) handlers are not called.
Parameters
- message String Text of the entry
- action String Type of the logged event in snake_case; empty if there is none
- object String/Number Who or what performed the action
- subject String/Number Who or what the action was performed on
- data Map How the server has output the entry:
typeis 'print', 'colored' or 'write' (an entry without output), andcoloris the console color of a colored entry
Returns
- Any Return any non-nil value to prevent the default output of the entry
Call sites
Asks whether a player should use the raised weapon animations of their model.
Called on both realms whenever the gamemode translates a movement activity of a
player who is on the ground and whose model has a Flux animation table. Gamemode
(GM) handlers are not called.
Parameters
- actor Player The player being animated
- model String Path of the model the player's animation table belongs to
Returns
- Boolean Return true to use the raised animations; the lowered ones are used when nothing or false is returned
Called from
Call sites
Called on the server and the client after a command has been registered with
Flux.Command:create.
Parameters
- id String command ID
- data Command the command, with the defaults filled in; its subcommands are in
Command:get_subcommands
Called from
Call sites
Called once a minute on both realms.
Call sites
Called once a second on both realms. On the server the gamemode's handler uses it to
trigger the periodic data save (FLSaveData) and the restart of an empty server.
Call sites
Called on the client when the screen resolution has changed. The gamemode checks the resolution once a second; Active UI recreates the fonts from this hook.
Parameters
- new_w Number New screen width
- new_h Number New screen height
- old_w Number Previous screen width
- old_h Number Previous screen height
Called from
Call sites
Sandbox's PersistenceSave hook, which saves the persistent entities. Flux runs it
on demand from the fl_save_pers console command, on the server and in development
only.
Call sites
Asks whether a player who lacks the physgun_freeze permission may freeze an entity with the physics gun all the same, for instance because they own it. Called on the server after every OnPhysgunFreeze handler has had the chance to refuse.
Parameters
- actor Player The player holding the physics gun
- entity Entity The entity being frozen
Returns
- Boolean Return true to allow the freeze
Called from
Call sites
Asks whether a player who lacks the physgun_pickup permission may pick an entity up with the physics gun all the same, for instance because they own it. Called on both the server and the client after every PhysgunPickup handler has had the chance to refuse.
Parameters
- actor Player The player holding the physics gun
- entity Entity The entity being picked up
Returns
- Boolean Return true to allow the pickup
Called from
Call sites
Called on the server when a player is about to run a command, after the permission check has passed and before the arguments are checked. The player is not told when a handler stops the command, so the handler should notify them.
Parameters
- actor Player the player who runs the command, an invalid entity for the server console
- cmd_table Command the command that runs; for a subcommand this is the subcommand, and its
parentis the command it belongs to - from_console Boolean true if it was run as a console command, nil if it was typed in the chat
Returns
- Any Return any non-nil value, even true, to stop the command from running
Called from
Call sites
PlayerCanStartTimedAction(actor, id, duration, options)
server packages/flow/lib/sh_timed_action.lua:213Asks whether a player may start a timed action. Called on the server by
Flux.TimedAction:start once the action is known to be valid and the player to be
free (or the start to be forced), before anything is changed.
Parameters
- actor Player The player about to start the action
- id String Action ID
- duration Number Seconds the action takes
- options Map The options given to
Flux.TimedAction:start
Returns
- Boolean Return false to keep the action from starting
Called from
Call sites
Called on the server when a player joins for the first time, after their new database
record has been given the SteamID, the name and the user role and right before it
is saved. Handlers can set further defaults on the record. PlayerRestored follows.
Parameters
- actor Player The player who has joined
- record User The new database record of the player
Call sites
GMod's PlayerDisconnected hook, which the game only runs on the server. Flux runs
it on every client as well when the server announces that a player has left.
Parameters
- actor Player The player who is leaving. The entity is not valid if the client has already lost it
Call sites
Called on both realms when a player tries to enter noclip. Gamemode (GM) handlers
are not called. A handler that returns false may put the player into a noclip mode
of its own, which is how the observer plugin works.
Parameters
- actor Player The player entering noclip
Returns
- Boolean Return false to prevent it or true to allow it; when nothing is returned, it is allowed to players with the 'noclip' permission
Called from
Call sites
Called on both realms when a player tries to leave noclip. Gamemode (GM) handlers
are not called.
Parameters
- actor Player The player leaving noclip
Returns
- Boolean Return false to prevent it or true to allow it; it is allowed when nothing is returned
Called from
Call sites
Decides whether a player has a permission. Called on both realms by Player:can,
which returns whatever the hook returns. Flux has no handler of its own: an admin
plugin is expected to implement it.
Parameters
- actor Player The player being checked
- action String Permission ID, such as 'spawn_props'
- object Any Object the permission is checked against; nil if none was given
Returns
- Boolean Whether the player has the permission
Called from
Call sites
Called on the server when the client of a player has finished loading and reports
that its local player exists, right after the config, the networked variables and
the list of disabled plugins have been sent to it. The gamemode's handler marks the
player as initialized (see Player:has_initialized) and, a quarter of a second later,
runs the hook on the player's own client, where it is called without arguments. Not
called for bots, which are marked as initialized as soon as they join.
Parameters
- actor Player The player who has finished loading; nil on the client
Call sites
GMod's PlayerInitialSpawn hook, which the game only runs on the server. Flux runs
it on every client as well when the server announces a newly connected player; bots
are not announced. The hook waits for the client to receive the entity of the
player (see util.wait_for_ent) and is not run if the entity never arrives.
Parameters
- actor Player The player who has joined
Call sites
Decides whether a player has root access, that is can do anything. Called on both
realms by Player:is_root, which returns whatever the hook returns. Flux has no
handler of its own: an admin plugin is expected to implement it.
Parameters
- target Player The player being checked
Returns
- Boolean Whether the player is root
Called from
Call sites
Called on the server when the client of a player has reported a new language: the one
the player picked with Flux.Lang:set_language, or else the language of their game.
Runs after Flux.Lang:get_player_lang has started to return the new language. Not
called for the first report of a player whose language is English, which is what the
server assumes until then.
Parameters
- actor Player The player whose language has changed
- new_lang String New language code
- old_lang String Previous language code
Call sites
Called on the server once a spawning player holds the default loadout, after the
gamemode has stripped their weapons and given the default ones. This is where a plugin
or schema gives the player the weapons of their faction, rank or job: a weapon given
from PostPlayerLoadout would be stripped right after. Runs inside Player:Spawn, so
whatever happens after the spawn, such as restoring saved ammo, sees these weapons.
Parameters
- actor Player the player who has spawned
- default_loadout List<String> weapon classes the player has been given
Called from
Call sites
Called when the model of a player changes, right before the new model is applied.
Player:SetModel runs it on the realm it is called on, and the server also announces
the change to every client, which runs the hook once the player's entity is valid
there. In addition, the client runs it for every player when the map's entities have
been created, with the current model as both the new and the old one. The gamemode's
handler assigns the animation table of the new model to the player.
Parameters
- target Player The player whose model changes
- new_model String Path of the new model
- old_model String Path of the previous model
Called from
Call sites
Called once a minute for every player, on both realms. The calls are spread out: each player's call comes a quarter of a second after the previous player's.
Parameters
- actor Player The player the call is for
Call sites
Called on the server once a second for every player, right after that player's
PlayerThink. The gamemode's handler uses it to detect movement (see
PlayerPositionChanged).
Parameters
- actor Player The player to process
- cur_time Number CurTime() of the call
Called from
Call sites
Called on the server when a player is not where they were a second ago. The gamemode
checks this once a second for every player, from its PlayerOneSecond handler.
Parameters
- actor Player The player who has moved
- old_pos Vector Position at the previous check; nil at the player's first check
- new_pos Vector Current position
- cur_time Number CurTime() of the check
Called from
Call sites
Called on the server once the database record of a player who has just joined is
available as actor.record. For a player who joins for the first time it runs after
PlayerCreated, when the new record has been saved. Bots get it right away with a
blank record.
Parameters
- actor Player The player who has joined
- record User The database record of the player
Called from
Call sites
Called on the server right before a command is logged and run, after all of the checks have passed and its targets have been found.
Parameters
- actor Player the player who runs the command, an invalid entity for the server console
- cmd_table Command the command that runs; for a subcommand this is the subcommand, and its
parentis the command it belongs to - args List arguments that are passed to
on_run, without the subcommand word; for a command that targets players, the player argument is already a List<Player>
Returns
- Boolean Return true to stop the command from running; the player is not notified
Called from
Call sites
GMod's PlayerSetModel hook, run by Flux on the server every time a player spawns,
before the rest of their state is reset. The gamemode's handler applies the model
(see PrePlayerSetModel for changing it). A plugin or schema handler that returns a
value replaces the gamemode's handler and has to set the model itself.
Parameters
- actor Player The player who is spawning
Called from
Call sites
Called on the server and the client when the data tables of a player are set up, right
after Flux has added its own Initialized variable. Add the data table variables of your
plugin to the player here with DTVar.
Parameters
- target Player the player whose data tables are being set up
Called from
Call sites
Called on the server when a player toggles their flashlight, before the engine does it. The Shared Flashlight plugin handles it by toggling a light that other players can see and returning false.
Parameters
- actor Player The player who toggles the flashlight
- on Boolean Whether the flashlight is being turned on
Returns
- Boolean Return false to keep the engine flashlight from toggling, true to allow it; the base gamemode decides when nothing is returned
Called from
Call sites
Called on the server whenever a player takes damage, from the gamemode's
EntityTakeDamage handler. The return value is ignored, so the damage cannot be
blocked from here. The gamemode's handler tells the victim's client to show the
damage flash.
Parameters
- victim Player The player taking the damage
- damage_info CTakeDamageInfo The damage being dealt
Called from
Call sites
Called on the server eight times a second for every player, including players who
are dead or not initialized yet. Prefer PlayerOneSecond when once a second is
often enough. The gamemode's handler runs the player's current action.
Parameters
- actor Player The player to process
- cur_time Number CurTime() of the call
Called from
Call sites
Called when a timed action of a player has ended, after the callback of the action.
Runs on the server and, for the local player only, on the client of the owner (where
the action table has no condition, callback and options).
Parameters
- actor Player The player who was doing the action; no longer valid on the server if they have already left
- action Map The action, see
Flux.TimedAction:get - success Boolean true if the action ran for its whole duration, false if it was canceled
Called from
finishclear
Call sites
Called when a timed action of a player has started. Runs on the server and, for the
local player only, on the client of the owner (where the action table has no
condition, callback and options).
Parameters
- actor Player The player doing the action
- action Map The action, see
Flux.TimedAction:get
Called from
Call sites
Called on the client once the server has initialized the local player, right before
the spawn menu is rebuilt with the spawnmenu_reload console command. Plugins add
their spawn menu tabs here.
Called from
Call sites
Sandbox's PopulateToolMenu hook, run once more by Flux on the client when the
server has initialized the local player, after the spawn menu reload has been
requested. The gamemode's handler adds every registered Flux tool to the tool menu
and then runs SynchronizeTools.
Called from
Call sites
Called on the client every frame right after the loading screen has been drawn, for
drawing on top of it. Gamemode (GM) handlers are not called.
Called from
Call sites
Called on the server when a player gets their loadout after spawning. The handler of the Flux gamemode strips the weapons of the player, gives them the weapons of the default loadout and selects the first one; it does not run if a plugin or schema handler returns a non-nil value.
Parameters
- actor Player the player who has spawned
- default_loadout List<String> weapon classes of the default loadout
Called from
Call sites
Called on the server every time a player spawns, after their model, collisions, visibility and movement speeds have been reset and before their hands model is created. This is the place to set up whatever the player should spawn with. The gamemode's handler gives the loadout, plus the tool gun and the physics gun to players with the permissions for them, then runs the hook on the player's own client, where it is called without arguments.
Parameters
- actor Player The player who has spawned; nil on the client
Called from
Call sites
Called on the server after a data save, when the config has been saved and every
SaveData handler has run. This is the place for work that depends on the saved
state, such as a backup or a log entry. Database queries that the handlers have
started may still be running.
Called from
Call sites
Called on the server after Player:save_player has saved the database record of a
player. Not called for bots.
Parameters
- actor Player The player who has been saved
Called from
Call sites
Called on the client after the target ID lines of a player have been collected with
GetDrawPlayerInfo and before they are drawn. Handlers can change or remove the
entries of lines.
Parameters
- target Player The player being looked at
- x Number Screen x of the target ID
- y Number Screen y of the target ID
- distance Number Distance to the player in units
- lines Map Lines about to be drawn by ID, see
GetDrawPlayerInfo
Returns
- Boolean Return false to draw nothing for this player
Called from
Call sites
Called on the server and the client when a tool file is about to be included. The tool is
a new Tool object that only has its mode and ID set.
Parameters
- tool Tool the tool that is being loaded
Call sites
Lets plugins choose the model a player gets when the gamemode sets it, which happens on the server every time the player spawns.
Parameters
- actor Player The player whose model is being set
Returns
- String/Boolean Path of the model to use, or false to let the base gamemode pick the model. When nothing is returned, bots and initialized players get the model from their
modelnetworked variable and everyone else is left to the base gamemode
Called from
Call sites
Called on the server before Player:save_player saves the database record of a
player. Not called for bots.
Parameters
- actor Player The player about to be saved
Returns
- Boolean Return true to prevent the record from being saved; in that case
PostSavePlayerDatais not run either
Called from
Call sites
Called on the server for plugins to save their persistent data, from the gamemode's
FLSaveData handler after the config has been saved. The counterpart of LoadData.
Called from
Call sites
Asks whether the loading screen should stay up. Called on the client every frame once the local player has been initialized; until then the loading screen is always drawn.
Returns
- Boolean Return true to keep drawing the loading screen
Called from
Call sites
Asks whether the HUD should be drawn. Called on the client every frame once the local
player has been initialized, from the gamemode's HUDPaint handler. HUD elements
that plugins draw on their own, such as the crosshair, can run it too.
Returns
- Boolean Return false to hide the Flux HUD and the HUD of the base gamemode
Called from
Call sites
Asks whether the empty server may reload the current map. Called on the server every half an hour, if no players are connected at that moment.
Returns
- Boolean Return false to prevent the map from being reloaded
Called from
Call sites
Called on the client when the local player presses the undo key (a bind containing
gmod_undo). The gamemode's handler asks the server to undo the last entry of the
player's Flux undo queue and returns true if the queue is not empty.
Parameters
- client Player The local player
Returns
- Any Return any non-nil value to block the bind, which keeps sandbox's own undo from running as well
Called from
Call sites
Called on the client when the tool gun has to learn about the Flux tools: once the map's entities have been created, and again whenever the tool menu has been populated. The gamemode's handler copies every registered Flux tool into the tool table of the tool gun.
Called from
Call sites
Lets plugins add target selectors for the player argument of commands. Called on the server when the argument does not start with one of the built-in selector characters. If no function is returned, the argument is looked up as a player name.
Parameters
- actor Player the player who is running the command, an invalid entity for the server console
- str String the whole player argument
- start String first character of the argument
Returns
- Function Parser that is called with the actor and the argument; it returns a List<Player> of targets, or false if there are none, and the selector character
Called from
Call sites
Called on the server and the client after a tool file has been included, right before the
console variables of the tool are created with Tool:CreateConVars.
Parameters
- tool Tool the tool that has been loaded
Call sites
Defined in
- packages/flow/hooks/sv_nethooks.lua
- packages/flow/lib/sh_command.lua
- packages/flow/hooks/cl_nethooks.lua
- packages/flow/hooks/cl_hooks.lua
- packages/flow/lib/meta/sh_entity.lua
- packages/flow/hooks/sv_hooks.lua
- packages/flow/hooks/sh_hooks.lua
- packages/flow/core/sh_core.lua
- packages/flow/lib/meta/sh_player.lua
- packages/flow/lib/sh_lang.lua
- packages/flow/models/log.lua
- packages/flow/lib/sh_timed_action.lua
- packages/flow/lib/meta/sv_player.lua
- packages/flow/lib/classes/sh_player.lua
- packages/flow/lib/sh_tool.lua