Client Functions

GetLocalData

Returns variables of cached client data. These variables are checked every 500ms and are updated via events(LINK TBA) if they've changed

playerId, playerPedId, position, currentVehicle, currentMount, lastMount, currentGrid = TMC.Functions.GetLocalData()

-- playerId = PlayerId()
-- playerPedId = PlayerPedId()
-- position = GetEntityCoords(PlayerPedId())
-- currentVehicle = GetVehiclePedIsIn(PlayerPedId(), false)
-- currentMount = GetMount(PlayerPedId())) RDR3 Specific
-- lastMount = GetLastMount(PlayerPedId()) RDR3 Specific
-- currentGrid = TMC.Functions.GetGridZone()

Progress Bars

ProgressBar

Starts a progress bar with the specified config

Parameter
Required
Type
Description

callback

Function

A callback function that is called when the progress bar ends. Function has a bool parameter to inform the code if it has completed the progress bar or if it was cancelled.

length

Number

The length (in milliseconds) of the progress bar. If not defined the progress bar will not tick up and can be modified with TMC.Functions.SetProgressBar()

title

String

The title text of the progress bar

description

String

The subtitle text of the progress bar

settings

Object

Overrides default settings. All are optional and should only be provided if you need different settings to those shown below.

SetProgressBar

Used to update the current progress bar when the length hasn't been defined.

UpdateProgressBar

Used to update the title/description of the active progress bar.

CancelProgressBar

Cancels the active progress bar. Will run the callback function with the first parameter set to false.

Current Character

GetPlayerData

Returns player (character) data

GetPlayerItems

Returns player (character) item data array

IsPlayerLoaded

Returns a bool indicating if the player (character) has loaded on the client

IsPlayerSpawned

Returns a bool indicating if the player (character) has spawned in. This comes after the player has loaded

GetFullName

Returns a string of the player (characters) first and last name

GetItemBySlot

Returns an array of the defined player's inventory slot

Parameter
Required
Type
Description

slot

Number

The inventory slot number

IsDead

Returns a bool indicating if the player (character) is dead

IsMale

Returns a bool indicating if the player (character) has a male body type

IsFemale

Returns a bool indicating if the player (character) has a female body type

HasJob

Returns a bool indicating if the player (character) has the defined job. If a grade is also defined, it'll return a bool indicating if the player (character) has the defined job and grade. If the player (character) doesn't have the job (and optionally, the grade) then it'll return a second string value indicating if the mismatch is the defined job or grade

Parameter
Requried
Type
Description

job

String

The job name that the player must have

grade

Number

The grade number that the player must have

HasGrade

Returns a bool indicating if the player (character) has the defined job and grade access

Parameter
Required
Type
Description

job

String

The job name that the player must have

grade

Number

The grade number that the player must have

maxGrade

Bool

This defines the grade floor and ceiling when checking for access

IsOnDuty

Returns either a bool or a string indicating if the player is on duty for any or the optionally defined job. If the player is on duty, it'll also return the grade level of the on-duty job

Parameter
Required
Type
Description

job

String

The job name that'll be used to check if the player is on duty

OnDutyBusiness

Returns either a bool or a string indicating if the player is on duty for a job that is a business

HasItem

Returns a bool indicating if the player (character) has the defined item

Parameter
Required
Type
Description

name

String

The item name to check for

GetItemAmountByName

Returns a number indicating the amount of defined item the player (character) has

Parameter
Required
Type
Description

name

String

The item name to check the amount for

GetItemsByPredicate

Returns an array of the player's (character) items that the defined predicate evaluates to be true

Game Wrappers

LoadModel

Attempts to load the specified model with a 5 second timeout

Parameter
Required
Type
Description

model

Number

The object model hash to load

LoadParticleFx

Attempts to load the specified particle fx with a 5 second timeout

Parameter
Required
Type
Description

ptfx

String

The particle fx name to load

LoadAnimDict

Attempts to load the specified animation dictionary with a 5 second timeout

Parameter
Required
Type
Description

dict

String

The animation dictionary to load

StartPropAnim

Tasks your player to do an animation and attaches an object/prop to the player

Parameter
Required
Type
Description

options

Array

Animation/Prop configuration

StopPropAnim

Stops animation task and cleans up attached object/prop

Parameter
Required
Type
Description

options

Array

Animation/Prop configuration

TeleportToCoords

Teleports player to specified coords with various options

Parameter
Required
Type
Description

coords

Vec2/3/4

