Module script.client
Client module for Advanced Roleplay Environment.
Functions
RegisterKey (key_info, command, description, func) | Registers a key |
OnPlayerRespawn () | Called on player respawn |
ShowPlayerMenu (player) | Opens player menu for player |
_UpdateMenu (information, tourniquets, bleedings, infusions, logs, pain, bloodVolume, triageSelection, unconscious) | Updates the menu with specified data |
_LoadMenu (information, tourniquets, bleedings, infusions, logs, pain, title, bloodVolume, triageSelection, unconscious) | Loads the menu with specified arguments |
ClosePlayerMenu (fromNui) | Closes the player menu |
GetHealthBuffer (targetSource, cb) | Gets the health buffer from a player |
HasItem (itemName, count, cb) | Returns value if the local player has enough of a item |
GetItems (cb) | Returns the items of the local player |
HandleDamageType (damageType, damagedBone) | Handles the damage type |
CalculateLastDamage () | Calculates the last damage |
GetLastDamageAmount () | Returns the last damage amount |
AdjustPainLevel (wantedPainLevel) | Adjustes the pain level of the local player |
UpdatePainLevel (painSupressAdjustment) | Updates the pain level of the local player |
GetPainPerceived (healthBuffer) | Returns the perceived pain level of the local player |
GetBloodLoss (injuries, cardiacOutput) | Returns the blood loss of the local player |
UpdateBloodLoss (injuries, cardiacOutput) | Updates the blood volume according to the blood loss of the local player |
GetBleedings (healthBuffer) | Returns the active bleedings of a specified health buffer |
GetBloodPressure (healthBuffer, bodyPart) | Returns the blood pressure of a healthbuffer at a specified bodyPart |
GetHeartRate (healthBuffer, bodyPart) | Returns the heart rate of a healthbuffer at a specified bodyPart |
GetCardiacOutput () | Returns the cardiac output of the local player |
UpdatePeripheralResistance (resistanceAdjustment) | Updates the peripheral resistance of the local player |
UpdateBloodPressure () | Updates the blood pressure of the local player |
UpdateHeartRate (hrTargetAdjustment) | Updates the heart rate of the local player |
GenerateHealthAndBlood () | Generates health and blood when vitals are stable |
CheckForCriticalVitals (bloodVolume) | Returns if the local player has critical vitals |
GetActiveMedicationsInSystemLocal (medicationName) | Returns the activate medications in local system |
AddMedicationLocal (bodyPart, medicationName) | Adds a medication to the local system at a specified body part |
SetUnconsciousState (state) | Sets the local player unconscious or conscious |
GetRemainingUnconsciousSeconds (healthBuffer) | Returns the remaning time in seconds until the specified health buffer dies |
FindMostEffectiveWound (healthBuffer, bandageType, bodyPart) | Returns the most effective wound for a specified bandageType at a specified bodyPart on a specified healthBuffer |
HandleInjuryTimeout () | Handles the injury timeout |
DoesPlayerHaveAimShakeInjury (healthBuffer) | Returns if the player has a aim shake injury |
DoesPlayerHaveLimpingInjury (healthBuffer) | Returns if the player has a limping injury |
AddInjury (injury) | Adds a injury to the local player and returns the id of the created injury |
SetInjuryLevel (bodyPart, injuryName, level) | Sets a injury level of a specified injury on a specified body part |
FindInjuryInHealthBuffer (healthBuffer, bodyPart, id) | Finds injury in health buffer |
GetInjuryLevelAsNumber (level) | Returns injury level as number |
GetInjuryLevelFromNumber (number) | Returns injury level from number |
GetNextInjuryDamageLevel (damageLevel) | Returns next injury damage level |
GetInjuries (healthBuffer) | Gets all injuries in health buffer |
GetInjuriesInfoFor (origDamageType, damageType, damageAmount, bodyPart) | Gets injuries for specified arguments |
GetTourniquets (healthBuffer) | Gets the active tourniquets in a health buffer |
GetInfusions (healthBuffer) | Gets the active infusions in a health buffer |
HandlePainEffect () | Handles the pain effect |
HandleBleedingEffect () | Handles the bleeding effect |
GetHeartbeatSoundName (heartRate) | Gets the heartbeat sound name from the given heart rate |
IsSewNeeded (healthBuffer, bodyPart) | Returns true if the bodypart needs sewing |
FindBodyPart (boneIndex) | Finds a body part from the bone index |
IsBodyPart (boneIndex, bodyPart) | Check if bodyPart is a valid bodyPart |
ResetHealthBuffer () | Resets the local health buffer |
RunMenuAction (name, bodyPart) | Runs a menu action on a bodypart |
ReportHealthBufferUpdate () | Syncs the local health buffer with every other player (updates state bag) |
BroadcastStop3DSound () | Stops the current 3d sound bound to the local player for all players |
Play3DSoundLocal (soundId, coords, distance, sound) | Plays a 3d sound locally on the client |
Stop3DSoundLocal (soundId) | Stops a 3d sound locally on the client |
CreateDebugSection (sectionName) | Creates a debug section in the debug window |
UpdateDebugValue (debugId, debugValue) | Updates a debug value in the debug window |
DeleteDebugValue (debugId) | Deletes a debug value in the debug window |
DeleteDebugSection (sectionName) | Deletes a debug section in the debug window |
DisableDamageType (damageType) | Disables a specific damage type |
EnableInjury (injury) | Enables a specific injury |
DisableInjury (injury) | Disables a specific injury |
Tables
EventHandlers | table: Storing the current event handlers |
SpawnedGameObjects | table: Storing the spawned game objects |
DisabledDamageTypes | table: Storing the disabled damage types |
DisabledInjuries | table: Storing the disabled injuries |
ClientHealthBuffer | table: The client health buffer |
ClientData | table: Contains all the important client data fields |
TargetData | table: Contains all the important target data fields |
HOOKED_DEBUG_VALUES | table: Hooked debug values |
DEBUG_VALUE_HEARTBEATS | table: Heartbeats from the debug values |
DEBUG_SECTION_HEARTBEATS | table: Heartbeats from the debug sections |
HOOKED_SECTIONS | table: Hooked debug sections |
Fields
TempAuthToken | string: Variable storing the temp auth token |
MenuOpened | bool: Returns true or false whether the menu is open |
ScriptReady | bool: Returns if the script is ready or not. |
LastDispatch | number: Storing the last dispatch timer |
LastDispatchHidden | bool: Storing if the last dispatch button is hidden |
CarryAnimationData | table: Storing the active carry animation data |
AllowManualRespawn | bool: Storing if the player is allowed to manually respawn |
PlayerDamageDisabled | bool: Storing if the player damage is disabled |
IsOldGameBuild | bool: Storing if the game build is old or new. |
NuiLoaded | bool: Storing if the nui is loaded |
LastGameTime | number: Last game time |
Functions
- RegisterKey (key_info, command, description, func)
-
Registers a key
Parameters:
- key_info any
- command any
- description any
- func any
- OnPlayerRespawn ()
- Called on player respawn
- ShowPlayerMenu (player)
-
Opens player menu for player
Parameters:
- player
- _UpdateMenu (information, tourniquets, bleedings, infusions, logs, pain, bloodVolume, triageSelection, unconscious)
-
Updates the menu with specified data
Parameters:
- information any
- tourniquets any
- bleedings any
- infusions any
- logs any
- pain any
- bloodVolume any
- triageSelection any
- unconscious any
- _LoadMenu (information, tourniquets, bleedings, infusions, logs, pain, title, bloodVolume, triageSelection, unconscious)
-
Loads the menu with specified arguments
Parameters:
- information any
- tourniquets any
- bleedings any
- infusions any
- logs any
- pain any
- title any
- bloodVolume any
- triageSelection any
- unconscious any
- ClosePlayerMenu (fromNui)
-
Closes the player menu
Parameters:
- fromNui boolean optional if the menu was closed from the NUI
- GetHealthBuffer (targetSource, cb)
-
Gets the health buffer from a player
Parameters:
- targetSource number the player source to get the health buffer from
- cb function the callback function to call with the health buffer
- HasItem (itemName, count, cb)
-
Returns value if the local player has enough of a item
Parameters:
- itemName string the item name
- count number the amount of the item
- cb function the callback function to call with the result
- GetItems (cb)
-
Returns the items of the local player
Parameters:
- cb function the callback function to call with the result
- HandleDamageType (damageType, damagedBone)
-
Handles the damage type
Parameters:
- damageType any
- damagedBone any
- CalculateLastDamage ()
- Calculates the last damage
- GetLastDamageAmount ()
- Returns the last damage amount
- AdjustPainLevel (wantedPainLevel)
-
Adjustes the pain level of the local player
Parameters:
- wantedPainLevel number the wanted pain level
- UpdatePainLevel (painSupressAdjustment)
-
Updates the pain level of the local player
Parameters:
- painSupressAdjustment number the pain supress adjustment
- GetPainPerceived (healthBuffer)
-
Returns the perceived pain level of the local player
Parameters:
- healthBuffer
- GetBloodLoss (injuries, cardiacOutput)
-
Returns the blood loss of the local player
Parameters:
- injuries table the injuries to get the blood loss from
- cardiacOutput number the cardiac output of the local player
- UpdateBloodLoss (injuries, cardiacOutput)
-
Updates the blood volume according to the blood loss of the local player
Parameters:
- injuries table the injuries to get the blood loss from
- cardiacOutput number the cardiac output of the local player
- GetBleedings (healthBuffer)
-
Returns the active bleedings of a specified health buffer
Parameters:
- healthBuffer table the health buffer to get the active bleedings from
- GetBloodPressure (healthBuffer, bodyPart)
-
Returns the blood pressure of a healthbuffer at a specified bodyPart
Parameters:
- healthBuffer table the health buffer to get the blood pressure from
- bodyPart string the body part to get the blood pressure from
Returns:
-
number
- GetHeartRate (healthBuffer, bodyPart)
-
Returns the heart rate of a healthbuffer at a specified bodyPart
Parameters:
- healthBuffer table the health buffer to get the heart rate from
- bodyPart string the body part to get the heart rate from
Returns:
-
number the heart rate of the health buffer at the specified bodyPart
- GetCardiacOutput ()
-
Returns the cardiac output of the local player
Returns:
-
number
- UpdatePeripheralResistance (resistanceAdjustment)
-
Updates the peripheral resistance of the local player
Parameters:
- resistanceAdjustment number the resistance adjustment
- UpdateBloodPressure ()
- Updates the blood pressure of the local player
- UpdateHeartRate (hrTargetAdjustment)
-
Updates the heart rate of the local player
Parameters:
- hrTargetAdjustment number the heart rate target adjustment
- GenerateHealthAndBlood ()
- Generates health and blood when vitals are stable
- CheckForCriticalVitals (bloodVolume)
-
Returns if the local player has critical vitals
Parameters:
- bloodVolume number The blood volume of the local player
Returns:
-
boolean
- GetActiveMedicationsInSystemLocal (medicationName)
-
Returns the activate medications in local system
Parameters:
- medicationName string the name of the medication
Returns:
-
table
- AddMedicationLocal (bodyPart, medicationName)
-
Adds a medication to the local system at a specified body part
Parameters:
- bodyPart string the body part to add the medication to
- medicationName string the name of the medication
- SetUnconsciousState (state)
-
Sets the local player unconscious or conscious
Parameters:
- state boolean the state to set the local player to (true = unconscious, false = conscious)
- GetRemainingUnconsciousSeconds (healthBuffer)
-
Returns the remaning time in seconds until the specified health buffer dies
Parameters:
- healthBuffer table the health buffer to check
Returns:
-
number
- FindMostEffectiveWound (healthBuffer, bandageType, bodyPart)
-
Returns the most effective wound for a specified bandageType at a specified bodyPart on a specified healthBuffer
Parameters:
- healthBuffer table the health buffer to check
- bandageType string the type of bandage to check
- bodyPart string the body part to check
Returns:
-
table, number
- HandleInjuryTimeout ()
- Handles the injury timeout
- DoesPlayerHaveAimShakeInjury (healthBuffer)
-
Returns if the player has a aim shake injury
Parameters:
- healthBuffer any
Returns:
-
boolean
- DoesPlayerHaveLimpingInjury (healthBuffer)
-
Returns if the player has a limping injury
Parameters:
- healthBuffer any
Returns:
-
boolean
- AddInjury (injury)
-
Adds a injury to the local player and returns the id of the created injury
Parameters:
- injury table the injury to add
Returns:
-
number
- SetInjuryLevel (bodyPart, injuryName, level)
-
Sets a injury level of a specified injury on a specified body part
Parameters:
- bodyPart string the body part to check for the injury
- injuryName string the injury name to override
- level string the level to set the injury to
- FindInjuryInHealthBuffer (healthBuffer, bodyPart, id)
-
Finds injury in health buffer
Parameters:
- healthBuffer any
- bodyPart any
- id any
Returns:
- unknown
- unknown
- GetInjuryLevelAsNumber (level)
-
Returns injury level as number
Parameters:
- level any
Returns:
-
integer
- GetInjuryLevelFromNumber (number)
-
Returns injury level from number
Parameters:
- number any
Returns:
-
string
- GetNextInjuryDamageLevel (damageLevel)
-
Returns next injury damage level
Parameters:
- damageLevel any
Returns:
-
string
- GetInjuries (healthBuffer)
-
Gets all injuries in health buffer
Parameters:
- healthBuffer any
Returns:
-
table
- GetInjuriesInfoFor (origDamageType, damageType, damageAmount, bodyPart)
-
Gets injuries for specified arguments
Parameters:
- origDamageType any
- damageType any
- damageAmount any
- bodyPart any
Returns:
-
table
- GetTourniquets (healthBuffer)
-
Gets the active tourniquets in a health buffer
Parameters:
- healthBuffer any
Returns:
-
table
- GetInfusions (healthBuffer)
-
Gets the active infusions in a health buffer
Parameters:
- healthBuffer any
Returns:
-
unknown
- HandlePainEffect ()
- Handles the pain effect
- HandleBleedingEffect ()
- Handles the bleeding effect
- GetHeartbeatSoundName (heartRate)
-
Gets the heartbeat sound name from the given heart rate
Parameters:
- heartRate any
Returns:
-
string
- IsSewNeeded (healthBuffer, bodyPart)
-
Returns true if the bodypart needs sewing
Parameters:
- healthBuffer any
- bodyPart any
Returns:
-
boolean
- FindBodyPart (boneIndex)
-
Finds a body part from the bone index
Parameters:
- boneIndex any
Returns:
-
table
- IsBodyPart (boneIndex, bodyPart)
-
Check if bodyPart is a valid bodyPart
Parameters:
- boneIndex number
- bodyPart string
Returns:
-
boolean
- ResetHealthBuffer ()
- Resets the local health buffer
- RunMenuAction (name, bodyPart)
-
Runs a menu action on a bodypart
Parameters:
- name any
- bodyPart any
- ReportHealthBufferUpdate ()
- Syncs the local health buffer with every other player (updates state bag)
- BroadcastStop3DSound ()
- Stops the current 3d sound bound to the local player for all players
- Play3DSoundLocal (soundId, coords, distance, sound)
-
Plays a 3d sound locally on the client
Parameters:
- soundId number
- coords vector3
- distance number
- sound string
- Stop3DSoundLocal (soundId)
-
Stops a 3d sound locally on the client
Parameters:
- soundId number
- CreateDebugSection (sectionName)
-
Creates a debug section in the debug window
Parameters:
- sectionName string
- UpdateDebugValue (debugId, debugValue)
-
Updates a debug value in the debug window
Parameters:
- debugId string
- debugValue any
- DeleteDebugValue (debugId)
-
Deletes a debug value in the debug window
Parameters:
- debugId string
- DeleteDebugSection (sectionName)
-
Deletes a debug section in the debug window
Parameters:
- sectionName string
- DisableDamageType (damageType)
-
Disables a specific damage type
Parameters:
- damageType string
- EnableInjury (injury)
-
Enables a specific injury
Parameters:
- injury string
- DisableInjury (injury)
-
Disables a specific injury
Parameters:
- injury string
Tables
- EventHandlers
- table: Storing the current event handlers
- SpawnedGameObjects
- table: Storing the spawned game objects
- DisabledDamageTypes
- table: Storing the disabled damage types
- DisabledInjuries
- table: Storing the disabled injuries
- ClientHealthBuffer
-
table: The client health buffer
Fields:
- unconscious number Returns true or false whether the player is unconscious or not.
- unconsciousTimeUntilDeath number Returns the time until the player respawns.
- heartRate number Pulse from the client
- lastHeartRateChange number Last heart rate change game timer
- bloodPressureH number Blood pressure high from the client
- bloodPressureL number Blood pressure low from the client
- bloodVolume number Blood volume from the client
- painLevel number Pain level from the client
- painSupress number Pain suppress from the client
- lastReceivedPain number
- peripheralResistance number flow of blood? 100 max
- _lastHealth number Internal usage
- lastDamageTimestamp table Timestamp of the last taken damage
- lastDamage table Amount of the last taken damage
- lastHandledDamageTimestamp table Timestamp of the last handled damage
- medications string Storing all the active medications
- infusions table Table of the active infusions
- logs Table of the logs
- triageSelection The current triage selection
- bodyParts Table of the body parts
- ClientData
-
table: Contains all the important client data fields
Fields:
- ped integer Player ped handle from the client
- coords vector3 Player coords of the client ped
- id number Player id of the client
- deathRegistered bool Returns if the player is dead or not
- TargetData
-
table: Contains all the important target data fields
Fields:
- source number Player source from target
- ped number Player ped handle from target
- coords vector3 Player coords of the target ped
- healthBuffer table Player health buffer of the target
- distance number Player distance to the target
- HOOKED_DEBUG_VALUES
- table: Hooked debug values
- DEBUG_VALUE_HEARTBEATS
- table: Heartbeats from the debug values
- DEBUG_SECTION_HEARTBEATS
- table: Heartbeats from the debug sections
- HOOKED_SECTIONS
- table: Hooked debug sections
Fields
- TempAuthToken
- string: Variable storing the temp auth token
- MenuOpened
- bool: Returns true or false whether the menu is open
- ScriptReady
- bool: Returns if the script is ready or not.
- LastDispatch
- number: Storing the last dispatch timer
- LastDispatchHidden
- bool: Storing if the last dispatch button is hidden
- CarryAnimationData
- table: Storing the active carry animation data
- AllowManualRespawn
- bool: Storing if the player is allowed to manually respawn
- PlayerDamageDisabled
- bool: Storing if the player damage is disabled
- IsOldGameBuild
- bool: Storing if the game build is old or new.
- NuiLoaded
- bool: Storing if the nui is loaded
- LastGameTime
- number: Last game time