Skip to content
On this page

Athena.player.events

Type Aliases

AthenaPlayerEvents

Ƭ AthenaPlayerEvents: "drop-item" | "increased-play-time" | "item-equipped" | "item-unequipped" | "pickup-item" | "player-account-created" | "player-character-created" | "player-armour-set" | "player-died" | "player-disconnected" | "player-entered-vehicle-as-driver" | "player-health-set" | "player-left-vehicle-seat" | "player-pos-set" | "player-skin-cleared" | "player-skin-set" | "player-uniform-cleared" | "player-uniform-set" | "player-weapon-unequipped" | "respawned" | "selected-character" | "set-account-data" | "spawned"

Defined in

server/player/events.ts:6

Functions

on

Usage

Athena.player.events.on(eventName, callback): any

Called when a player item has changed from unequipped to equipped.

Parameters

NameType
eventName"item-equipped"
callback(player: Player, slot: number, type: InventoryType) => void

Returns

any

Defined in

server/player/events.ts:68

Usage

Athena.player.events.on(eventName, callback): any

Called when a player item has changed to unequipped

Parameters

NameType
eventName"item-unequipped"
callback(player: Player, slot: number, type: InventoryType) => void

Returns

any

Defined in

server/player/events.ts:80

Usage

Athena.player.events.on(eventName, callback): any

Called when a player has died.

Parameters

NameType
eventName"player-died"
callback(player: Player) => void

Returns

any

Defined in

server/player/events.ts:92

Usage

Athena.player.events.on(eventName, callback): any

Called when a player uniform has been set. Check characterDocument.data

Parameters

NameType
eventName"player-uniform-set"
callback(player: Player) => void

Returns

any

Defined in

server/player/events.ts:102

Usage

Athena.player.events.on(eventName, callback): any

Called when a player uniform has been cleared. Uniform is set to undefined / null

Parameters

NameType
eventName"player-uniform-cleared"
callback(player: Player) => void

Returns

any

Defined in

server/player/events.ts:112

Usage

Athena.player.events.on(eventName, callback): any

Called when a player has their model set to non-multiplayer models.

Parameters

NameType
eventName"player-skin-set"
callback(player: Player) => void

Returns

any

Defined in

server/player/events.ts:121

Usage

Athena.player.events.on(eventName, callback): any

Called when a player has their model cleared to a multiplayer model.

Parameters

NameType
eventName"player-skin-cleared"
callback(player: Player) => void

Returns

any

Defined in

server/player/events.ts:130

Usage

Athena.player.events.on(eventName, callback): any

Called when the internal safe health functions are invoked. This is never called when player.health is modified

Parameters

NameType
eventName"player-health-set"
callback(player: Player, oldValue: number) => void

Returns

any

Defined in

server/player/events.ts:140

Usage

Athena.player.events.on(eventName, callback): any

Called when the internal safe armour functions are invoked. This is never called when player.armour is modified.

Parameters

NameType
eventName"player-armour-set"
callback(player: Player, oldValue: number) => void

Returns

any

Defined in

server/player/events.ts:150

Usage

Athena.player.events.on(eventName, callback): any

Called when the internal safe position functions are invoked. This is never called when player.pos is modified.

Parameters

NameType
eventName"player-pos-set"
callback(player: Player, oldValue: IVector3) => void

Returns

any

Defined in

server/player/events.ts:160

Usage

Athena.player.events.on(eventName, callback): any

Called when playtime has increased slightly.

Parameters

NameType
eventName"increased-play-time"
callback(player: Player, newHours: number) => void

Returns

any

Defined in

server/player/events.ts:169

Usage

Athena.player.events.on(eventName, callback): any

Called when a player has dropped an item.

Parameters

NameType
eventName"drop-item"
callback(player: Player, storedItem: StoredItem) => void

Returns

any

Defined in

server/player/events.ts:178

Usage

Athena.player.events.on(eventName, callback): any

Called when a player picks up an item. The _id is a reference to the item in the database; or the item in the ItemDrops system.

Parameters

NameType
eventName"pickup-item"
callback(player: Player, _id: string) => void

Returns

any

Defined in

server/player/events.ts:188

Usage

Athena.player.events.on(eventName, callback): any

Called when a player selects a character

Parameters

NameType
eventName"selected-character"
callback(player: Player) => void

Returns

any

Defined in

server/player/events.ts:197

Usage

Athena.player.events.on(eventName, callback): any

Called when a player has been respawned by internal functions.

Parameters

NameType
eventName"respawned"
callback(player: Player) => void

Returns

any

Defined in

server/player/events.ts:206

Usage

Athena.player.events.on(eventName, callback): any

Called when a player has left a vehicle seat.

Parameters

NameType
eventName"player-left-vehicle-seat"
callback(player: Player, vehicle: Vehicle, seat: number) => void

Returns

any

Defined in

server/player/events.ts:215

Usage

Athena.player.events.on(eventName, callback): any

Called when a player enters a vehicle as a driver.

Parameters

NameType
eventName"player-entered-vehicle-as-driver"
callback(player: Player, vehicle: Vehicle) => void

Returns

any

Defined in

server/player/events.ts:227

Usage

Athena.player.events.on<T>(eventName, callback): any

Triggers when a player id is unbound from a document. Formally known as a disconnect event. PLAYER WILL BE UNDEFINED, DO NOT USE VARIABLE

Type parameters

Name
T

Parameters

NameType
eventName"player-disconnected"
callback(player: undefined, document: any) => void

Returns

any

Defined in

server/player/events.ts:242

Usage

Athena.player.events.on<T>(eventName, callback): any

Triggers when a player unequips a weapon.

Type parameters

Name
T

Parameters

NameType
eventName"player-weapon-unequipped"
callback(player: Player, slot: number, type: InventoryType) => void

Returns

any

Defined in

server/player/events.ts:252

Usage

Athena.player.events.on<T>(eventName, callback): any

Called when a new account is created.

This means a new account is now bound to a new player.

Any additional document changes with this event will need to handled through the Athena.document.account system.

Type parameters

Name
T

Parameters

NameType
eventName"player-account-created"
callback(player: Player) => void

Returns

any

Defined in

server/player/events.ts:269

Usage

Athena.player.events.on<T>(eventName, callback): any

Called when a new character is created.

This means a new character is now bound to a player.

Any additional document changes with this event will need to handled through the Athena.document.player system.

Type parameters

Name
T

Parameters

NameType
eventName"player-character-created"
callback(player: Player) => void

Returns

any

Defined in

server/player/events.ts:283

Usage

Athena.player.events.on<T>(eventName, callback): any

Called when a player has set their account data.

Called immediately after authentication.

Export

Type parameters

Name
T

Parameters

NameType
eventName"set-account-data"
callback(player: Player) => void

Returns

any

Defined in

server/player/events.ts:295


trigger

Usage

Athena.player.events.trigger<CustomEvents>(eventName, player, ...args): void

Usually called by internal functions. Can be used to manually trigger an Athena Event though.

Type parameters

NameType
CustomEventsAthenaPlayerEvents

Parameters

NameTypeDescription
eventNameCustomEvents
playerPlayerAn alt:V Player Entity
...argsany[]-

Returns

void

Defined in

server/player/events.ts:43

Created by Stuyk | Est. 2020