Plugin

Global hooks for general use.

Plugin hooks are regular hooks that can be used in your schema with Schema:HookName(args), in your plugin with PLUGIN:HookName(args), or in your addon with hook.Add("HookName", function(args) end).

Functions

PLUGIN:AdjustCreationPayload(client, payload, newPayload)

Adjusts the data used just before creating a new character.

Parameters

  • client Player

    Player that is creating the character

  • payload table

    Table of data to be used for character creation

  • newPayload table

    Table of data be merged with the current payload

Example Usage

function PLUGIN:AdjustCreationPayload(client, payload, newPayload)
	newPayload.money = payload.attributes["stm"] -- Sets the characters initial money to the stamina attribute value.
end

PLUGIN:AdjustStaminaOffset(client, baseOffset)

Adjusts a player's current stamina offset amount. This is called when the player's stamina is about to be changed; every 0.25 seconds on the server, and every frame on the client.

Parameters

  • client Player

    Player whose stamina is changing

  • baseOffset number

    Amount the stamina is changing by. This can be a positive or negative number depending if they are exhausting or regaining stamina

Returns

  • number

    New offset to use

Example Usage

function PLUGIN:AdjustStaminaOffset(client, baseOffset)
	return baseOffset * 2 -- Drain/Regain stamina twice as fast.
end

PLUGIN:BuildBusinessMenu()

Creates the business panel in the tab menu.

Returns

  • bool

    Whether or not to create the business menu

Example Usage

function PLUGIN:BuildBusinessMenu()
	return LocalPlayer():IsAdmin() -- Only builds the business menu for admins.
end

PLUGIN:CanAutoFormatMessage(speaker, chatType, text)

Whether or not a message can be auto formatted with punctuation and capitalization.

Parameters

  • speaker Player

    Player that sent the message

  • chatType string

    Chat type of the message. This will be something registered with ix.chat.Register - like ic, ooc, etc.

  • text string

    Unformatted text of the message

Returns

  • bool

    Whether or not to allow auto formatting on the message

Example Usage

function PLUGIN:CanAutoFormatMessage(speaker, chatType, text)
	return false -- Disable auto formatting outright.
end

PLUGIN:CanCreateCharacterInfo(suppress)

Whether or not certain information can be displayed in the character info panel in the tab menu.

Parameters

  • suppress table

    Information to NOT display in the UI - modify this to change the behaviour. This is a table of the names of some panels to avoid displaying. Valid names include:

    • time - current in-game time
    • name - name of the character
    • description - description of the character
    • characterInfo - entire panel showing a list of additional character info
    • faction - faction name of the character
    • class - name of the character's class if they're in one
    • money - current money the character has
    • attributes - attributes list for the character

    Note that schemas/plugins can add additional character info panels.

Example Usage

function PLUGIN:CanCreateCharacterInfo(suppress)
	suppress.attributes = true -- Hides the attributes panel from the character info tab
end

PLUGIN:CanDrawAmmoHUD(weapon)

Whether or not the ammo HUD should be drawn.

Parameters

  • weapon Entity

    Weapon the player currently is holding

Returns

  • bool

    Whether or not to draw the ammo hud

Example Usage

function PLUGIN:CanDrawAmmoHUD(weapon)
	if (weapon:GetClass() == "weapon_frag") then -- Hides the ammo hud when holding grenades.
		return false
	end
end

PLUGIN:CanPlayerAccessDoor(client, door, access)

Called when a player tries to use abilities on the door, such as locking.

Parameters

  • client Player

    The client trying something on the door.

  • door Entity

    The door entity itself.

  • access number

    The access level used when called.

Returns

  • bool

    Whether or not to allow the client access.

Example Usage

function PLUGIN:CanPlayerAccessDoor(client, door, access)
	return true -- Always allow access.
end

PLUGIN:CanPlayerCombineItem(client, item, other)

Whether or not a player is allowed to combine an item other into the given item.

Parameters

  • client Player

    Player attempting to combine an item into another

  • item number

    instance ID of the item being dropped onto

  • other number

    instance ID of the item being combined into the first item, this can be invalid due to it being from clientside

Returns

  • bool

    Whether or not to allow the player to combine the items

Example Usage

function PLUGIN:CanPlayerCombineItem(client, item, other)
	local otherItem = ix.item.instances[other]

	if (otherItem and otherItem.uniqueID == "soda") then
		return false -- disallow combining any item that has a uniqueID equal to `soda`
	end
end

PLUGIN:CanPlayerCreateCharacter(client, payload)

