Exports
There are 8 exports included with the script (all client-side). Some of them are intended to get information to be used in other scripts (e.g. isSlashing export) and some are intended to tell the slash tires script to do something (e.g. attemptToSlashTire).
isSlashing
Returns if the local player is in the progress of slashing a tire
None
Boolean
canCurrentWeaponSlashTires
Returns if the currently equipped player weapon can slash tires
None
Number
burstVehicleTire
Burst the vehicle tire, the client must have network control over the vehicle for this to have an effect
vehicle, tireIndex
getVehicleTireByBone
This gets a bunch of data about a tire, this is export is used together with the slashTire export
vehicle, boneName, coords
Table
getClosestVehicleTire
Much like getVehicleTireByBone it returns the tire data, but this gets the closest tire of the spesifed vehicle
vehicle, coords
Table
slashTire
Makes the player slash the spesifed tire
tire
canSlashVehicleTire
Checks of the player can slash the spesifed tire. This export first returns if the player can slash or not, and if they can't it also returns the reason.
tire
Boolean, String|Nil
attemptToSlashTire
Uses the canSlashVehicleTire function to check if the player can slash the tire, if so the player slashes the tire.
tire
Examples
local isSlashing = exports.slashtires:isSlashing()
if isSlashing then
print("The player is slashing a tire!")
else
print("The player is not slashing any tires")
end
local canCurWeaponSlash = exports.slashtires:canCurrentWeaponSlashTires()
if canCurWeaponSlash then
print("The current player weapon can slash a tire!")
else
print("The current player weapon cannot slash a tire!")
end
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
if vehicle ~= 0 then
-- Burst the front left tire of the vehicle the ped is in
exports.slashtires:burstVehicleTire(vehicle, 0)
end
-- I'm too lazy to write a function for this for the example, but if you don't use ox_lib then just use your own function
local vehicle2 = lib.getClosestVehicle(GetEntityCoords(PlayerPedId()))
if vehicle2 ~= 0 then
-- If you don't pass in the coords paramter it gets the current player position
-- For the boneName see the WHEEL_BONES table in shared/variables.lua file
local tire = exports.slashtires:getVehicleTireByBone(vehicle, 'wheel_rf')
if tire.index ~= nil then
exports.slashtires:attemptToSlashTire(tire)
end
end
if vehicle2 ~= 0 then
local tire = exports.slashtires:getClosestVehicleTire(vehicle)
-- If you don't want the attemptToSlashTire export to give a notification to the player then this is "work-around", otherswise just use attemptToSlashTire
local canSlash, reason = exports.slashtires:canSlashVehicleTire(tire)
if not canSlash then
print("can't slash, reason:", reason)
return
end
exports.slashtires:slashTire(tire)
end
Last updated