General
Hooks that can be used in a Plugin or a Schema
Reference
Functions
- GENERAL:CanEditDoor(ply, door)
- GENERAL:CanPlayerChangeTeam(ply, team)
- GENERAL:CanStoreItem(ply, storage, itemclass, from)
- GENERAL:CanUseInventory(ply)
- GENERAL:ChatClassMessageSend(chatClass, sender, message)
- GENERAL:ChatStateChanged(ply, oldState, newState)
- GENERAL:CheckMenuInput()
- GENERAL:ContainerPasscodeSet(ply, container)
- GENERAL:CreateMenuMessages()
- GENERAL:DefineSettings()
- GENERAL:DisplayMenuMessages()
- GENERAL:DoInventorySearch(ply, target)
- GENERAL:GetDeathSound()
- GENERAL:LoadAnimationClasses()
- GENERAL:OnSchemaLoaded()
- GENERAL:OnSyncUpdate(varID, targetID, any)
- GENERAL:PlayerAddUserToDoor(ply, owners)
- GENERAL:PlayerArrested(convict, officer)
- GENERAL:PlayerBuyablePurchase(ply, buyable)
- GENERAL:PlayerCanHearCheck(listener, speaker)
- GENERAL:PlayerChangeRPName(ply, name)
- GENERAL:PlayerConfiscateItem(ply, targ, itemclass)
- GENERAL:PlayerCraftItem(ply, output)
- GENERAL:PlayerDropDeathItems(ply, killer, pos, dropped, inv)
- GENERAL:PlayerDropItem(ply, itemData, invID)
- GENERAL:PlayerDropMoney(ply, money)
- GENERAL:PlayerGetJailData(endTime, jailData)
- GENERAL:PlayerGetKnownName(ply)
- GENERAL:PlayerGetXP(ply, xp)
- GENERAL:PlayerInitialSpawnLoaded(ply)
- GENERAL:PlayerOpenStorage(ply, storage)
- GENERAL:PlayerOpenStorage(ply, box)
- GENERAL:PlayerPurchaseDoor(ply, door)
- GENERAL:PlayerRagdollPreSpawn(ragdoll, ply, attacker)
- GENERAL:PlayerSellDoor(ply, door)
- GENERAL:PlayerShouldBreakLegs(ply, damage)
- GENERAL:PlayerShouldGetHungry(ply)
- GENERAL:PlayerUnArrested(convict, officer)
- GENERAL:PlayerUnJailed(ply)
- GENERAL:PlayerVendorBuy(ply, vendor, itemclass, cost)
- GENERAL:PlayerZoneChanged(ply, id)
- GENERAL:PostChatClassMessageSend(chatClass, message, sender)
- GENERAL:PostConfigLoad()
- GENERAL:PostInitPostEntity()
- GENERAL:PostInventorySetup(ply)
- GENERAL:PostSetupPlayer(ply)
- GENERAL:PreEarlyInventorySetup(ply)
- GENERAL:ProcessICChatMessage(sender, message)
- GENERAL:ProcessOOCMessage(message)
- GENERAL:RadioMessageFallback(ply, message)
- GENERAL:ShouldDrawHUDBox()
Functions
GENERAL:CanEditDoor(ply, door)
Called to decide if a player can edit a door
Parameters
-
ply
entity
The player
-
door
entity
The door
Returns
-
bool
Can edit
GENERAL:CanPlayerChangeTeam(ply, team)
Called to decide if a player can change team
Parameters
-
ply
entity
The player
-
team
int
The team to switch to
Returns
-
bool
Can we switch team?
GENERAL:CanStoreItem(ply, storage, itemclass, from)
Called to decide if a player can store/unstore an item
Parameters
-
ply
entity
The player
-
storage
entity
The storage box
-
itemclass
string
The item class
-
from
int
Is this to or from the players inventory?
Returns
-
bool
Allow the item to be stored or unstored?
GENERAL:CanUseInventory(ply)
Controls wether a player can use their inventory, returning false stops all inventory interaction and stops the inventory from displaying
Parameters
-
ply
entity
The player that is trying to use their inventory
Returns
-
bool
Can use inventory
GENERAL:ChatClassMessageSend(chatClass, sender, message)
Called when an chat class message is sent
Parameters
-
chatClass
int
ID of the chat class
-
sender
entity
The sender
-
message
string
The message
Returns
-
string
The new message
GENERAL:ChatStateChanged(ply, oldState, newState)
Called when a players chat state changes
Parameters
-
ply
entity
The player
-
oldState
boolean
The old chat state
-
newState
boolean
The new chat state
GENERAL:CheckMenuInput()
Called every tick, use this to check for key presses to open user interface elements (input.IsKeyDown)
GENERAL:ContainerPasscodeSet(ply, container)
Called when a player sets a container passcode
Parameters
-
ply
entity
The player
-
container
entity
The container
GENERAL:CreateMenuMessages()
Called when the menu is active and MenuMessages are ready to be created
See Also
GENERAL:DefineSettings()
Called when you can define settings, all settings you want to define should be done inside this hook
See Also
GENERAL:DisplayMenuMessages()
Called when the menu is active and MenuMessages are ready to be displayed
See Also
GENERAL:DoInventorySearch(ply, target)
Called when a player inventory searches another player
Parameters
-
ply
entity
The searcher player
-
target
entity
The target player
GENERAL:GetDeathSound()
Returns a custom death sound to override the default impulse one
Returns
-
string
Sound path
GENERAL:LoadAnimationClasses()
Called when animation classes have been loaded
GENERAL:OnSchemaLoaded()
Called when the schema has loaded fully
GENERAL:OnSyncUpdate(varID, targetID, any)
Called when a Sync variable is updated
Parameters
-
varID
int
The sync variable ID
-
targetID
int
The entity ID of the target
-
any
The new value
GENERAL:PlayerAddUserToDoor(ply, owners)
Called when a player adds a user to a door
Parameters
-
ply
entity
The player
-
owners
Table of owners
GENERAL:PlayerArrested(convict, officer)
Called when a player is arrested
Parameters
-
convict
entity
The player that has been arrested
-
officer
entity
The officer who arrested the player
GENERAL:PlayerBuyablePurchase(ply, buyable)
Called when a player purchases a buyable
Parameters
-
ply
entity
The player
-
buyable
string
The buyable name
GENERAL:PlayerCanHearCheck(listener, speaker)
Called to check if one player can hear another
Parameters
-
listener
entity
The player listening
-
speaker
entity
The player speaking
Returns
-
bool
Can the listener hear the speaker?
GENERAL:PlayerChangeRPName(ply, name)
Called when a player changes their RP name
Parameters
-
ply
entity
The player
-
name
string
The new name
GENERAL:PlayerConfiscateItem(ply, targ, itemclass)
Called when a player confiscates an item
Parameters
-
ply
entity
The player who is confiscating
-
targ
entity
The player who is being targeted
-
itemclass
string
The item class of the confiscated item
GENERAL:PlayerCraftItem(ply, output)
Called when a player crafts an item
Parameters
-
ply
entity
The player
-
output
string
The item class of the output
GENERAL:PlayerDropDeathItems(ply, killer, pos, dropped, inv)
Called when a player dies, you can drop loot in this hook
Parameters
-
ply
entity
The player who died
-
killer
entity
The killer
-
pos
The pos to spawn any droppable items at
-
dropped
A table of dropped items
-
inv
The players inventory on death
GENERAL:PlayerDropItem(ply, itemData, invID)
Called when a player drops an item
Parameters
-
ply
entity
The player
-
itemData
A table of item data
-
invID
int
The inventory ID of the item
GENERAL:PlayerDropMoney(ply, money)
Called when a player drops money
Parameters
-
ply
entity
The player
-
money
entity
The money
GENERAL:PlayerGetJailData(endTime, jailData)
Called when the local player is sent to jail, provides jail sentence data
Parameters
-
endTime
int
When the jail sentence will end
-
jailData
Data regarding the sentence including crimes commited
GENERAL:PlayerGetKnownName(ply)
Called to decide what the known name of a player should be
Parameters
-
ply
entity
The player to get the name of
Returns
-
string
The known name
GENERAL:PlayerGetXP(ply, xp)
Called when a player gains XP
Parameters
-
ply
entity
The player
-
xp
int
The amount gained
GENERAL:PlayerInitialSpawnLoaded(ply)
Called when the player has fully loaded into the server after connecting
Parameters
-
ply
entity
Player who is now fully connected
GENERAL:PlayerOpenStorage(ply, storage)
Called when the player accesses their storage container
Parameters
-
ply
entity
The player who opened their storage
-
storage
entity
The storage box
GENERAL:PlayerOpenStorage(ply, box)
Called when a player opens their storage box
Parameters
-
ply
entity
The player that has opened their storage
-
box
entity
The storage box
GENERAL:PlayerPurchaseDoor(ply, door)
Called when a player purchases a door
Parameters
-
ply
entity
The player
-
door
entity
The door
GENERAL:PlayerRagdollPreSpawn(ragdoll, ply, attacker)
Called before a players death ragdoll spawns
Parameters
-
ragdoll
entity
The ragdoll entity
-
ply
entity
The player who died
-
attacker
entity
The killer
GENERAL:PlayerSellDoor(ply, door)
Called when a player sells a door
Parameters
-
ply
entity
The player
-
door
entity
The door
GENERAL:PlayerShouldBreakLegs(ply, damage)
Called to decide if a player should break their legs
Parameters
-
ply
entity
The player
-
damage
int
The fall damage
Returns
-
bool
Should their legs break?
GENERAL:PlayerShouldGetHungry(ply)
Called to decide if a player should get hungry
Parameters
-
ply
entity
The player
Returns
-
bool
Should they get hungry?
GENERAL:PlayerUnArrested(convict, officer)
Called when a player is un-arrested
Parameters
-
convict
entity
The player that has been un-arrested
-
officer
entity
The officer who un-arrested the player
GENERAL:PlayerUnJailed(ply)
Called when a player is unjailed
Parameters
-
ply
entity
The player
GENERAL:PlayerVendorBuy(ply, vendor, itemclass, cost)
Called when a player buys an item from a vendor
Parameters
-
ply
entity
The player
-
vendor
entity
The vendor
-
itemclass
string
The item class of the bought item
-
cost
int
The cost of the purchase
GENERAL:PlayerZoneChanged(ply, id)
Called when a player changes zone
Parameters
-
ply
entity
The player
-
id
int
The new zone ID
GENERAL:PostChatClassMessageSend(chatClass, message, sender)
Called after a chat class message is sent
Parameters
-
chatClass
int
ID of the chat class
-
message
string
The message
-
sender
entity
The sender
GENERAL:PostConfigLoad()
Called after the config has loaded
GENERAL:PostInitPostEntity()
Called after impulse has setup it's entities
GENERAL:PostInventorySetup(ply)
Called after a players inventory has been setup
Parameters
-
ply
entity
The player
GENERAL:PostSetupPlayer(ply)
Called after a player has been fully setup by impulse
Parameters
-
ply
entity
The player
GENERAL:PreEarlyInventorySetup(ply)
Called before a players inventory is queried from the database
Parameters
-
ply
entity
The player
GENERAL:ProcessICChatMessage(sender, message)
Called when an in-character chat message is sent
Parameters
-
sender
entity
The sender
-
message
string
The message
Returns
-
string
The new message
GENERAL:ProcessOOCMessage(message)
Called when an OOC message is sent
Parameters
-
message
string
The message
GENERAL:RadioMessageFallback(ply, message)
Called when a player tries to use /r or /radio, but is not a CP
Parameters
-
ply
entity
The player
-
message
string
The message
GENERAL:ShouldDrawHUDBox()
Called after a chat class message is sent
Returns
-
bool
Should we draw the HUD box?