Skip to content
On this page

Athena.player.toolbar

Functions

add

Usage

Athena.player.toolbar.add(player, item): Promise<boolean>

Add a new stored item to a user, must specify a quantity of greater than zero. Toolbar only.

Parameters

NameTypeDescription
playerPlayerAn alt:V Player Entity
itemOmit<StoredItem, "slot">

Returns

Promise<boolean>

Defined in

server/player/toolbar.ts:16


getAt

Usage

Athena.player.toolbar.getAt<CustomData>(player, slot): player<CustomData> | undefined

Returns an item from a specific slot.

This item is cloned, and not attached to the toolbar.

Never modify the item directly; this is only to get item information.

Example

ts
const someData = Athena.player.toolbar.getAt<{ myCustomStuff: string }>(somePlayer, someSlot);

Type parameters

NameType
CustomData{}

Parameters

NameTypeDescription
playerPlayerAn alt:V Player Entity
slotnumber

Returns

player<CustomData> | undefined

Defined in

server/player/toolbar.ts:240


getItemData

Usage

Athena.player.toolbar.getItemData<CustomData>(player, slot): CustomData | undefined

Returns the custom item data assigned to a specific item.

Will return undefined if the custom data is not available.

Only checks the toolbar.

Example

ts
const someData = Athena.player.toolbar.getItemData<{ myCustomStuff: string }>(somePlayer, someSlot);

Type parameters

NameType
CustomData{}

Parameters

NameTypeDescription
playerPlayerAn alt:V Player Entity
slotnumber

Returns

CustomData | undefined

Defined in

server/player/toolbar.ts:147


has

Usage

Athena.player.toolbar.has(player, dbName, quantity, version?): any

Verify that the player has at least 'x' of an item in their toolbar

Parameters

NameTypeDefault valueDescription
playerPlayerundefinedAn alt:V Player Entity
dbNamestringundefined-
quantitynumberundefined-
versionanyundefined-

Returns

any

Defined in

server/player/toolbar.ts:112


modifyItemData

Usage

Athena.player.toolbar.modifyItemData<CustomData>(player, slot, customData): Promise<boolean>

Find an item at a specific slot, and changes its entire custom data section.

Think of this like an easy to use 'setter' for item data.

Only checks the toolbar.

Example

ts
const someData = Athena.player.toolbar.getItemData<{ myCustomStuff: string }>(somePlayer, someSlot);

someData.myCustomStuff = 'Hello World!';

await Athena.player.toolbar.modifyItemData<typeof someData>(player, someSlot, someData);

Type parameters

NameType
CustomData{}

Parameters

NameTypeDescription
playerPlayerAn alt:V Player Entity
slotnumber
customDataCustomData-

Returns

Promise<boolean>

Defined in

server/player/toolbar.ts:192


override

Usage

Athena.player.toolbar.override(functionName, callback): any

Used to override any toolbar functions

Parameters

NameType
functionName"add"
callback(player: Player, item: Omit<StoredItem, "slot">) => Promise<boolean>

Returns

any

Defined in

server/player/toolbar.ts:274

Usage

Athena.player.toolbar.override(functionName, callback): any

Used to override any toolbar functions

Parameters

NameType
functionName"has"
callback(player: Player, dbName: string, quantity: number, version: any) => any

Returns

any

Defined in

server/player/toolbar.ts:275

Usage

Athena.player.toolbar.override(functionName, callback): any

Used to override any toolbar functions

Parameters

NameType
functionName"getAt"
callback<CustomData>(player: Player, slot: number) => player<CustomData> | undefined

Returns

any

Defined in

server/player/toolbar.ts:276

Usage

Athena.player.toolbar.override(functionName, callback): any

Used to override any toolbar functions

Parameters

NameType
functionName"remove"
callback(player: Player, slot: number) => Promise<boolean>

Returns

any

Defined in

server/player/toolbar.ts:277

Usage

Athena.player.toolbar.override(functionName, callback): any

Used to override any toolbar functions

Parameters

NameType
functionName"sub"
callback(player: Player, item: Omit<StoredItem, "slot">) => Promise<boolean>

Returns

any

Defined in

server/player/toolbar.ts:278

Usage

Athena.player.toolbar.override(functionName, callback): any

Used to override any toolbar functions

Parameters

NameType
functionName"modifyItemData"
callback<CustomData>(player: Player, slot: number, customData: CustomData) => Promise<boolean>

Returns

any

Defined in

server/player/toolbar.ts:279

Usage

Athena.player.toolbar.override(functionName, callback): any

Used to override any toolbar functions

Parameters

NameType
functionName"getItemData"
callback<CustomData>(player: Player, slot: number) => CustomData | undefined

Returns

any

Defined in

server/player/toolbar.ts:280


remove

Usage

Athena.player.toolbar.remove(player, slot): Promise<boolean>

Delete an item in a specific slot in an toolbar data set.

Parameters

NameTypeDescription
playerPlayerAn alt:V Player Entity
slotnumber

Returns

Promise<boolean>

Defined in

server/player/toolbar.ts:81


sub

Usage

Athena.player.toolbar.sub(player, item): Promise<boolean>

Subtract a quantity of an item from a player's toolbar. Toolbar only.

Parameters

NameTypeDescription
playerPlayerAn alt:V Player Entity
itemOmit<StoredItem, "slot">

Returns

Promise<boolean>

Defined in

server/player/toolbar.ts:51

Created by Stuyk | Est. 2020