Skip to content

Maximus7474/mps_vehiclepersist

Repository files navigation

Persist Vehicles

image

A script built for ox core to persist vehicle positions through server reboots. When the resource stops it'll save all vehicles to the DB, when it gets started it'll respawn all the previously saved files.

Config

# Debug Logs
# Refer to https://overextended.dev/ox_core#replicated for details
setr ox:debug 0

# When to save the vehicles
# 0 will only save the vehicles on the txadmin event signalling server shutdown,
# 1 will save the vehicles on resource stop (default option)
set persistvehicles:useTxAdminEvent 1

# Run a version check on resource start
# 0 doesn't run the version check
# 1 runs the version check
set persistvehicles:versioncheck 1

Instalation

  1. Run the base.sql if not it will not work.

Getting Started

Node.js v18+

Install any LTS release of Node.js from v18.

pnpm

Install the pnpm package manager globally.

npm install -g pnpm

Setup

Initialise your own repository by using one of the options below.

Navigate to your new directory and execute the following command to install dependencies.

pnpm install

Development

Use pnpm watch to actively rebuild modified files while developing the resource.

During web development, use pnpm web:dev to start vite's webserver and watch for changes.

Build

Use pnpm build to build all project files in production mode.

To build and create GitHub releases, tag your commit (e.g. v1.0.0) and push it.

Layout

  • /dist/
    • Compiled project files.
  • /locales/
    • JSON files used for translations with ox_lib.
  • /scripts/
    • Scripts used in the development process, but not part of the compiled resource.
  • /src/
    • Project source code.
  • /static/
    • Files to include with the resource that aren't compiled or loaded (e.g. config).