Whether or not a player is allowed to create a new character with the given payload.

Parameters

  • client Player

    Player attempting to create a new character

  • payload table

    Data that is going to be used for creating the character

Returns

  • bool

    Whether or not the player is allowed to create the character. This function defaults to true, so you should only ever return false if you're disallowing creation. Otherwise, don't return anything as you'll prevent any other calls to this hook from running.

  • string

    Language phrase to use for the error message

  • ...

    Arguments to use for the language phrase

Example Usage

function PLUGIN:CanPlayerCreateCharacter(client, payload)
	if (!client:IsAdmin()) then
		return false, "notNow" -- only allow admins to create a character
	end
end
-- non-admins will see the message "You are not allowed to do this right now!"

PLUGIN:CanPlayerDropItem(client, item)

Whether or not a player is allowed to drop the given item.

Parameters

  • client Player

    Player attempting to drop an item

  • item number

    instance ID of the item being dropped

Returns

  • bool

    Whether or not to allow the player to drop the item

Example Usage

function PLUGIN:CanPlayerDropItem(client, item)
	return false -- Never allow dropping items.
end

PLUGIN:CanPlayerEarnSalary(client, faction)

Whether or not a player can earn money at regular intervals. This hook runs only if the player's character faction has a salary set - i.e FACTION.pay is set to something other than 0 for their faction.

Parameters

  • client Player

    Player to give money to

  • faction table

    Faction of the player's character

Returns

  • bool

    Whether or not to allow the player to earn salary

Example Usage

function PLUGIN:CanPlayerEarnSalary(client, faction)
	return client:IsAdmin() -- Restricts earning salary to admins only.
end

PLUGIN:CanPlayerEnterObserver(client)

Whether or not the player is allowed to enter observer mode. This is allowed only for admins by default and can be customized by server owners if the server is using a CAMI-compliant admin mod.

Parameters

  • client Player

    Player attempting to enter observer

Returns

  • bool

    Whether or not to allow the player to enter observer

Example Usage

function PLUGIN:CanPlayerEnterObserver(client)
	return true -- Always allow observer.
end

PLUGIN:CanPlayerEquipItem(client, item)

Whether or not a player can equip the given item. This is called for items with outfit, pacoutfit, or weapons as their base. Schemas/plugins can utilize this hook for their items.

Parameters

  • client Player

    Player attempting to equip the item

  • item table

    Item being equipped

Returns

  • bool

    Whether or not to allow the player to equip the item

Example Usage

function PLUGIN:CanPlayerEquipItem(client, item)
	return client:IsAdmin() -- Restrict equipping items to admins only.
end

See Also

PLUGIN:CanPlayerHoldObject(client, entity)

Whether or not a player is allowed to hold an entity with the hands SWEP.

Parameters

  • client Player

    Player attempting to hold an entity

  • entity Entity

    Entity being held

Returns

  • bool

    Whether or not to allow the player to hold the entity

Example Usage

function PLUGIN:CanPlayerHoldObject(client, entity)
	return !(client:GetMoveType() == MOVETYPE_NOCLIP and !client:InVehicle()) -- Disallow players in observer holding objects.
end

PLUGIN:CanPlayerInteractEntity(client, entity, option, data)

Whether or not a player is allowed to interact with an entity's interaction menu if it has one.

Parameters

  • client Player

    Player attempting interaction

  • entity Entity

    Entity being interacted with

  • option string

    Option selected by the player

  • data

    Any data passed with the interaction option

Returns

  • bool

    Whether or not to allow the player to interact with the entity

Example Usage

function PLUGIN:CanPlayerInteractEntity(client, entity, option, data)
	return false -- Disallow interacting with any entity.
end

PLUGIN:CanPlayerInteractItem(client, action, item, data)

Whether or not a player is allowed to interact with an item via an inventory action (e.g picking up, dropping, transferring inventories, etc). Note that this is for an item table, not an item entity. This is called after CanPlayerDropItem and CanPlayerTakeItem.

Parameters

  • client Player

    Player attempting interaction

  • action string

    The action being performed

  • item

    Item's instance ID or item table

  • data

    Any data passed with the action

Returns

  • bool

    Whether or not to allow the player to interact with the item

Example Usage

function PLUGIN:CanPlayerInteractItem(client, action, item, data)
	return false -- Disallow interacting with any item.
end

PLUGIN:CanPlayerJoinClass(client, class, info)

Whether or not a plyer is allowed to join a class.

