GM
Hooks
CalcView(ply, origin, angles, fov, znear, zfar)
View source »Hook called to calculate a player's view.
Parameters
-
ply
Player
LocalPlayer.
-
origin
Vector
View Origin Position
-
angles
Angle
View Oriign Angle
-
fov
number
Field of View.
-
znear
number
Distance to Near Clip Field
-
zfar
number
Distance to Far Clip Field
See Also
CanPlayerInteract(client, entity, data)
View source »Called when a player attempts to use an interaction
Parameters
-
client
Player
The client that used the interaction
-
entity
Entity
The entity that the interaction was used on
-
data
tab
The data of the interaction used, see interactions for data structure
HUDDrawTargetEntity(ent, class, alpha, x, y)
View source »Draw a Target HUD for the given entity.
Parameters
-
ent
Entity
Entity to draw target HUD for.
-
class
string
Entity Classname.
-
alpha
number
Current draw alpha value.
-
x
number
-
y
number
InventoryLoaded(inventory)
View source »Called when an inventory is fully loaded from the database, including all items.
Parameters
-
inventory
INVENTORY
Inventory being loaded.
ItemCreated(item, inventory)
View source »Called when a new item is created for the first time. This is only called for when an item is first created, not when it is loaded from the database. This is used for calling item.onCreate, which is intended for creating initial persistent item data such as inventories.
Parameters
-
item
ITEM
Item being create.
-
inventory
INVENTORY
Inventory the item is being created in.
ItemLoaded(item, inventory)
View source »Called when a specific item is loaded from the database.
Parameters
-
item
ITEM
Item being loaded.
-
inventory
INVENTORY
Inventory the item is being loaded into.
See Also
LoadPlayerInventories(Client)
View source »Called when a player is done loading their primary inventory, this is a good time to load any additonal related inventories
Parameters
-
Client
client
The client which is loading in
PlayerCanJoinTeam(ply, team)
View source »Called when a player attempts to join a team.
Parameters
-
ply
Player
Player joining the team.
-
team
number
Team Index
PlayerCanSayLOOC(ply, text)
View source »Called when a player attempts to say something in local OOC.
Parameters
-
ply
Player
Player attempting to speak in local OOC.
-
text
string
Text being said in local OOC.
PlayerCanSayOOC(ply, text)
View source »Called when a player attempts to say something in OOC.
Parameters
-
ply
Player
Player attempting to speak in OOC.
-
text
string
Text being said in OOC.
PlayerCanUseCommand(ply, cmd, args)
View source »Called when attempts to use a command.
Parameters
-
ply
Player
The player attempting to use the command.
-
cmd
string
The command being ran.
-
args
tab
The arguments list of the command being ran.
PlayerDemote(ply, target, team, reason)
View source »Called after a player demotes another player.
Parameters
-
ply
Player
Player who issued the demotion.
-
target
Player
Demotion target.
-
team
number
Team the target has been demoted from. test
-
reason
string
optional
The reason the player was demoted for.
PlayerInteracted(client, entity, data)
View source »Called when a player uses an interaction
Parameters
-
client
Player
The client that used the interaction
-
entity
Entity
The entity that the interaction was used on
-
data
tab
The data of the interaction used, see interactions for data structure
PlayerItemAttemptDropped(ply, uid, amount, item)
View source »Called when a player has attempted to drop an item, but is blocked by onDrop. This doesn't guarantee nothing happened, some items use this to handle dropping themselves.
Parameters
-
ply
Player
Player attempting to drop the item.
-
uid
string
Item Unique ID.
-
amount
int
Number of items being dropped.
-
item
ITEM
Item being dropped.
PlayerItemAttemptGave(ply, uid, target, amount, item)
View source »Called when a player has attempted to drop an item, but is blocked by onDrop.
Parameters
-
ply
Player
Player attempting to drop the item.
-
uid
string
Item Unique ID.
-
target
Player
Player receiving the items.
-
amount
int
Number of items being dropped.
-
item
ITEM
Item being dropped.
PlayerItemAttemptUsed(ply, uid, item)
View source »Called when a player has attempted to use an item, but is blocked by onUse.
Parameters
-
ply
Player
Player who attempted the use.
-
uid
string
Item Unique ID.
-
item
ITEM
Item being used.
PlayerItemDrop(ply, uid, amount, item)
View source »Called when a player attempts to drop an item.
Parameters
-
ply
Player
Player attempting to drop the item.
-
uid
string
Item Unique ID.
-
amount
int
Number of items being dropped.
-
item
ITEM
Item being dropped.
PlayerItemDropped(ply, uid, amount, item)
View source »Called when a player has dropped an item and is having it removed from their inventory.
Parameters
-
ply
Player
Player attempting to drop the item.
-
uid
string
Item Unique ID.
-
amount
int
Number of items being dropped.
-
item
ITEM
Item being dropped.
PlayerItemGave(ply, uid, target, amount, item)
View source »Called when a player has given an item.
Parameters
-
ply
Player
Player attempting to give the item.
-
uid
string
Item Unique ID.
-
target
Player
Player receiving the items.
-
amount
int
Number of items being dropped.
-
item
ITEM
Item being dropped.
PlayerItemGive(ply, uid, target, amount, item)
View source »Called when a player attempts to give an item.
Parameters
-
ply
Player
Player attempting to give the item.
-
uid
string
Item Unique ID.
-
target
Player
Player receiving the items.
-
amount
int
Number of items being given.
-
item
ITEM
Item being given.
PlayerItemRemove(ply, uid, item)
View source »Called when a player attempts to remove an item.
Parameters
-
ply
Player
Player attempting to remove the item.
-
uid
string
Item Unique ID.
-
item
ITEM
Item being removed.
PlayerItemRemoved(ply, uid, item)
View source »Called when a player has removed an item.
Parameters
-
ply
Player
Player who attempted the use.
-
uid
string
Item Unique ID.
-
item
ITEM
Item being used.
PlayerItemUse(ply, uid, item)
View source »Called when a player attempts to use an item.
Parameters
-
ply
Player
Player attempting to use the item.
-
uid
string
Item Unique ID.
-
item
ITEM
Item being used.
PlayerItemUsed(ply, uid, item)
View source »Called when a player has used an item and is having it removed from their inventory.
Parameters
-
ply
Player
Player who attempted the use.
-
uid
string
Item Unique ID.
-
item
ITEM
Item being used.
PlayerLocalVarUpdated(key, value)
View source »Called when a local player variable is updated
Parameters
-
key
string
Key
-
value
New Value
PlayerSay(ply, text, isTeamChat)
View source »Called when a player says something.
Parameters
-
ply
Player
Player messaging.
-
text
string
Message being sent.
-
isTeamChat
bool
If the message is intended for a team chat, or globally.
PlayerSwitchFlashlight(ply, on)
View source »Called when a player switches their flashlight on or off.
Parameters
-
ply
Player
The player switching their flashlight.
-
on
bool
The requested flashlight state.
PlayerWarrant(ply, target, class)
View source »Called when a player warrants another player.
Parameters
-
ply
Player
Player who initiated the warrant.
-
target
Player
Warrant target.
-
class
string
Warrant Type.
ShouldCleanupItem(item)
View source »Called to see if this item should be cleaned up as part of the world inventory cleanup process
Parameters
-
item
table
The item to check, please note this is not an item object but rather a table with the raw DB values. We do not create an item as they're all about to (mostly) be deleted anyway
Functions
CanEntitySetModel(entity, string)
View source »Called before an entity has their model set via SetModel
Parameters
-
entity
Entity
that had their model set
-
string
Model
path
Returns
-
boolean Return false to prevent the model from being set
CanPlayerTransferItem(client, item, invFrom, invTo)
View source »Called when the player attempts to transfer an item from one inventory to another. Note: This has to return true, otherwise it will be rejected. Any hook returning false will stop a transfer, so please be careful with your conditions if you use this hook to prevent denying everything.
Parameters
-
client
-
item
-
invFrom
-
invTo
ConnectToDatabase()
View source »Function to connect to the database.
EntitySetModel(entity, string)
View source »Called after an entity has their model set via SetModel
Parameters
-
entity
Entity
that had their model set
-
string
Model
path
HUDAmmoPickedUp(_ammo, _amt)
View source »Hook called when ammo is picked up.
Parameters
-
_ammo
-
_amt
HUDDrawTargetID()
View source »Hook called to draw the entity under cursor HUD.
HUDItemPickedUp(_name)
View source »Hook called when an item is picked up.
Parameters
-
_name
HUDPaint()
View source »Called every time the HUD should be painted.
HUDWeaponPickedUp(_w)
View source »Hook called when a weapon is picked up.
Parameters
-
_w
InitPostEntity()
View source »Called when all of the map entities have been initialized.
OnShowItemAction(item, action, data, dropMenu)
View source »Called when a player rights clicks an item
Parameters
-
item
Item
Item object
-
action
string
Action name
-
data
item_action
Item action data
-
dropMenu
DMenu
Right click item menu
PlayerArrest(_ply, _target)
View source »Called when a player arrests another player.
Parameters
-
_ply
-
_target
PlayerCanDemote(ply, _target)
View source »Called when a player attempts to demote another player.
Parameters
-
ply
-
_target
PlayerCanHearPlayersVoice(listener, talker)
View source »Check if a player can hear another player's voice.
Parameters
-
listener
-
talker
Get player tables once
PlayerCanOwnDoor(_ply, _door)
This function is deprecated and may be removed in a future version.
Called when a player attempts to own a door.
Parameters
-
_ply
-
_door
PlayerCanPromote(ply, _target)
This function is deprecated and may be removed in a future version.
Called when a player attempts to promote another player.
Parameters
-
ply
-
_target
PlayerCanSayIC(ply, _text)
View source »Called when a player attempts to say something in-character.
Parameters
-
ply
-
_text
PlayerCanUnwarrant(ply, _target)
View source »Called when a player attempts to unwarrant a player.
Parameters
-
ply
-
_target
PlayerCanViewDoor(_ply, _door)
View source »Called when a player attempts to view a door.
Parameters
-
_ply
-
_door
PlayerHostage(_ply, _target)
View source »Called when a player hostage another player.
Parameters
-
_ply
-
_target
PlayerInitialNetwork(client)
View source »Called when the player can reliably receieve net msgs when initially joining
Parameters
-
client
Player
PlayerKnockOut(_ply, _target)
View source »Called after a player knocks out another player. test
Parameters
-
_ply
-
_target
PlayerKnockedOut(Player)
View source »Called when a player is knocked out for any reason (ragdolled)
Parameters
-
Player
client
The player who has been ragdolled
PlayerLoadoutResetVars(client)
View source »Documentation for this section is incomplete and needs expanding.
Parameters
-
client
Player
PlayerSpray(_ply)
View source »Called when a player attempts to spray
Parameters
-
_ply
PlayerUnarrest(_ply, _target)
View source »Called when a player unarrests another player.
Parameters
-
_ply
-
_target
PlayerUnwarrant(_ply, _target)
View source »Called when a player unwarrants another player.
Parameters
-
_ply
-
_target
PlayerUse(ply, ent)
View source »Called when a player attempts to use an entity.
Parameters
-
ply
-
ent
PlayerWakeUp(_ply, _target)
View source »Called when a player wakes up another player.
Parameters
-
_ply
-
_target
PopulateCharacterInfo(client, character, tooltip)
View source »Hook to draw less important player information (shows under important) when they're looked at
Parameters
-
client
Player
-
character
Character
-
tooltip
cityrpTooltip
PopulateImportantCharacterInfo(client, character, tooltip)
View source »Hook to draw important player information when they're looked at
Parameters
-
client
Player
-
character
Character
-
tooltip
cityrpTooltip
PostPlayerLoadout(client)
View source »Documentation for this section is incomplete and needs expanding.
Parameters
-
client
Player
ScreenResolutionChanged(oldW, oldH)
View source »Function called when the screen resolution changes.
Parameters
-
oldW
-
oldH
StartChat()
View source »Called when a player begins typing.
Tables
CityRPServerConfig
View source »Documentation for this section is incomplete and needs expanding.
Fields
-
The
string
hostname or IP of the MySQL server.
-
MySQL
number
TCP port (usually 3306).
-
MySQL
number
TCP port (usually 3306).
-
MySQL
number
TCP port (usually 3306).
-
Database
string
name used by CityRP.
-
Table
string
name for RP points reasons.
-
Table
string
name for RP points reasons.
-
Table
string
name for RP points reasons.
-
Table
string
name for RP points reasons.
-
Table
string
name for RP points reasons.
-
Table
string
name for RP points reasons.
-
Development
boolean
optimization flag.
-
Whether
boolean
area editing is enabled.
-
Environment
"] "production"|"development"|"beta"|"build" Environment name.
CommandRestrictions
View source »Dictionary of command restrictions.
Fields
-
sleep
-
wakeup
-
y
-
w
-
hr
-
h
-
help
-
helpr
-
hud
-
me
-
it
-
team
-
afk
Fields
cachedQueries
This function is deprecated and may be removed in a future version.
A list of cached queries to call.
entities
View source »A table which holds map-start entities