Setting up vehicles

Each vehicle you wish to use Mobile Spike on must be configured beforehand in the config.lua file. To begin, navigate to the vehicles = { section.

Configuring vehicles beforehand is required as this sets the position on the vehicle for the grappler to spawn on, ensuring it is right for each different vehicle model and not incorrectly positioned. This may take some trial and error to find the right position for each vehicle.

We'll use the model name police2 as an example to configure:

[`police2`] = {

To begin, the model name must be wrapped in this symbol: `. This allows for runtime hashing of the model name, improving efficiency of the overall resource. The resource will not work if it is not wrapped in those symbols.

        name = "Response Car",
        boneName = "engine",

The name line allows you to set a description of the vehicle. This is mainly used for logging purposes so you'll know which vehicle a Mobile Spike was deployed onto or removed from.

The boneName line is the bone that the Mobile Spike bumper should attach to. This should be a bone that exists on the vehicle. If you aren't sure, we recommend using the bone name engine as this exists on most vehicle models and it can be found at the front, exactly where we need the Mobile Spike bumper to be!

For a list of bone names, take a look here. Each one will not exist on every vehicle and it depends on the model you're using.

        offSet = {0.0, 1.0, -0.4},
        rotation = {0.0, 0.0, 0.0},
},

This section is where things may get confusing! We need to setup the offSet and rotation of the bumper relative to the boneName. Whilst the engine may be located at the front of the vehicle, we still might need to move the Mobile Spike forward slightly so it isn't sticking out as much. This allows us to do that.

offSet = {x, y, z} - This is the format of setting the offset. X moves left and right. Y moves forward and backwards, Z moves up and down. In the example, we've moved 1.0 forwards and 0.4 downwards (-).

rotation = {x, y, z} - This allows you to rotate the Mobile Spike prop along three different exis, which will likely not be required unless your bone has been incorrectly rotated on the vehicle model.

We're also here to help and if you're struggling to setup the offSet and rotation for your fleet of vehicles, we can provide assistance. To get in touch, join our Discord server, email us or send us a message on the FiveM forum.

Commands

The resource has one command with multiple usages.

/mobilespike [action] Actions:

Install - You must be outside of the vehicle to install a Mobile Spike and this will proceed to set one up after performing an animation.

Deploy - Once installed and inside the vehicle, you can either deploy the Mobile Spike by command or through a keybind, which we will show you how to configure later. Once deployed, you can retract it using another command or keybind which you'll see below

Remove - You must be outside of the vehicle to remove the Mobile Spike.

Retract - Once your mobile spike is in deployed mode you can retract this using the command or the same keybind used to deploy, which is configurable in the config file.

Developer Command

We've added a developer command built into the resource to help you position the grappler onto your vehicles. To begin, head to the config.lua file and enable developerMode.

This enables the /installmobilespike command in-game. To start, get into the vehicle you want to position the mobile spike for and run the command.

This will spawn in a new mobile spike prop connected to the vehicle, you can then move it around with the following keys:

Page Up / Page Down - Up and Down

Arrow Up / Arrow Down - Moving Forwards and Backwards

Arrow Left / Arrow Right - Moving Left and Right

B and N - Rotating Left and Right

Once you are happy with the positioning of the mobile spike, you can press ENTER to confirm the position. The offSet and rotation values will then be printed for you to copy into the config.lua file.

Mobile Spike Deployment Key

Using /mobilespike deploy whilst in an active pursuit may not be the fastest option, this is why we've added a Mobile Spike deployment key into the config.

Find the deploySpikesKey = { section to begin configuring this.

deploySpikesKey = {0, 246} -- By default this is set to Y

By default, we've set this to Y. The first number is the control group and the second number is the selected control.

You can find a list of controls here. We recommend leaving the control group at 0 as this is the player control group. You should find the selected control and then copy the number into the second part of the brackets to change the control.

Retract: This keybind will also retract your Mobile Spike if in deployed mode, making it easy to switch between deployed and retracted.

Last updated