Parameters

  • client Player

    Player attempting to join

  • class number

    ID of the class

  • info table

    The class table

Returns

  • bool

    Whether or not to allow the player to join the class

Example Usage

function PLUGIN:CanPlayerJoinClass(client, class, info)
	return client:IsAdmin() -- Restrict joining classes to admins only.
end

PLUGIN:CanPlayerKnock(client, entity)

Whether or not a player can knock on the door with the hands SWEP.

Parameters

  • client Player

    Player attempting to knock

  • entity Entity

    Door being knocked on

Returns

  • bool

    Whether or not to allow the player to knock on the door

Example Usage

function PLUGIN:CanPlayerKnock(client, entity)
	return false -- Disable knocking on doors outright.
end

PLUGIN:CanPlayerOpenShipment(client, entity)

Whether or not a player can open a shipment spawned from the business menu.

Parameters

  • client Player

    Player attempting to open the shipment

  • entity Entity

    Shipment entity

Returns

  • bool

    Whether or not to allow the player to open the shipment

Example Usage

function PLUGIN:CanPlayerOpenShipment(client, entity)
	return client:Team() == FACTION_BMD -- Restricts opening shipments to FACTION_BMD.
end

PLUGIN:CanPlayerSpawnContainer(client, model, entity)

Whether or not a player is allowed to spawn a container entity.

Parameters

  • client Player

    Player attempting to spawn a container

  • model string

    Model of the container being spawned

  • entity Entity

    Container entity

Returns

  • bool

    Whether or not to allow the player to spawn the container

Example Usage

function PLUGIN:CanPlayerSpawnContainer(client, model, entity)
	return client:IsAdmin() -- Restrict spawning containers to admins.
end

PLUGIN:CanPlayerTakeItem(client, item)

Whether or not a player is allowed to take an item and put it in their inventory.

Parameters

  • client Player

    Player attempting to take the item

  • item Entity

    Entity corresponding to the item

Returns

  • bool

    Whether or not to allow the player to take the item

Example Usage

function PLUGIN:CanPlayerTakeItem(client, item)
	return !(client:GetMoveType() == MOVETYPE_NOCLIP and !client:InVehicle()) -- Disallow players in observer taking items.
end

PLUGIN:CanPlayerThrowPunch(client)

Whether or not the player is allowed to punch with the hands SWEP.

Parameters

  • client Player

    Player attempting throw a punch

Returns

  • bool

    Whether or not to allow the player to punch

Example Usage

function PLUGIN:CanPlayerThrowPunch(client)
	return client:GetCharacter():GetAttribute("str", 0) > 0 -- Only allow players with strength to punch.
end

PLUGIN:CanPlayerTradeWithVendor(client, entity, uniqueID, isSellingToVendor)

Whether or not a player can trade with a vendor.

Parameters

  • client Player

    Player attempting to trade

  • uniqueID string

    The uniqueID of the item being traded.

  • isSellingToVendor boolean

    If the client is selling to the vendor

Returns

  • bool

    Whether or not to allow the client to trade with the vendor

Example Usage

function PLUGIN:CanPlayerTradeWithVendor(client, entity, uniqueID, isSellingToVendor)
	return false -- Disallow trading with vendors outright.
end

PLUGIN:CanPlayerUnequipItem(client, item)

Whether or not a player can unequip an item.

Parameters

  • client Player

    Player attempting to unequip an item

  • item table

    Item being unequipped

Returns

  • bool

    Whether or not to allow the player to unequip the item

Example Usage

function PLUGIN:CanPlayerUnequipItem(client, item)
	return false -- Disallow unequipping items.
end

See Also

PLUGIN:CanPlayerUseBusiness(client, uniqueID)

Whether or not a player can buy an item from the business menu.

Parameters

  • client Player

    Player that uses a business menu

  • uniqueID string

    The uniqueID of the business menu item

Returns

  • bool

    Whether or not to allow the player to buy an item from the business menu

Example Usage

function PLUGIN:CanPlayerUseBusiness(client, uniqueID)
 return false -- Disallow buying from the business menu.
end

PLUGIN:CanPlayerUseCharacter(client, character)

Whether or not a player can use a character.

Parameters

  • client Player

    Player that wants to use a character

  • character Character

    Character that a player wants to use

Returns

  • bool

    Whether or not to allow the player to load a character

Example Usage

function PLUGIN:CanPlayerUseCharacter(client, character)
	return false -- Disallow using any character.
end

PLUGIN:CanPlayerUseDoor(client, entity)

