Exports & Events

All exports and events available to integrate this resource into others.

Types / Classes

The public data types used by the persistence exports are documented below.

Suggestions?

If you wish to have any exports or events added, please head over to our Discord and create a suggestion post. We are happy to allow for easier integration within other resources.

#Data Types

lua
---@class WheelLossStateEntry
---@field index integer
---@field reason? string
---@field time? integer
---@field propNetId? integer
---@field propSpawned? boolean
---@field metadata? WheelItemMetadata

---@class WheelLossStateData
---@field entries? WheelLossStateEntry[]
---@field integrity? table<integer | string, number>

#Client Sided Exports

#Get Wheel Loss Data

Returns all Wheel Pop persistence data for a vehicle. Store this with the vehicle's normal properties and restore it with SetWheelLossData.

Example:

lua
---@param vehicle integer
---@return WheelLossStateData
local data = exports["zyke_wheelpop"]:GetWheelLossData(vehicle)

#Set Wheel Loss Data

Applies data previously returned by GetWheelLossData. Run this after the framework finishes applying its normal vehicle properties. Pass nil to clear the stored state.

Example:

lua
---@param vehicle integer
---@param data? WheelLossStateData | WheelLossStateEntry[]
---@return boolean
local success = exports["zyke_wheelpop"]:SetWheelLossData(vehicle, data)

#Get Failed Wheels

Returns every wheel currently tracked in the failed state. GetDetachedWheels remains available as a backwards-compatible alias.

Example:

lua
---@param vehicle integer
---@return WheelLossStateEntry[]
local wheels = exports["zyke_wheelpop"]:GetFailedWheels(vehicle)

#Get Wheel Integrity

Returns wheel integrity values keyed by wheel index.

Example:

lua
---@param vehicle integer
---@return table<integer, number>
local integrity = exports["zyke_wheelpop"]:GetWheelIntegrity(vehicle)

#Fail Vehicle Wheel

Marks one wheel as failed, sets its integrity to zero, applies the configured visuals, and creates its loose-wheel state when enabled. DetachVehicleWheel remains available as a backwards-compatible alias.

Example:

lua
---@param vehicle integer
---@param wheelIndex integer
---@param reason? string
---@return boolean
local success = exports["zyke_wheelpop"]:FailVehicleWheel(vehicle, wheelIndex, "scripted_failure")

#Clear Wheel Loss Data

Clears Wheel Pop state without performing the native visual repair. Use this when another integration already repaired the vehicle visuals.

Example:

lua
---@param vehicle integer
---@return boolean
local success = exports["zyke_wheelpop"]:ClearWheelLossData(vehicle)

#Repair Vehicle Wheels

Repairs one wheel or every tracked wheel and clears the corresponding Wheel Pop state. Omit wheelIndex to repair all wheels.

Example:

lua
---@param vehicle integer
---@param wheelIndex? integer
---@return boolean
local success = exports["zyke_wheelpop"]:RepairVehicleWheels(vehicle, wheelIndex)

#Get Closest Failed Wheel

Returns the closest failed wheel and its distance from the player.

Example:

lua
---@param vehicle integer
---@return integer | nil wheelIndex
---@return number | nil distance
local wheelIndex, distance = exports["zyke_wheelpop"]:GetClosestFailedWheel(vehicle)

#Get Closest Repair Wheel

Returns the closest failed, integrity-damaged, burst, or native-health-damaged wheel and its distance from the player.

Example:

lua
---@param vehicle integer
---@return integer | nil wheelIndex
---@return number | nil distance
local wheelIndex, distance = exports["zyke_wheelpop"]:GetClosestRepairWheel(vehicle)

#Get Loose Wheel Pickup Data

Returns the pickup data connected to a loose-wheel entity or network ID.

Example:

lua
---@param entityOrNetId integer
---@return table | nil
local data = exports["zyke_wheelpop"]:GetLooseWheelPickupData(entityOrNetId)

#Pickup Loose Wheel

Validates and collects a networked loose-wheel prop using the configured inventory flow.

Example:

lua
---@param entityOrNetId integer
---@return boolean
local success = exports["zyke_wheelpop"]:PickupLooseWheel(entityOrNetId)

#Open Wheel Integrity Menu

Opens the wheel integrity menu for the provided vehicle. If no vehicle is passed, the resource resolves a supported nearby or occupied vehicle.

Example:

lua
---@param vehicle? integer
---@return boolean
local opened = exports["zyke_wheelpop"]:OpenWheelIntegrityMenu(vehicle)

#Toggle Wheel Integrity Menu

Opens or closes the wheel integrity menu for the provided vehicle.

Example:

lua
---@param vehicle? integer
---@return boolean
local toggled = exports["zyke_wheelpop"]:ToggleWheelIntegrityMenu(vehicle)

#Is Torque Handling Reduced

Returns whether Wheel Pop is currently applying failed-wheel torque or handling consequences to the vehicle. This is useful when coordinating handling changes with another resource.

Example:

lua
---@param vehicle? integer
---@return boolean
local reduced = exports["zyke_wheelpop"]:IsTorqueHandlingReduced(vehicle)

#Get Torque Handling Base

Returns the handling baseline stored before Wheel Pop applied failed-wheel consequences. This allows another resource to avoid capturing an already penalized value as its baseline.

Example:

lua
---@param vehicle? integer
---@return table | nil
local handling = exports["zyke_wheelpop"]:GetTorqueHandlingBase(vehicle)

#Client Sided Events

#Open Wheel Integrity Menu

Asks a client to open the wheel integrity menu. This is the event used by the server-side usable inspection item.

Example:

lua
TriggerClientEvent("zyke_wheelpop:OpenWheelIntegrityMenu", playerId)