JixelPatterns
  • JixelPatterns Documentation
  • Troubleshooting
    • Common Issues
    • Setting Up Locations
    • FAQ
  • Dependency
    • Jim_Bridge
      • Animal Ped Support
      • Script Helpers
      • Loader Functions
      • Callbacks
      • Cameras
      • Context Menus
      • Crafting
      • DrawText
      • Dui Functions
      • Input Creator
      • Inventories
      • Job Functions
      • Make Functions
      • Meta Handlers
      • Notifications
      • Phones
      • Player Functions
      • Poly Zones
      • Progress Bars
      • Scale Entity
      • Shops
      • Skillcheck
      • Society Banking
      • Stash Control
      • Targets
      • Vehicles
      • Wrapper Functions
      • Scaleforms
  • Paid Assets
    • Jim-Mechanic
      • Common Issues
      • Installation
      • Locations
        • Creating a Location
      • Nitrous
      • Harness + Seatbelt
      • Emergency Repair Bench
      • Odometer
      • Speedometer
      • Performance Mods
      • Preview System
      • Repair System
      • Car Lifts
      • Plate Change
      • Push Vehicle
      • Stancer Kit
      • Vehicle Seat Picker
    • Jim-Bakery
      • Installation
    • Jim-BeanMachine
      • Installation
    • Jim-BurgerShot
      • Installation
    • Jim-CatCafe
      • Installation
    • Jim-Henhouse
      • Installation
    • Jim-PizzaThis
      • Installation
    • Jim-Popsdiner
      • Installation
  • Free Assets
    • Jim-Mining
      • Installation
      • How To Use
        • Mining
        • Stone Washing
        • Gold Panning
    • Jim-Recycle
      • Installation
      • How To Use
        • Recycling
        • Dumpster Diving
        • Scrapping
    • Jim-Payments
      • Installation
      • How To Use
    • Jim-Shops
      • Installation
      • How To Use
    • Jim-Boarding
      • Installation
      • How To Use
    • Jim-Trains
      • Installation
      • How To Use
    • Jim-Consumbles
      • Installation
      • How To Use
    • Jim-DJBooth
      • Installation
      • How To Use
    • Jim-JobGarage
      • Installation
      • How To Use
    • Jim-Chairs
      • Installation
    • Jim-Notepad
      • Installation
      • How To Use
Powered by GitBook
On this page
  • vehicles.lua
  • searchCar(vehicle)
  • getVehicleProperties(vehicle)
  • setVehicleProperties(vehicle, props)
  • checkDifferences(vehicle, newProps)
  • pushVehicle(entity)
  • getClosestVehicle(coords, src)
  1. Dependency
  2. Jim_Bridge

Vehicles

vehicles.lua

This module provides utilities for reading, modifying, and interacting with vehicle properties and positioning.

searchCar(vehicle)

Searches the 'Vehicles' table for a specific vehicle's details.

If the vehicle differs from the last searched, it retrieves its model and updates the carInfo table.

The table includes the vehicle's name, price, and class information.

Example:

local info = searchCar(vehicleEntity)
print(info.name, info.price, info.class.name, info.class.index)

getVehicleProperties(vehicle)

Retrieves the properties of a given vehicle using the active framework.

Example:

local props = getVehicleProperties(vehicle)
if props then
    print(json.encode(props))
end

setVehicleProperties(vehicle, props)

Sets the properties of a given vehicle if changes are detected.

It compares the current properties with the new ones and applies the update using the active framework.

Example:

setVehicleProperties(vehicle, props)

checkDifferences(vehicle, newProps)

Checks for differences between the current and new vehicle properties.

Compares properties using JSON encoding for deep comparison and logs differences.

Example:

if checkDifferences(vehicleEntity, newProperties) then
    setVehicleProperties(vehicleEntity, newProperties)
end

pushVehicle(entity)

This function ensures that the vehicle is controlled by the current player and is set as a mission entity.

It requests network control and sets the vehicle accordingly to synchronize changes across clients.

Example:

pushVehicle(vehicle)

getClosestVehicle(coords, src)

Finds the closest vehicle to the specified coordinates.

The function uses different APIs based on whether a source is provided.

Example:

local closestVeh, distance = getClosestVehicle({ x = 100, y = 200, z = 30 }, source)

PreviousTargetsNextWrapper Functions

Last updated 2 days ago