Whether or not a player can use a door.

Parameters

  • client Player

    Player that wants to use a door

  • entity Entity

    Door that a player wants to use

Returns

  • bool

    Whether or not to allow the player to use a door

Example Usage

function PLUGIN:CanPlayerUseDoor(client, character)
	return false -- Disallow using any door.
end

PLUGIN:CanPlayerUseVendor(activator, vendor)

Determines whether a player can use a vendor.

Parameters

  • activator Player

    The player attempting to use the vendor

  • vendor Entity

    The vendor entity being used

Returns

  • bool

    Returns false if the player can't use the vendor

PLUGIN:CanPlayerViewInventory()

Whether or not a player can view his inventory.

Returns

  • bool

    Whether or not to allow the player to view his inventory

Example Usage

function PLUGIN:CanPlayerViewInventory()
	return false -- Prevent player from viewing his inventory.
end

PLUGIN:CanSaveContainer(entity, inventory)

Whether or not to save a container.

Parameters

  • entity Entity

    Container entity to save

  • inventory table

    Container inventory

Returns

  • bool

    Whether or not to save a container

Example Usage

function PLUGIN:CanSaveContainer(entity, inventory)
 return false -- Disallow saving any container.
end

PLUGIN:CanTransferItem(item, currentInv, oldInv)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • item

  • currentInv

  • oldInv

PLUGIN:CharacterAttributeBoosted(client, character, attribID, boostID, boostAmount)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • client

  • character

  • attribID

  • boostID

  • boostAmount

PLUGIN:CharacterAttributeUpdated(client, self, key, value)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • client

  • self

  • key

  • value

PLUGIN:CharacterDeleted(client, id, isCurrentChar)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • client

  • id

  • isCurrentChar

PLUGIN:CharacterHasFlags(self, flags)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • self

  • flags

PLUGIN:CharacterLoaded(character)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • character

PLUGIN:CharacterPostSave(character)

Called when a character was saved.

Parameters

PLUGIN:CharacterPreSave(character)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • character

PLUGIN:CharacterRecognized()

Incomplete

Documentation for this section is incomplete and needs expanding.

PLUGIN:CharacterRestored(character)

Called when a character was restored.

Parameters

PLUGIN:CharacterVarChanged(character, key, oldVar, value)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • character

  • key

  • oldVar

  • value

PLUGIN:CharacterVendorTraded(client, entity, uniqueID, isSellingToVendor)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • client

  • entity

  • uniqueID

  • isSellingToVendor

PLUGIN:ChatboxCreated()

Incomplete

Documentation for this section is incomplete and needs expanding.

PLUGIN:ChatboxPositionChanged(x, y, width, height)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • x

  • y

  • width

  • height

PLUGIN:ColorSchemeChanged(color)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • color

PLUGIN:ContainerRemoved(container, inventory)

Called when a container was removed.

Parameters

  • container Entity

    Container that was removed

  • inventory table

    Container inventory

PLUGIN:CreateCharacterInfo(panel)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • panel

PLUGIN:CreateCharacterInfoCategory(panel)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • panel

PLUGIN:CreateItemInteractionMenu(icon, menu, itemTable)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • icon

  • menu

  • itemTable

PLUGIN:CreateMenuButtons(tabs)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • tabs

PLUGIN:CreateShipment(client, entity)

Called when a shipment was created.

Parameters

  • client Player

    Player that ordered the shipment

  • entity Entity

    Shipment entity

PLUGIN:DatabaseConnected()

Called when a server has connected to the database.

PLUGIN:DatabaseConnectionFailed(error)

Called when a server failed to connect to the database.

Parameters

  • error string

    Error that prevented server from connecting to the database

PLUGIN:DoPluginIncludes(path, pluginTable)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • path

  • pluginTable

PLUGIN:DrawCharacterOverview()

Incomplete

Documentation for this section is incomplete and needs expanding.

PLUGIN:DrawHelixModelView(panel, entity)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • panel

  • entity

PLUGIN:DrawPlayerRagdoll(entity)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • entity

PLUGIN:GetCharacterDescription(client)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • client

PLUGIN:GetCharacterName(speaker, chatType)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • speaker

  • chatType

PLUGIN:GetChatPrefixInfo(text)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • text

PLUGIN:GetCrosshairAlpha(curAlpha)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • curAlpha

PLUGIN:GetDefaultAttributePoints(client, count)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • client

  • count

PLUGIN:GetDefaultCharacterName(client, faction)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • client

  • faction