Coords to teleport to

includeVehicle

Bool

If you're in a vehicle, this will teleport the vehicle and any occupants to the specified coords

delay

Number

Adds specified amount of delay (in ms) after the teleport is complete before fading the screen in

preFadeTime

Number

Screen fade out time (in ms) before teleport happens

postFadeTime

Number

Screen fade in time (in ms) after teleport happens

plyFade

Bool

If true, this will fade the entity out before the teleport and fade the entity in after the teleport

GetMarkerCoords

Return a vector2 of marked blip on the map

TeleportToMarker

Used to teleport the a map marker

Parameter
Required
Type
Description

includeVehicle

Bool

Specifies if you want to teleport the vehicle that the the player is in

GetPeds

Returns an array containing entity handles for each entity in the ped game pool

GetFilteredPeds

Returns an array containing entity handles for each entity in the ped game pool

Parameter
Required
Type
Description

ignoreList

Array

An array of entities to filter out of the return array

GetClosestPed

Returns the closest ped entity handle and its distance

Parameter
Required
Type
Description

coords

vector3

The coords at which to find the closest ped. If not passed through it'll use your ped's coords

ignoreList

Array

An array of entities to filter out of the return array

Notifications

SimpleNotify

Executes a simplified config with TMC.Functions.Notify

Parameter
Required
Type
Description

message

String

The message to include in the notification

ntype

String

The notification type to use with the notification

time

Number

The duration in ms the notification should show for

Notify

Used to show a notification

Parameter
Required
Type
Description

notifConfig

Array

Notification config array

StopNotify

Used to stop a notification

Parameter
Required
Type
Description

id

String

Notification id to stop

DeleteEntity

Deletes a networked or non-networked entity. If the entity is networked it'll move the delete request to the server to avoid any entity ownership issues

Parameter
Required
Type
Description

ent

Number

Entity handle to delete

UI Functions

CreateUiStat

Create custom HUD elements

Parameter
Required
Type
Description

statName

String

The name of the element to create

statType

String

Which group of elements to add to. Supports: primary, secondary & vehicle

statConfig

Object

An object containing settings for the stat type. All parameters of the object are optional. See below for info.

UpdateUiStat

Update HUD element info

Parameter
Required
Type
Description

statName

String

The name of the element to create

statConfig

Object

An object containing settings to update for the stat type. See below for options.

StartTimer

Used to create a timer HUD element with callback function

Parameter
Required
Type
Description

id

String

Timer ID

length

Number

Length of timer (in ms)

tooltip

String

Tooltip text that'll appear when the HUD element is hovered over

icon

String

Font Awesome icon reference

cb

Function

Callback function triggered when timer is complete

StopTimer

Used to immediately stop an active timer

Parameter
Required
Type
Description

id

String

Timer ID

ShowDoorlockIndicator

Used to show the doorlock indicator HUD element

Parameter
Required
Type
Description

locked

Bool

This will indicate if the HUD element will show as an open or closed door

HideDoorlockIndicator

Used to hide the doorlock indicator HUD element

Clipboard

Used to allow the user to copy information to their clipboard

Parameter
Required
Type
Description

data

String

The data to present and copy to the clipboard

title

String

The title of the clipboard modal

Other

HasPermission

Returns a bool indicating if the client has the defined permission access

Parameter
Required
Type
Description

reqPerm

String

The permission name

GetCoords

Returns a vector4 of the position of the player or the defined entity

Parameter
Required
Type
Description

entity

Number

The entity handle to get the position of

GetStreetLabel

Returns a string with the label street (and optionally the zone) at the defined coords

Parameter
Required
Type
Description

coords

Number

The desired coords for the street label. If not defined then it'll use your player coords

disableZone

Bool

Used if you want to include the zone name or not

GetPlayerList

Returns an array containing players on the server

GetPlayer

Returns an array of the specified player

Parameter
Required
Type
Description

src

Number

The target players server id

GetCoordsForPlayer

Returns a vector4 of the specified player

Parameter
Required
Type
Description

src

Number

The target players server id

GetPlayerCount

Returns the number of players on the server

GetOnscreenKeyboardInput

Returns an array of the specified player

Parameter
Required
Type
Description

TextEntry

String

The text above the typing field in the black square

ExampleText

String

An example text, what it should say in the typing field

MaxStringLength

Number

Maximum string length

IsOnscreenKeyboard

Returns a bool indicating if the on-screen keyboard is active

Last updated