Hooks

List of hooks available to SF scripts

List

EndEntityDriving (ent, ply) Called when a player stops driving an entity
EntityRemoved (ent) Called when an entity is removed
GravGunOnDropped (ply, ent) Called when an entity is being dropped by a gravity gun
GravGunOnPickedUp (ply, ent) Called when an entity is being picked up by a gravity gun
GravGunPunt (ply, ent) Called when a player punts with the gravity gun
KeyPress (ply, key) Called when a player presses a key
KeyRelease (ply, key) Called when a player releases a key
OnEntityCreated (ent) Called when an entity gets created
OnPhysgunFreeze (physgun, physobj, ent, ply) Called when an entity is being frozen
OnPhysgunReload (physgun, ply) Called when a player reloads his physgun
PhysgunDrop (ply, ent) Called when an entity being held by a physgun gets dropped
PhysgunPickup (ply, ent) Called when an entity gets picked up by a physgun
PlayerDeath (ply, inflictor, attacker) Called when a player dies
PlayerDisconnected (ply) Called when a player disconnects
PlayerHurt (ply, attacker, newHealth, damageTaken) Called when a player gets hurt
PlayerLeaveVehicle (ply, vehicle) Called when a players leaves a vehicle
PlayerNoClip (ply, newState) Called when a player toggles noclip
PlayerSay (ply, text, teamChat) Called when a player sends a chat message
PlayerSpawn (player) Called when a player spawns
PlayerSpray (ply) Called when a players sprays his logo
PlayerSwitchFlashlight (ply, state) Called when a players turns their flashlight on or off
PlayerUse (ply, ent) Called when a player holds their use key and looks at an entity.
Removed () Called when the starfall chip is removed
StartEntityDriving (ent, Player) Called when a player starts driving an entity
input (input, value) Called when an input on a wired SF chip is written to
net (name, len, ply) Called when a net message arrives
readcell (address) Called when a high speed device reads from a wired SF chip
remote (sender, owner, ...) Remote hook.
render () Called when a frame is requested to be drawn.
starfallUsed (activator) Called when a player uses the screen
think () Think hook.
writecell (address, data) Called when a high speed device writes to a wired SF chip


EndEntityDriving (ent, ply)
Called when a player stops driving an entity

Parameters:

  • ent: Entity that had been driven
  • ply: Player that drove the entity
EntityRemoved (ent)
Called when an entity is removed

Parameters:

  • ent: Entity being removed
GravGunOnDropped (ply, ent)
Called when an entity is being dropped by a gravity gun

Parameters:

  • ply: Player dropping the object
  • ent: Entity being dropped
GravGunOnPickedUp (ply, ent)
Called when an entity is being picked up by a gravity gun

Parameters:

  • ply: Player picking up an object
  • ent: Entity being picked up
GravGunPunt (ply, ent)
Called when a player punts with the gravity gun

Parameters:

  • ply: Player punting the gravgun
  • ent: Entity being punted
KeyPress (ply, key)
Called when a player presses a key

Parameters:

  • ply: Player pressing the key
  • key: The key being pressed
KeyRelease (ply, key)
Called when a player releases a key

Parameters:

  • ply: Player releasing the key
  • key: The key being released
OnEntityCreated (ent)
Called when an entity gets created

Parameters:

  • ent: New entity
OnPhysgunFreeze (physgun, physobj, ent, ply)
Called when an entity is being frozen

Parameters:

  • physgun: Entity of the physgun
  • physobj: PhysObj of the entity
  • ent: Entity being frozen
  • ply: Player freezing the entity
OnPhysgunReload (physgun, ply)
Called when a player reloads his physgun

Parameters:

  • physgun: Entity of the physgun
  • ply: Player reloading the physgun
PhysgunDrop (ply, ent)
Called when an entity being held by a physgun gets dropped

Parameters:

  • ply: Player droppig the entity
  • ent: Entity being dropped
PhysgunPickup (ply, ent)
Called when an entity gets picked up by a physgun

Parameters:

  • ply: Player picking up the entity
  • ent: Entity being picked up
PlayerDeath (ply, inflictor, attacker)
Called when a player dies

Parameters:

  • ply: Player who died
  • inflictor: Entity used to kill the player
  • attacker: Entity that killed the player
PlayerDisconnected (ply)
Called when a player disconnects

Parameters:

  • ply: Player that disconnected
PlayerHurt (ply, attacker, newHealth, damageTaken)
Called when a player gets hurt

Parameters:

  • ply: Player being hurt
  • attacker: Entity causing damage to the player
  • newHealth: New health of the player
  • damageTaken: Amount of damage the player has taken
PlayerLeaveVehicle (ply, vehicle)
Called when a players leaves a vehicle

Parameters:

  • ply: Player who left a vehicle
  • vehicle: Vehicle that was left
PlayerNoClip (ply, newState)
Called when a player toggles noclip

Parameters:

  • ply: Player toggling noclip
  • newState: New noclip state. True if on.
PlayerSay (ply, text, teamChat)
Called when a player sends a chat message

Parameters:

  • ply: Player that sent the message
  • text: Content of the message
  • teamChat: True if team chat

Return value:

    New text. "" to stop from displaying. Nil to keep original.
PlayerSpawn (player)
Called when a player spawns

Parameters:

  • player: Player who spawned
PlayerSpray (ply)
Called when a players sprays his logo

Parameters:

  • ply: Player that sprayed
PlayerSwitchFlashlight (ply, state)
Called when a players turns their flashlight on or off

Parameters:

  • ply: Player switching flashlight
  • state: New flashlight state. True if on.
PlayerUse (ply, ent)
Called when a player holds their use key and looks at an entity. Will continuously run.

Parameters:

  • ply: Player using the entity
  • ent: Entity being used
Removed ()
Called when the starfall chip is removed
StartEntityDriving (ent, Player)
Called when a player starts driving an entity

Parameters:

  • ent: Entity being driven
  • Player: that is driving the entity
input (input, value)
Called when an input on a wired SF chip is written to

Parameters:

  • input: The input name
  • value: The value of the input
net (name, len, ply)
Called when a net message arrives

Parameters:

  • name: Name of the arriving net message
  • len: Length of the arriving net message in bytes
  • ply: On server, the player that sent the message. Nil on client.
readcell (address)
Called when a high speed device reads from a wired SF chip

Parameters:

  • address: The address requested

Return value:

    The value read
remote (sender, owner, ...)
Remote hook. This hook can be called from other instances

Parameters:

  • sender: The entity that caused the hook to run
  • owner: The owner of the sender
  • ...: The payload that was supplied when calling the hook
render ()
Called when a frame is requested to be drawn. You may want to unhook from this if you don't need to render anything for a bit
starfallUsed (activator)
Called when a player uses the screen

Parameters:

  • activator: Player using the screen
think ()
Think hook. Called once per game tick
writecell (address, data)
Called when a high speed device writes to a wired SF chip

Parameters:

  • address: The address written to
  • data: The data being written

Valid XHTML 1.0!