PLUGIN:GetMaxPlayerCharacter(client)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • client

PLUGIN:GetPlayerDeathSound(client)

Returns the sound to emit from the player upon death. If nothing is returned then it will use the default male/female death sounds.

Parameters

  • client Player

    Player that died

Returns

  • string

    Sound to play

  • OR
  • bool

    false if a sound shouldn't be played at all

Example Usage

function PLUGIN:GetPlayerDeathSound(client)
	-- play impact sound every time someone dies
	return "physics/body/body_medium_impact_hard1.wav"
end
function PLUGIN:GetPlayerDeathSound(client)
	-- don't play a sound at all
	return false
end

PLUGIN:GetPlayerEntityMenu(client, options)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • client

  • options

PLUGIN:GetPlayerIcon(speaker)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • speaker

PLUGIN:GetPlayerPainSound(client)

Returns the sound to emit from the player upon getting damage.

Parameters

  • client Player

    Client that received damage

Returns

Example Usage

function PLUGIN:GetPlayerPainSound(client)
	return "NPC_MetroPolice.Pain" -- Make players emit MetroPolice pain sound.
end

PLUGIN:GetPlayerPunchDamage(client, damage, context)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • client

  • damage

  • context

PLUGIN:GetSalaryAmount(client, faction)

Returns the salary that character should get instead of his faction salary.

Parameters

  • client Player

    Client that is receiving salary

  • faction table

    Faction of the player's character

Returns

  • number

    Character salary

Example Usage

function PLUGIN:GetSalaryAmount(client, faction)
 return 0 -- Everyone get no salary.
end

See Also

PLUGIN:GetTypingIndicator(character, text)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • character

  • text

PLUGIN:InitializedChatClasses()

Registers chat classes after the core framework chat classes have been registered. You should usually create your chat classes in this hook - especially if you want to reference the properties of a framework chat class.

Example Usage

function PLUGIN:InitializedChatClasses()
	-- let's say you wanted to reference an existing chat class's color
	ix.chat.Register("myclass", {
		format = "%s says \"%s\"",
		GetColor = function(self, speaker, text)
			-- make the chat class slightly brighter than the "ic" chat class
			local color = ix.chat.classes.ic:GetColor(speaker, text)

			return Color(color.r + 35, color.g + 35, color.b + 35)
		end,
		-- etc.
	})
end

See Also

PLUGIN:InitializedConfig()

Incomplete

Documentation for this section is incomplete and needs expanding.

PLUGIN:InitializedPlugins()

Incomplete

Documentation for this section is incomplete and needs expanding.

PLUGIN:InitializedSchema()

Incomplete

Documentation for this section is incomplete and needs expanding.

PLUGIN:InventoryItemAdded(oldInv, inventory, item)

Called when an item was added to the inventory.

Parameters

  • oldInv table

    Previous item inventory

  • inventory table

    New item inventory

  • item table

    Item that was added to the inventory

PLUGIN:InventoryItemRemoved(inventory, item)

Called when an item was removed from the inventory.

Parameters

  • inventory table

    Inventory from which item was removed

  • item table

    Item that was removed from the inventory

PLUGIN:IsCharacterRecognized(character, id)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • character

  • id

PLUGIN:IsPlayerRecognized(client)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • client

PLUGIN:IsRecognizedChatType(chatType)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • chatType

PLUGIN:LoadData()

Called when server is loading data.

PLUGIN:LoadFonts(font, genericFont)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • font

  • genericFont

PLUGIN:LoadIntro()

Incomplete

Documentation for this section is incomplete and needs expanding.

PLUGIN:MenuSubpanelCreated(subpanelName, panel)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • subpanelName

  • panel

PLUGIN:MessageReceived(client, info)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • client

  • info

PLUGIN:OnAreaChanged(oldID, newID)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • oldID

  • newID

PLUGIN:OnCharacterCreated(client, character)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • client

  • character

PLUGIN:OnCharacterDisconnect(client, character)

Called when a player who uses a character has disconnected.

Parameters

  • client Player

    The player that has disconnected

  • character Character

    The character that the player was using

PLUGIN:OnCharacterFallover(client, entity, bFallenOver)

Called when a character was ragdolled or unragdolled.

Parameters

  • client Player

    Player that was ragdolled or unradolled

  • entity Entity

    Ragdoll that represents the player

  • bFallenOver boolean

    Whether or not the character was ragdolled or unragdolled

PLUGIN:OnCharacterGetup(client, ragdoll)

Called when a character has gotten up from the ground.

