Summary

Hooks

Called after Catwork has loaded the map entities; restores the saved notepads.
Called when an entity's menu option is chosen; opens a notepad for reading or editing.
Called when an entity's menu options are needed; adds the notepad's options.
Spawns the notepads saved for the current map.
Called after data is saved; saves the notepads.
Saves every cw_notepad on the map to the schema data.

Hooks

cwNotepad:ClockworkInitPostEntity()

server gamemodes/cwhl2rp/plugins/notepad/plugin/sv_hooks.lua:52

Implements hook ClockworkInitPostEntity

Called after Catwork has loaded the map entities; restores the saved notepads.

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

server gamemodes/cwhl2rp/plugins/notepad/plugin/sv_hooks.lua:17

Implements hook EntityHandleMenuOption

Called when an entity's menu option is chosen; opens a notepad for reading or editing.

The notepad text is only sent the first time a player opens that text (tracked by its CRC in player.notepadIDs); later the client uses its cached copy. Only the notepad's owner may edit written text; anyone may write on a blank notepad.

Parameters

  • player Player The player who chose the option
  • entity Entity The entity the option was chosen on
  • option String The option's display text
  • arguments String The option value, such as cw_notepadReadOption

cwNotepad:GetEntityMenuOptions(entity, options)

client gamemodes/cwhl2rp/plugins/notepad/plugin/cl_hooks.lua:10

Implements hook GetEntityMenuOptions

Called when an entity's menu options are needed; adds the notepad's options.

A written notepad offers Read and Edit, a blank one offers Write.

Parameters

  • entity Entity The entity the menu is for
  • options Map The menu options, display text to option value, modified in place

Spawns the notepads saved for the current map.

Restores each notepad's owner, position, angles and text, and freezes the ones that were frozen when saved.

Implements hook PostSaveData

Called after data is saved; saves the notepads.

Saves every cw_notepad on the map to the schema data.

Writes plugins/notepad/<map> with each notepad's owner, text, position, angles and whether it can move.

Defined in