Configuration
Every option in STG Used Vehicle Shop config/config.lua, from locations and parking spots to blocked classes, test drives, mileage, fuel and vehicle keys.
All settings live in stg-usedvehicleshop/config/config.lua. The file stays editable in the escrow version. Restart the resource after a change.
Language
Config.Language = 'en'Available: en, de, fr, es, pt, it, nl, pl, sv, no, fi, cs, ar, he, jp, ko, zh. To change a text, edit the matching file in stg-usedvehicleshop/locales/. The texts of the info card and the contracts are in the web block of the same file.
General
Config.TargetSystem = 'auto'
Config.Unit = 'miles'
Config.PreventListedVehicleUsage = true
Config.AllowChangeVehicle = trueProp
Type
Blocked classes
Config.BlockedClasses = {
-- [0] = true, -- Compacts
-- ...
[14] = true, -- Boats
[15] = true, -- Helicopters
[16] = true, -- Planes
[17] = true, -- Service
[18] = true, -- Emergency
[19] = true, -- Military
[20] = true, -- Commercial
[21] = true, -- Trains
}Vehicle classes players cannot list. Blocked vehicles still show in the dealer menu, greyed out with "This class cannot be listed". Remove the -- in front of a line to block that class, or comment a line out to allow it. The file lists every class id from 0 (Compacts) to 21 (Trains).
Locations
Every location has its own dealer NPC, its own parking spots and its own listings. A car is listed at the lot where the player talked to the dealer. The script ships with 2 locations:
Config.Locations = {
[1] = {
npc = {
model = 'a_m_y_business_02',
coords = vector4(-40.85, -1674.76, 29.47, 139.38),
scenario = 'WORLD_HUMAN_CLIPBOARD',
blip = {
enabled = true,
sprite = 326,
color = 2,
scale = 0.7,
label = 'Used Vehicle Shop'
}
},
spots = {
vector4(-61.32, -1687.74, 29.49, 314.71),
vector4(-57.82, -1690.45, 29.49, 313.89),
-- ...
}
},
-- [2] = { ... }
}Prop
Type
Listed cars are spawned when a player comes within 100 metres of the dealer and removed again when they leave.
Adding a location
Stand where the dealer should be and copy your coordinates and heading, for example with /coords or your admin menu.
Park a car in each spot you want and copy its coordinates and heading.
Add a new entry with the next number, for example [3] = { npc = { ... }, spots = { ... } }. Never renumber an existing location, listings are saved with the location number.
Dealer camera
Config.NPCCamera = {
enabled = true,
fov = 80.0,
distance = 0.58,
height = 0.04,
freeze = false,
shake = 0.03
}A close up of the dealer's face while the vehicle menu or a contract is open.
Prop
Type
Test drive
Config.TestDrive = {
duration = 60,
spawnCoords = vector4(-951.8708, -3362.1538, 13.4812, 58.330),
returnCoords = vector3(-46.69, -1679.78, 29.38),
}Prop
Type
The test drive ends when the time runs out or the player leaves the car. The car is then deleted.
There is one spawnCoords and one returnCoords for all locations. If you add a lot far away from location 1, move returnCoords to a point that suits all of them.
Distances
Config.InfoPopupDistance = 6.0
Config.InteractDistance = 3.5- InfoPopupDistance: the info card of the closest parked car appears within this many metres.
- InteractDistance: the keys on the card work within this many metres: E to buy, G to test drive, X to remove your own listing and H to change the displayed car.
Functions
Config.Functions connects the script to the other resources on your server. Each function already supports the common scripts, so you only change one when you use something else.
getMileage
["getMileage"] = function(plate, vehicle)
if GetResourceState('jg-vehiclemileage') == 'started' then
return exports["jg-vehiclemileage"]:getMileageByPlate(plate) or 0
else
-- your export here
return 0
end
end,Returns the mileage shown on the info card. It reads jg-vehiclemileage when it runs and shows 0 otherwise. Put your own mileage export in the else branch.
Notifications
["helpNotify"] = function(message, icon)
lib.showTextUI(message, { position = "right-center", icon = icon })
end,
["hideHelpNotify"] = function()
lib.hideTextUI()
end,
["notify"] = function(message, type)
lib.notify({ description = message, type = type, duration = 5000 })
end,
["serverNotify"] = function(src, message, type)
TriggerClientEvent('ox_lib:notify', src, { description = message, type = type, duration = 5000 })
end,- helpNotify and hideHelpNotify: show and hide the
[E] Used Vehicle Shopprompt at the dealer when no target script is used. - notify: every message the player sees on their own screen.
- serverNotify: sent from the server, for example to tell an online seller that their car was sold.
setFuel
Fills the tank of the test drive car. It supports ox_fuel, LegacyFuel, cdn-fuel, ps-fuel and stg-fuel, and falls back to the game's own fuel level. Add a branch for any other fuel script.
giveKeys and removeKeys
Give keys when a test drive starts and take them back when it ends. They support qbx_vehiclekeys, qb-vehiclekeys, qs-vehiclekeys, wasabi_carlock, t1ger_keys, mk_vehiclekeys, cd_garage, vehicles_keys, jaksam and renzu_vehiclekeys. Add a branch for your own key script in both functions.
Still having trouble?
Open a ticket on our Discord. Our team answers around 15 hours a day.