Parameters

  • client Player

    Player that has gotten up

  • ragdoll Entity

    Ragdoll used to represent the player

PLUGIN:OnCharacterMenuCreated(panel)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • panel

PLUGIN:OnItemSpawned(entity)

Called whenever an item entity has spawned in the world. You can access the entity's item table with entity:GetItemTable().

Parameters

  • entity Entity

    Spawned item entity

Example Usage

function PLUGIN:OnItemSpawned(entity)
	local item = entity:GetItemTable()
	-- do something with the item here
end

PLUGIN:OnItemTransferred(item, curInv, inventory)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • item

  • curInv

  • inventory

PLUGIN:OnLocalVarSet(key, var)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • key

  • var

PLUGIN:OnPAC3PartTransferred(part)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • part

PLUGIN:OnPickupMoney(client, self)

Called when a player has picked up the money from the ground.

Parameters

  • client Player

    Player that picked up the money

Returns

  • bool

    Whether or not to allow the player to pick up the money

Example Usage

function PLUGIN:OnPickupMoney(client, self)
	return false -- Disallow picking up money.
end

PLUGIN:OnPlayerAreaChanged(client, oldID, newID)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • client

  • oldID

  • newID

PLUGIN:OnPlayerObserve(client, state)

Called when a player has entered or exited the observer mode.

Parameters

  • client Player

    Player that entered or exited the observer mode

  • state boolean

    Previous observer state

PLUGIN:OnPlayerOptionSelected(client, callingClient, option)

Called when a player has selected the entity interaction menu option while interacting with a player.

Parameters

  • client Player

    Player that other player has interacted with

  • callingClient Player

    Player that has interacted with with other player

  • option string

    Option that was selected

PLUGIN:OnPlayerPurchaseDoor(client, entity, bBuying, bCallOnDoorChild)

Called when a player has purchased or sold a door.

Parameters

  • client Player

    Player that has purchased or sold a door

  • entity Entity

    Door that was purchased or sold

  • bBuying boolean

    Whether or not the player is bying a door

  • bCallOnDoorChild function

    Function to call something on the door child

PLUGIN:OnPlayerRestricted(client)

Called when a player was restricted.

Parameters

  • client Player

    Player that was restricted

PLUGIN:OnPlayerUnRestricted(client)

Called when a player was unrestricted.

Parameters

  • client Player

    Player that was unrestricted

PLUGIN:OnSavedItemLoaded(loadedItems)

Called when a saved items were loaded.

Parameters

  • loadedItems table

    Table of items that were loaded

PLUGIN:OnWipeTables()

Called when server database are being wiped.

PLUGIN:PlayerEnterSequence(client, sequence, callback, time, bNoFreeze)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • client

  • sequence

  • callback

  • time

  • bNoFreeze

PLUGIN:PlayerInteractEntity(client, entity, option, data)

Called when a player has interacted with an entity through the entity's interaction menu.

Parameters

  • client Player

    Player that performed interaction

  • entity Entity

    Entity being interacted with

  • option string

    Option selected by the player

  • data

    Any data passed with the interaction option

PLUGIN:PlayerInteractItem(client, action, item)

Called when a player has interacted with an item.

Parameters

  • client Player

    Player that interacted with an item

  • action string

    Action selected by the player

  • item table

    Item being interacted with

PLUGIN:PlayerJoinedClass(client, class, oldClass)

Called when a player has joined a class.

Parameters

  • client Player

    Player that has joined a class

  • class number

    Index of the class player has joined to

  • oldClass number

    Index of the player's previous class

PLUGIN:PlayerLeaveSequence(entity)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • entity

PLUGIN:PlayerLoadedCharacter(client, character, currentChar)

Called when a player has loaded a character.

Parameters

  • client Player

    Player that has loaded a character

  • character Character

    Character that was loaded

  • currentChar Character

    Character that player was using

PLUGIN:PlayerLockedDoor(client, door, partner)

Called when a player has locked a door.

Parameters

  • client Player

    Player that has locked a door

  • door Entity

    Door that was locked

PLUGIN:PlayerLockedVehicle(client, vehicle)

Called when a player has locked a vehicle.

Parameters

  • client Player

    Player that has locked a vehicle

  • vehicle Entity

    Vehicle that was locked

PLUGIN:PlayerMessageSend(speaker, chatType, text, anonymous, receivers, rawText)

Called when player has said something in the text chat.

