Hooks Server - Chessnut/NutScript GitHub Wiki

Information

The following are server-side hooks. These hooks are only called in server-side files (files that begin with sv_ indicate a server-side file). These hooks can be added on to in schemas by defining function SCHEMA:HookName(arguments). Plugins follow a similar pattern, but SCHEMA is replaced with PLUGIN.


  • boolean OnPickupMoney Entity Activator Money Entity
    If the hook returns false, player can’t pickup the money.

  • boolean "CanPlayerThrowPunch" Punching Player
    If the hook returns false, player can’t do punch attack.

  • float "PlayerGetFistDamage" Punching Player Original Damage
    Gets the fist’s damage.

  • void "PlayerThrowPunch" Punching Player Punch Trace
    This hook get fired when the player done with his/her punch damage.

  • boolean "PlayerCanKnock" Knocking Player Knocked Entity
    If the hook returns false, player can’t knock the door.

  • boolean "PlayerCanOpenShipment" Shipment Opening Player Shipment Entity
    If the hook returns false, player can’t open the shipment.

  • boolean "CanPlayerUseDoor" Interacting Player Interacted Entity
    If the hook returns false, player can’t interact with the door.

  • void "PlayerUseDoor" Interacting Player Interacted Entity
    This hook is called when player uses the door.

  • void "PlayerUse" Interacting Player Interacted Entity
    This hook is called when player pressed use key on the entity.

  • boolean "CanPlayerDropItem" Item's Owner(Player) Dropped Item Object
    If the hook returns false, player can’t drop the item.

  • string "PlayerMessageSend" Message Sender(Player) Chat Type Message Is Anonymous?
    This hook gets the text of the message that other player sent.

  • void "PostPlayerSay" Spoken Player Message Chat Type Is Anonymous?
    This hook is called when player spoken a word.

  • void "PostPlayerLoadout" Spawned Player
    This hook is called right after “PlayerLoadout” hook is called.

  • string "GetPlayerDeathSound" Died Player
    This hook gets the sound’s path for player’s death sound.

  • string "GetPlayerPainSound" Injured Player
    This hook gets the sound’s path for player’s pain moaning sound.

  • void "LoadData"
    This hook is called when server loads the data.

  • void "SaveData"
    This hook is called when server is saves the data.

  • void "OnPlayerEnterSequence" Acting Player Requested Sequence Function Callback Sequence Time Not Stationary? This hook is called when player is performing the sequence.

  • void "OnPlayerLeaveSequence" Acted Player
    This hook is called when player is done performing the sequence.

  • void "OnTakeShipmentItem" Player Item ID Amount
    This hook is called when player take items from the shipment.

  • void "OnCreateShipment" Player Ordered Shipment Entity
    This hook is called when player ordered a shopment from the shipment menu.

  • void "CharacterRestored" Restored Character Index
    This hook is called when player’s character is restored from character cache.

  • string "GetDefaultCharName" Character Owner Player Faction Data
    This hook gets the default character’s name of the faction.

  • boolean "CanPlayerUseChar" Character Owner Player Character Index
    If the hook returns false, player can’t use the character.

  • void "PlayerLoadedChar" Player Loading Character Index Previous(Current) Character
    This hook is called when player loaded the character.

  • void "AdjustCreationData" Player Previous Data New Data
    This hook is called when player created the character. You can use this hook to modify default character’s data.

  • void "OnCharDelete" Player Character ID Is Current Character?
    This hook is called when player deletes his/her own character.

  • void "OnCharVarChanged" Character Index Key Previous Variable Changed Variable
    This hook is called when the variable of character is changed by the server.

  • string "OnChatReceived" Player Chat Type Message Is Anonymous?
    This hook is called when the player received the chat.

  • string "GetPlayerIcon" Speaking Player
    This hook gets the OOC chat’s icon of the speaker.

  • void "OnPlayerJoinClass" Joining Player Class ID
    This hook is called when player joins to certain class.

  • boolean "CanPlayerInteractItem" Interacting Player Action ID Item Object
    If the hook returns false, player can’t interact with item. (In any form)

  • boolean "PluginShouldLoad" Plugin ID If the hook returns false, server does not load the plugin.

  • void "DoPluginIncludes" path, PLUGIN
    This hook is called when the server includes the plugins lua data.

  • void "PluginLoaded" uniqueID, PLUGIN
    This hook is called when the server loaded the plugins

  • void “InitializedSchema”
    This hook is called when the server’s schema is initialized.

  • void "InitializedPlugins"
    This hook is called when the server’s plugings are initialized.

  • void "PluginUnloaded" uniqueID
    This hook is called when the plugin is unloaded.

  • boolean "CharacterPreSave" Saving Character Index
    This hook is called right before character is saved.

  • void "CharacterPostSave" Saved Character Index
    This hook is called after the character is saved.

  • void "InitializedConfig" Confing Data
    This hook is called when the server/client initialized the config.

  • void "OnCharFallover" Falling Player Fallover Ragdoll Object Is Entering?
    This hook is called when the player performed /fallover.

  • boolean "ShouldCleanDataItems"
    If the hook returns false, the server does not clean data items.

  • void "OnPlayerAreaChanged" Player AreaID
    This hook is called when the player’s area data is changed.

  • boolean "CanDisplayArea"
    If the hook returns false, area display will be disabled.

  • void "FinishChat"
    This hook is called right after the player finished the chat.

  • void "ChatTextChanged" Chat Text
    This hook is called when the text in chat input is changed.

  • void "StartChat"
    This hook is called when player starts the chat.

  • void "PlayerSay" Player Chat Text
    This hook is called when player said the word.

  • boolean "CanPlayerAccessDoor" Player Door Entity Access
    If the hook returns false, player can’t interact with the door.

  • boolean "IsRecognizedChatType" Chat Type
    If the hook returns false, player will get description of the speaker’s character not the name of the speaker.

  • void "StorageItemRemoved" Storage Entity Item Object
    This hook is called when the item in the storage is removed.

  • boolean "CanPlayerUseVendor" Player Vendor Entity
    If the hook returns false, the player can’t use the vendor.

  • boolean "CanVendorSellItem" Player Vendor Entity Item ID
    If the hook returns false, the player can’t sell item to the vendor.

  • boolean "CanVendorBuyItem" Player Vendor Entity Item ID
    If the hook returns false, the player can’t buy item to the vendor.

  • void "OnCharTradeVendor" Player Vendor Entity X Y Bag ID Price
    This hook is called when player traded an item with the trader.