Mads' Resource Documentation
  • 📺Youtube
  • 🤝Discord
  • ⭐Tebex
  • 👨‍💻GitHub
  • 👋Welcome!
  • General Info
    • ❓Questions and Answers
      • Is X script locked/encrypted?
      • I need support, where can I reach out?
      • How do I update my server artifacts?
      • How do I transfer a script from one account to another?
      • How do I set my game build?
    • ⚠️Common Problems
      • You lack the required entitlement
      • Failed to verify protected resource
      • Could not find dependency /assetpacks for resource
  • Resources
    • 🪑Sit Anywhere
      • Adding Custom Models
      • Falling Through the Map
      • Exports
      • Events
    • 🚁Helicopter Camera
      • Adding custom helicopters
      • Moving the UI above the minimap
      • Adding controller inputs
      • Controls
      • Exports
      • Events
    • 🚙Slash Tires
      • Exports
      • Events
    • 🕶️Stungrenade
      • Adding the Stungrenade as an item
      • Measures Against Cheaters
      • Exports
      • Events
    • 🪖CS Styled Killfeed
      • General Information
      • Exports - Client Side
      • Exports - Server Side
      • Examples
      • Adding Messages to the feed
      • Weapons List / Death Reasons
      • Changing the position if the killfeed
    • Crouch & Crawl
      • Exports
    • 🔫Taser Effect
    • 🔭Telescopes
    • 🩺Crutches
      • How to make the script compatible with ps-walkstyle
    • ⛽No Exploding Pumps
    • 👠Hookers
Powered by GitBook
On this page
  1. Resources
  2. Slash Tires

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).

Export
Description
Parameter(s)
Return type

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
PreviousSlash TiresNextEvents

Last updated 11 months ago

🚙