Parameters

  • speaker Player

    Player that has said something in the text chat

  • chatType string

    Type of the chat that player used

  • text string

    Chat message that player send

  • anonymous boolean

    Whether or not message was anonymous

  • receivers table

    Players who will hear that message

  • rawText string

    Chat message without any formatting

Returns

  • string

    You can return text that will be shown instead

Example Usage

function PLUGIN:PlayerMessageSend(speaker, chatType, text, anonymous, receivers, rawText)
 return "Text" -- When a player writes something into chat, he will say "Text" instead.
end

PLUGIN:PlayerModelChanged(client, oldModel)

Called when a player model was changed.

Parameters

  • client Player

    Player whose model was changed

  • oldModel string

    Old player model

PLUGIN:PlayerStaminaGained(client)

Called when a player has got stamina.

Parameters

  • client Player

    Player who has got stamina

PLUGIN:PlayerStaminaLost(client)

Called when a player has lost stamina.

Parameters

  • client Player

    Player who has lost stamina

PLUGIN:PlayerThrowPunch(client, trace)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • client

  • trace

PLUGIN:PlayerUnlockedDoor(client, door, partner)

Called when a player has unlocked a door.

Parameters

  • client Player

    Player that has unlocked a door

  • door Entity

    Door that was unlocked

PLUGIN:PlayerUnlockedVehicle(client, vehicle)

Called when a player has unlocked a vehicle.

Parameters

  • client Player

    Player that has unlocked a vehicle

  • vehicle Entity

    Vehicle that was unlocked

PLUGIN:PlayerUse(client, entity)

Called when a player has used an entity.

Parameters

  • client Player

    Player who has used an entity

  • entity Entity

    Entity that was used by the player

PLUGIN:PlayerUseDoor(client, entity)

Called when a player has used a door.

Parameters

  • client Player

    Player who has used a door

  • entity Entity

    Door that was used by the player

PLUGIN:PlayerWeaponChanged(client, weapon)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • client

  • weapon

PLUGIN:PluginLoaded(uniqueID, pluginTable)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • uniqueID

  • pluginTable

PLUGIN:PluginShouldLoad(uniqueID)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • uniqueID

PLUGIN:PluginUnloaded(uniqueID)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • uniqueID

PLUGIN:PopulateCharacterInfo(client, character, tooltip)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • client

  • character

  • tooltip

PLUGIN:PopulateEntityInfo(entity, tooltip)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • entity

  • tooltip

PLUGIN:PopulateHelpMenu(categories)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • categories

PLUGIN:PopulateImportantCharacterInfo(entity, character, tooltip)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • entity

  • character

  • tooltip

PLUGIN:PopulateItemTooltip(tooltip, item)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • tooltip

  • item

PLUGIN:PopulatePlayerTooltip(client, tooltip)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • client

  • tooltip

PLUGIN:PopulateScoreboardPlayerMenu(client, menu)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • client

  • menu

PLUGIN:PostChatboxDraw(width, height, alpha)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • width

  • height

  • alpha

PLUGIN:PostDrawHelixModelView(panel, entity)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • panel

  • entity

PLUGIN:PostDrawInventory(panel)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • panel

PLUGIN:PostLoadData()

Called when server data was loaded.

PLUGIN:PostPlayerLoadout(client)

Called after player loadout.

Parameters

PLUGIN:PostPlayerSay(client, chatType, message, anonymous)

Called after player has said something in the text chat.

Parameters

  • client Player

    Player that has said something in the text chat

  • chatType string

    Type of the chat that player used

  • message string

    Chat message that player send

  • anonymous boolean

    Whether or not message was anonymous

PLUGIN:PostSetupActs()

Incomplete

Documentation for this section is incomplete and needs expanding.

PLUGIN:PreCharacterDeleted(client, character)

Called before character deletion.

Parameters

  • client Player

    Character owner

  • character Character

    Chraracter that will be deleted

PLUGIN:PrePlayerLoadedCharacter(client, character, currentChar)

Called before character loading.

Parameters

  • client Player

    Player that loading a character

  • character Character

    Character that will be loaded

  • currentChar Character

    Character that player is using

PLUGIN:PrePlayerMessageSend(client, chatType, message, bAnonymous)

Called before a message sent by a player is processed to be sent to other players - i.e this is ran as early as possible and before things like the auto chat formatting. Can be used to prevent the message from being sent at all.

Parameters

  • client Player

    Player sending the message

  • chatType string

    Chat class of the message

  • message string

    Contents of the message

  • bAnonymous boolean

    Whether or not the player is sending the message anonymously

