Skip to content

Commit 20af021

Browse files
committed
feat(server/vehicle): add convar for ox:defaultVehicleStore
Sets vehicles to be stored to this value on resource start, or not at all if set as an empty string. Resolves #228.
1 parent a10fda7 commit 20af021

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

common/config.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export const SV_LAN = GetConvarInt('sv_lan', 0) === 1;
22
export const CHARACTER_SLOTS = GetConvarInt('ox:characterSlots', 1);
33
export const PLATE_PATTERN = GetConvar('ox:plateFormat', '........').toUpperCase();
4+
export const DEFAULT_VEHICLE_STORE = GetConvar('ox:defaultVehicleStore', 'impound');
45

56
export const DEBUG = (() => {
67
DEV: return true;

server/vehicle/db.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { db } from '../db';
22
import { VehicleProperties } from '@overextended/ox_lib';
3+
import { DEFAULT_VEHICLE_STORE } from 'config';
34

45
export type VehicleRow = {
56
id: number;
@@ -11,7 +12,8 @@ export type VehicleRow = {
1112
data: { properties: VehicleProperties; [key: string]: any };
1213
};
1314

14-
setImmediate(() => db.query('UPDATE vehicles SET `stored` = ? WHERE `stored` IS NULL', ['impound']));
15+
if (DEFAULT_VEHICLE_STORE)
16+
setImmediate(() => db.query('UPDATE vehicles SET `stored` = ? WHERE `stored` IS NULL', [DEFAULT_VEHICLE_STORE]));
1517

1618
export async function IsPlateAvailable(plate: string) {
1719
return !(await db.exists('SELECT 1 FROM vehicles WHERE plate = ?', [plate]));

0 commit comments

Comments
 (0)