Body Damage
Damage System API - LVS Inventory
GetPlayerDamage()
Retrieves the current damage state of the player by body parts.
Description
Returns an object containing damage data for 6 main body zones, providing a simplified structure for external use.
Syntax
local damageData = exports['lvs_inventory']:GetPlayerDamage()Return Value
Type: table
Object with the following properties:
head(table): Head damage datatorso(table): Upper torso damage dataleftArm(table): Left arm damage datarightArm(table): Right arm damage dataleftLeg(table): Left leg damage datarightLeg(table): Right leg damage data
Each body part contains:
percent(number): Accumulated damage percentage (0-100)bullets(number): Number of bullet impacts receivedseverity(boolean): Indicates if damage is severebroken(boolean): Indicates broken bonesbleeding(boolean): Indicates if the zone is bleeding
Example
UpdatePlayerDamage()
Updates damage for a specific body part and notifies linked systems.
Description
This function allows manual modification of the damage state for a specific body zone. It registers bullet impacts, updates damage percentage, and maintains negative states (severity, fractures, bleeding).
Syntax
Parameters
bodyPart
string
Body part to update. Valid values: head, torso, leftArm, rightArm, leftLeg, rightLeg
bulletCount
number
Number of bullet impacts to register (typically 1 per impact)
newPercent
number
New damage percentage (0-100)
severity
boolean
Indicates if damage is severe
broken
boolean
Indicates broken bones
bleeding
boolean
Indicates if the zone is bleeding
Behavior
If
bodyPartis invalid, defaults totorsoBullet impacts are accumulated to the existing counter
Damage percentage is replaced with the new value
Negative states are preserved if they already existed
Automatically saves data to the server
Triggers the
lvs_injury:client:UpdatePlayerDamageevent to notify other scripts
Example
Notes
This function is used internally by the system when a player takes damage
Can be used externally to apply custom damage or synchronize states
Changes are automatically persisted to the database
Related Events
lvs_injury:client:UpdatePlayerDamage
Triggered whenever player damage is updated.
Parameters:
BodyParts(table): Complete table with all body parts state
lvs_injury:client:ResetPlayerDamage
Triggered when player damage is reset (e.g., after being revived).
Common Use Cases
Check player condition
Apply fall damage
Medical treatment system example
Last updated