Events

Client

There is primarily one event that the script emits for other scripts to listen to, more can be added if requested. The event's name is slashtires:slashedTire, it has 2 parameters, vehicle (a vehicle handle), and tireIndex.

Examples

-- This event is fired when the local player has slashed a tire
AddEventHandler('slashtires:slashedTire', function(vehicle, tireIndex)
    print(string.format("Local player slashed a tire (index: %s) of vehicle %s", tireIndex, vehicle))
end)

Server

There is also one event on the server, it has the same name, but it's NOT a net event, it is emitted from the server to the server. In contrast to the client version, this event contains much more data, the data in this event should in principle be trustable, as most of the data has been collected on the server, and not by the client. The following is the data table included with the event:

{
    source = src, -- string
    netId = netId, -- integer
    tireIndex = tireIndex, -- integer
    hasBurstedTire = hasBurstedTire, -- boolean: if the tire was burst on the client, or if the server needed to send a event to another client to make it burst
    vehicleCoords = vehicleCoords, -- vector3
    playerCoords = playerCoords, -- vector3
    distance = distance, -- number
    weaponHash = weaponHash, -- integer
    weaponName = weaponName, -- string
    sendtAlert = sendtAlert, -- boolean
    weaponRemoved = wasWeaponRemoved, -- boolean
    vehicleModel = vehicleModel, -- integer
    numberPlate = numberPlate -- string
}

Examples

-- This event is fired when a player has successfully slashed a tire
AddEventHandler('slashtires:slashedTire', function(data)
    print(json.encode(data, {indent = true}))
end)

Last updated