Exports & API
legends_platechanger does not expose public exports. The resource operates through events and item usage.
Overview
This resource is designed to work automatically through the item system. When a player uses the licenseplate item, it triggers the plate changing process internally.
Events
Client Events
legends_platechanger:client:Menu
Triggers the plate change menu. Called automatically when the item is used.
-- This is triggered automatically by the server when item is used
-- You can also trigger it manually if needed:
TriggerEvent('legends_platechanger:client:Menu')Requirements:
- Player must be near their owned vehicle
- Player must have required job (if
Config.RequireJob = true)
legends_platechanger:client:BuyPlateFromNPC
Triggers the NPC purchase dialog.
TriggerEvent('legends_platechanger:client:BuyPlateFromNPC')Requirements:
- Player must meet job requirements (if configured)
- Player must not already have the item in inventory
legends_platechanger:client:libNotify
Displays a notification to the player.
TriggerClientEvent('legends_platechanger:client:libNotify', source, message, type)Parameters:
message(string): The notification texttype(string): 'success', 'error', or 'info'
Server Events
legends_platechanger:server:updatePlate
Updates a vehicle's plate in the database.
TriggerServerEvent('legends_platechanger:server:updatePlate', netID, oldPlate, newPlate)Parameters:
netID(number): Network ID of the vehicleoldPlate(string): Current plate textnewPlate(string): New plate text (3-8 characters)
This event performs server-side validation. It will fail if:
- Player doesn't own the vehicle
- New plate already exists in database
- Player doesn't have required job
- Player doesn't have the item
legends_platechanger:server:BuyPlate
Processes plate purchase from NPC.
TriggerServerEvent('legends_platechanger:server:BuyPlate')Server-side checks:
- Job requirement (if configured)
- Bank balance >=
Config.NPCPrice - Player doesn't already have the item
Server Callbacks
legends_platechanger:server:CheckOwnerVehicle
Checks if the player owns a specific vehicle.
local isOwner = lib.callback.await('legends_platechanger:server:CheckOwnerVehicle', false, plate)Parameters:
plate(string): The vehicle's current plate
Returns: boolean - true if player owns the vehicle
Integration Examples
Custom Shop Integration
If you want to give players the license plate item from your own shop:
-- Server-side: Give the item
local function GiveLicensePlate(source)
-- For ox_inventory
exports.ox_inventory:AddItem(source, 'licenseplate', 1)
-- For qb-inventory
-- exports['qb-inventory']:AddItem(source, 'licenseplate', 1)
-- For ESX
-- local xPlayer = ESX.GetPlayerFromId(source)
-- xPlayer.addInventoryItem('licenseplate', 1)
endChecking If Player Has Item
-- Client-side check
local hasPlate = exports.ox_inventory:Search('count', 'licenseplate') > 0
-- Server-side check
local hasPlate = exports.ox_inventory:GetItem(source, 'licenseplate', nil, true)Custom Trigger for Plate Menu
-- If you want to trigger the plate menu from another resource
-- Make sure the player has the item first
RegisterCommand('changeplate', function()
local hasItem = exports.ox_inventory:Search('count', 'licenseplate') > 0
if hasItem then
TriggerEvent('legends_platechanger:client:Menu')
else
-- Notify player they need the item
end
end)Database Structure
The resource interacts with your framework's vehicle tables:
QB-Core / QBX
-- Table: player_vehicles
-- Columns used: plate, citizenid, modsESX
-- Table: owned_vehicles
-- Columns used: plate, owner, vehicleThe resource automatically handles plate format differences (spaces, dashes, underscores) when checking ownership.
Localization
Language strings are stored in locales/en.json:
{
"title": "Change license plate",
"label": "New license plate",
"desc": "Min. 3, Max. 8 characters",
"lenght": "Maximum 8, minimum 3 characters",
"owner": "You are not the owner of this vehicle!",
"nearby": "You are not on the driver's seat",
"new_license_plate": "New license plate: ",
"same_plate": "This license plate is already taken",
"no_job": "You are not permitted to do this!",
"npc_buy_plate": "Buy License Plate",
"npc_buy_desc": "Purchase a license plate for $",
"npc_success": "You purchased a license plate for $",
"npc_no_money": "You don't have enough money in your bank account!",
"npc_already_have": "You already have a license plate in your inventory!"
}To access translations in code:
local text = _L("key_name")Need Help?
Join our Discord for support: discord.gg/lgnds (opens in a new tab)