Skip to content

Client functions

Patrick edited this page Oct 4, 2024 · 8 revisions

attach

- This function attaches an element to the bone of the ped or player.

bool attach(element Element, element Ped, int/string Bone [, float xPosOffset = 0, float yPosOffset = 0, float zPosOffset = 0, float xRotOffset = 0, float yRotOffset = 0, float zRotOffset = 0])
Required arguments Description
Element The element which you want to attach. (Except: player)
Ped The ped or player which you want to attach element to.
Bone The ID or name of the ped or player's bone which you want to attach element to.
Optional arguments Description
xPosOffset The X position offset.
yPosOffset The Y position offset.
zPosOffset The Z position offset.
xRotOffset The X rotation offset.
yRotOffset The Y rotation offset.
zRotOffset The Z rotation offset.

Returns: Returns true if element was successfully attached, false otherwise.


detach

- This function detaches an element from the bone of the ped or player.

bool detach(element Element)
Required arguments Description
Element The element which you want to detached.

Returns: Returns true if element was successfully detached, false otherwise.


detachAll

- This function detaches every elements from the bone of the ped or player.

bool detachAll(element Ped)
Required arguments Description
Ped The ped or player from where you want to detaches every elements.

Returns: Returns true if elements was successfully detached, false otherwise.


setPositionOffset

- This function changes position offset of attached element.

bool setPositionOffset(element Element [, float xPosOffset = 0, float yPosOffset = 0, float zPosOffset = 0 ])
Required arguments Description
Element Element which you want to change offset of.
Optional arguments Description
xPosOffset New X offset.
yPosOffset New Y offset.
zPosOffset New Z offset.

Returns: Returns true if offset was successfully changed, false otherwise. (only on client side)


setRotationOffset

- This function changes rotation offset of attached element.

bool setRotationOffset(element Element [, float xRotOffset = 0, float yRotOffset = 0, float zRotOffset = 0 ])
Required arguments Description
Element Element which you want to change offset of.
Optional arguments Description
xRotOffset New X offset.
yRotOffset New Y offset.
zRotOffset New Z offset.

Returns: Returns true if offset was successfully changed, false otherwise.


setVisible

- This function make visible or invisible an attached element on ped or player.

bool setVisible(element Element, bool State)
Required arguments Description
Element Element which you want to make visible or invisible.
State Visibility status. (true = invisible / false = visible)

Returns: Returns true if visibility was successfully changed, false otherwise.


setVisibleAll

- This function make visible or invisible every attached elements on ped or player.

bool setVisibleAll(element Ped, bool State)
Required arguments Description
Ped The ped or player on which you want to change the visibility of all attached elements.
State Visibility status. (true = invisible / false = visible)

Returns: Returns true if visibility was successfully changed, false otherwise.


isAttached

- This function check is element already attached or not.

bool isAttached(element Element)
Required arguments Description
Element Element which you want to check.

Returns: Returns true if element is already attached, false otherwise.


setDetails

- This function set details of attached element.

bool setDetails(element Element [, element Ped = currentPed, int/string Bone = currentBone, float xPosOffset = currentXPosOffset, float yPosOffset = currentYPosOffset, float zPosOffset = currentZPosOffset, float xRotOffset = currentXRotOffset, float yRotOffset = currentYRotOffset, float zRotOffset = currentZRotOffset])
Required arguments Description
Element The element which you want to update.

NOTE: Use 'false' if you don't want to modify the current value.

Optional arguments Description
Ped New ped or player which you want to attach element to.
Bone New ID or name of the ped or player's bone which you want to attach element to.
xPosOffset New X position offset.
yPosOffset New Y position offset.
zPosOffset New Z position offset.
xRotOffset New X rotation offset.
yRotOffset New Y rotation offset.
zRotOffset New Z rotation offset.

Returns: Returns true if details was successfully changed, false otherwise.


getDetails

- This function gets details of attached element.

table getDetails(element Element)
Required arguments Description
Element Element which you want to check.

Returns: Returns table with details (value order same as attach function's parameters) if element exists and attached, false otherwise.


setPed

- This function set ped or player which you want to attach element to.

bool setPed(element Element, element Ped)
Required arguments Description
Element Element which you want to update.
Ped The ped or player which you want to attach element to.

Returns: Returns true if ped was successfully changed, false otherwise.


setBone

- This function set bone which you want to attach element to.

bool setBone(element Element, int/string Bone)
Required arguments Description
Element Element which you want to update.
Bone The ID or name of the ped or player's bone which you want to attach element to.

Returns: Returns true if bone was successfully changed, false otherwise.


getAttacheds

- This function get attached elements which is attached to ped or player.

table getAttacheds(element Ped)
Required arguments Description
Ped The ped or player to which the elements are attached.

Returns: Returns a table with all the elements attached to the specified ped or player, false otherwise.


setConfigOption

- This function overrides a default config option.

bool setConfigOption(string Name, bool Value)
Required arguments Description
Name The name of the config option.
Value The new value of the option.

Returns: Returns true if option was successfully changed, false otherwise.


getConfigOption

- This function returns the current value of the config option.

bool getConfigOption(string Name)
Required arguments Description
Name The name of the config option.

Returns: current value of the config option.