loaf-scripts / loaf_spikestrips

FiveM spikestrips, only bursts the tyres that are actually touching the spikestrip.
ISC License
44 stars 34 forks source link

Loaf - Spike Strips V2

Spike strip script for FiveM that only bursts the tires that are touching the spikes.

Showcase: https://www.youtube.com/watch?v=iarfWQxAMAg

Changes from V1 - Better performance - Now supports more tires (previously only 4). This makes it work correctly on e.g a Dubsta 6x6 - Audio when placing a spike strip - Target inteaction to pick up spike strips - Option to spawn entities on the server or locally - Animation when picking up - Better support for frameworks - Version checking - Logs - A bunch of quality of life features - /clearspikestrips admin command to clear all spike strips - Notifications - Automatically delete after a certain time - Delete on script stop - Option to only allow placing on roads - And a lot more

Performance

6 spikestrips placed, Config.BurstNPC disabled:

6 spikestrips placed, Config.BurstNPC enabled with NPC's driving over:

Installation

  1. Download the latest release
  2. Install all dependencies
  3. Add the item to your server
  4. Configure the script to your liking
  5. Add ensure loaf_spikestrips to your server.cfg
  6. Either restart your server, or start the resource by running refresh and then ensure loaf_spikestrips in your server console

If you use esx_policejob, you can remove the built in functionality by removing p_ld_stinger_s from the table in the -- Enter / Exit entity zone events thread in esx_policejob/client/main.lua.

If you use qb-policejob, you can remove the built in functionality by removing the thread in qb-policejob/client/object.lua that handles the spike strip.

Dependencies

Adding the item

You can use the included spikestrip.png as the item image.

Default ESX Run the following query in your database: ```sql INSERT INTO `items` (`name`, `label`, `weight`) VALUES ("spikestrip", "Spike strip", 500); ```
ox_inventory Add to ox_inventory/data/items.lua: ```lua ["spikestrip"] = { label = "Spike strip", weight = 500, stack = true } ```
qb-inventory Add to qb-core/shared/items.lua: ```lua spikestrip = { name = 'spikestrip', label = 'Spike strip', weight = 500, type = 'item', image = 'spikestrip.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Useful for stopping the bad guys' }, ```

Configuration

Config.SpawnMethod - The method used to spawn the spike strip. This can be one of the following: Value Description
"local" The spike strip entity is spawned locally on each client, and deleted when out of view.
"networked" The entity is spawned networked by the person who places it
"server" The entity is spawned by the server

Logs

The script supports logging via Discord webhooks or ox_lib.

If you wish to use ox_lib, set Config.LogSystem to "ox_lib". For discord, set it to "discord" and set your webhook in loaf_spikestrips/server/logs.lua