Returns

  • bool

    Whether or not to prevent the message from being sent

Example Usage

function PLUGIN:PrePlayerMessageSend(client, chatType, message, bAnonymous)
	if (!client:IsAdmin()) then
		return false -- only allow admins to talk in chat
	end
end

PLUGIN:SaveData()

Called when server is saving data.

PLUGIN:ScreenResolutionChanged(width, height)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • width

  • height

PLUGIN:SetupActs()

Incomplete

Documentation for this section is incomplete and needs expanding.

PLUGIN:SetupAreaProperties()

Incomplete

Documentation for this section is incomplete and needs expanding.

PLUGIN:ShipmentItemTaken(client, uniqueID, amount)

Called when a player has taken a shipment item.

Parameters

  • client Player

    Player that has taken a shipment item

  • uniqueID string

    UniqueID of the shipment item that was taken

  • amount number

    Amount of the items that were taken

PLUGIN:ShouldBarDraw(bar)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • bar

PLUGIN:ShouldDeleteSavedItems()

Whether or not the server should delete saved items.

Returns

  • bool

    Whether or not the server should delete saved items

Example Usage

function PLUGIN:ShouldDeleteSavedItems()
 return true -- Delete all saved items.
end

PLUGIN:ShouldDisplayArea(newID)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • newID

PLUGIN:ShouldDrawCrosshair(client, weapon)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • client

  • weapon

PLUGIN:ShouldDrawItemSize(item)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • item

PLUGIN:ShouldHideBars()

Incomplete

Documentation for this section is incomplete and needs expanding.

PLUGIN:ShouldPermakillCharacter(client, character, inflictor, attacker)

Whether or not a character should be permakilled upon death. This is only called if the permakill server config is enabled.

Parameters

  • client Player

    Player to permakill

  • character Character

    Player's current character

  • inflictor Entity

    Entity that inflicted the killing blow

  • attacker Entity

    Other player or entity that killed the player

Returns

  • bool

    false if the player should not be permakilled

Example Usage

function PLUGIN:ShouldPermakillCharacter(client, character, inflictor, attacker)
		if (client:IsAdmin()) then
			return false -- all non-admin players will have their character permakilled
		end
	end

PLUGIN:ShouldPlayerDrowned(client)

Whether or not player should drown.

Parameters

  • client Player

    Player that is underwater

Returns

  • bool

    Whether or not player should drown

Example Usage

function PLUGIN:ShouldPlayerDrowned(client)
 return false -- Players will not drown.
end

PLUGIN:ShouldRemoveRagdollOnDeath(client)

Whether or not remove player ragdoll on death.

Parameters

  • client Player

    Player that died

Returns

  • bool

    Whether or not remove player ragdoll on death

Example Usage

function PLUGIN:ShouldRemoveRagdollOnDeath(client)
 return false -- Player ragdolls will not be removed.
end

PLUGIN:ShouldRestoreInventory(characterID, inventoryID, inventoryType)

Whether or not to restore character inventory.

Parameters

  • characterID number

    ID of the character

  • inventoryID number

    ID of the inventory

  • inventoryType string

    Type of the inventory

Returns

  • bool

    Whether or not to restore character inventory

Example Usage

function PLUGIN:ShouldRestoreInventory(characterID, inventoryID, inventoryType)
 return false -- Character inventories will not be restored.
end

PLUGIN:ShouldShowPlayerOnScoreboard(client)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • client

PLUGIN:ShouldSpawnClientRagdoll(client)

Whether or not spawn player ragdoll on death.

Parameters

  • client Player

    Player that died

Returns

  • bool

    Whether or not spawn player ragdoll on death

Example Usage

function PLUGIN:ShouldSpawnClientRagdoll(client)
 return false -- Player ragdolls will not be spawned.
end

PLUGIN:ShowEntityMenu(entity)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • entity

PLUGIN:ThirdPersonToggled(oldValue, value)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • oldValue

  • value

PLUGIN:UpdateCharacterInfo(panel, character)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • panel

  • character

PLUGIN:UpdateCharacterInfoCategory(panel, character)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • panel

  • character

PLUGIN:VoiceDistanceChanged(newValue)

Called when the distance on which the voice can be heard was changed.

Parameters

  • newValue number

    New voice distance

PLUGIN:WeaponCycleSound()

Incomplete

Documentation for this section is incomplete and needs expanding.

PLUGIN:WeaponSelectSound(weapon)

Incomplete

Documentation for this section is incomplete and needs expanding.

Parameters

  • weapon