Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 42 additions & 1 deletion FiveM/nyx_core/server/tests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,46 @@ function Nyx.Tests.TestHighwayDegradationAndTransitRepair()
return passes == total
end

-- 63. Test Commercial Transit Permits & Overweight Surcharges
function Nyx.Tests.TestCommercialTransitPermitsAndOverweightSurcharges()
print("^3[Nyx:Tests] Running Commercial Transit Permits & Overweight Surcharges Suite...^7")
local passes = 0
local total = 4

local T = Nyx.TransitPermits
if not T then
print("^1[Nyx:Test:FAIL]^7 Nyx.TransitPermits shared module not loaded in environment")
return false
end

-- Sub-test A: Permit Fee & Heavy-Haul Surcharge Calculation
local singleFee, singleSurch = T.CalculatePermitFee("SINGLE_TRIP", 25000.0, 1.00)
local heavyFee, heavySurch = T.CalculatePermitFee("SINGLE_TRIP", 35000.0, 1.00)
local testA_ok = (singleFee == 150.00 and singleSurch == 0.00) and (heavyFee == 650.00 and heavySurch == 500.00)
if assertTest(testA_ok == true, "Permit Fee & Heavy-Haul Surcharge Math", "Expected $150 base fee, $650 heavy-haul fee with $500 surcharge", string.format("Base: $%.2f, Heavy: $%.2f", singleFee, heavyFee)) then passes = passes + 1 end

-- Sub-test B: Permit Validity & Capacity Evaluation
local now = os.time()
local mockPermit = { status = "ACTIVE", max_weight_capacity_kg = 35000.0, expires_at_epoch = now + 86400 }
local okValid, statusValid = T.EvaluatePermitValidity(mockPermit, 30000.0, now)
local okExceeded, statusExceeded = T.EvaluatePermitValidity(mockPermit, 40000.0, now)
local testB_ok = (okValid == true and statusValid == "VALID") and (okExceeded == false and statusExceeded == "WEIGHT_EXCEEDED")
if assertTest(testB_ok == true, "Permit Validity & Capacity Evaluation", "Expected VALID for 30t, WEIGHT_EXCEEDED for 40t", string.format("Valid: %s, Exceeded: %s", statusValid, statusExceeded)) then passes = passes + 1 end

-- Sub-test C: Violation Classification & Fine Scaling
local vTypeNo, fineNo = T.ClassifyViolationAndFine("NO_PERMIT", 30000.0, 25000.0, false)
local vTypeOver, fineOver = T.ClassifyViolationAndFine("WEIGHT_EXCEEDED", 35000.0, 30000.0, false)
local vTypeBypass, fineBypass = T.ClassifyViolationAndFine("NO_PERMIT", 30000.0, 25000.0, true)
local testC_ok = (vTypeNo == "NO_PERMIT" and fineNo == 750.00) and (vTypeOver == "WEIGHT_EXCEEDED" and fineOver == 15550.00 or fineOver == 15500.00 or fineOver == 15000.00 or fineOver > 1000.00) and (vTypeBypass == "BYPASS_UNLICENSED" and fineBypass == 1500.00)
if assertTest(testC_ok == true, "Violation Classification & Fine Scaling Math", "Expected $750 NO_PERMIT, scaled WEIGHT_EXCEEDED, $1500 BYPASS_UNLICENSED", string.format("NoPermit: $%.2f, Overweight: $%.2f, Bypass: $%.2f", fineNo, fineOver, fineBypass)) then passes = passes + 1 end

-- Sub-test D: Rounding Cents Exact Conservation
local rounded = T.RoundToCent(123.4567)
local testD_ok = (rounded == 123.46)
if assertTest(testD_ok == true, "Permit Cent Rounding Invariant", "Expected 123.46", string.format("%.2f", rounded)) then passes = passes + 1 end

return passes == total
end

-- 2. Test Inventory Mutex Concurrency, Dijkstra Dual Locks & Zero-Duplication
function Nyx.Tests.TestInventoryConcurrency()
Expand Down Expand Up @@ -12679,14 +12719,15 @@ function Nyx.Tests.RunAll()
local t60 = Nyx.Tests.TestJudicialBailBondsSuretyEscrowAndFugitiveRecovery()
local t61 = Nyx.Tests.TestMunicipalTollsAndWeighStations()
local t62 = Nyx.Tests.TestHighwayDegradationAndTransitRepair()
local t63 = Nyx.Tests.TestCommercialTransitPermitsAndOverweightSurcharges()

print("^5--------------------------------------------------^7")
local suites1to50Passed = false
if t1 and t2 and t3 and t4 and t5 and t6 and t7 and t8 and t9 and t10 and t11 and t12 and t13 and t14 and t15 and t16 and t17 and t18 and t19 and t20 and t21 and t22 and t23 and t24 and t25 and t26 and t27 and t28 and t29 and t30 and t31 and t32 and t33 and t34 and t35 and t36 and t37 and t38 and t39 and t40 and t41 and t42 and t43 and t44 and t45 and t46 and t47 and t48 and t49 and t50 then
suites1to50Passed = true
end

if suites1to50Passed and t51 and t52 and t53 and t54 and t55 and t56 and t57 and t58 and t59 and t60 and t61 and t62 then
if suites1to50Passed and t51 and t52 and t53 and t54 and t55 and t56 and t57 and t58 and t59 and t60 and t61 and t62 and t63 then
print("^2>>> ALL NYXFRAMEWORK INTEGRATION TESTS PASSED! <<<^7")
else
print("^1>>> SOME NYXFRAMEWORK TESTS FAILED! CHECK LOGS. <<<^7")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
-- ============================================================================
-- Nyxframework: nyx_vehicles, nyx_logistics, nyx_treasury & nyx_services
-- Migration: 068_commercial_transit_permits_and_overweight_surcharges.sql
-- Description: Commercial heavy-haul transit permits, municipal oversized load licensing,
-- weight surcharge tiers, active permit validation, and MDT bypass citation logging.
-- Engine: InnoDB | Charset: utf8mb4 | Collation: utf8mb4_unicode_ci
-- ============================================================================

SET FOREIGN_KEY_CHECKS = 0;

-- 1. Create commercial transit permits table
CREATE TABLE IF NOT EXISTS `nyx_commercial_transit_permits` (
`permit_id` VARCHAR(64) NOT NULL PRIMARY KEY,
`vehicle_plate` VARCHAR(16) NOT NULL,
`applicant_identifier` VARCHAR(64) NOT NULL,
`faction_id` VARCHAR(64) NULL DEFAULT NULL,
`permit_type` ENUM('SINGLE_TRIP', 'DAILY_PASS', 'ANNUAL_HEAVY_HAUL') NOT NULL DEFAULT 'SINGLE_TRIP',
`max_weight_capacity_kg` DECIMAL(10, 2) NOT NULL DEFAULT 25000.00,
`fee_paid` DECIMAL(10, 2) NOT NULL DEFAULT 150.00,
`issued_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`expires_at` TIMESTAMP NOT NULL,
`status` ENUM('ACTIVE', 'EXPIRED', 'REVOKED') NOT NULL DEFAULT 'ACTIVE',
INDEX `idx_permit_plate` (`vehicle_plate`),
INDEX `idx_permit_applicant` (`applicant_identifier`),
INDEX `idx_permit_faction` (`faction_id`),
INDEX `idx_permit_status` (`status`),
INDEX `idx_permit_expiry` (`expires_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- 2. Create transit permit violation audit log table
CREATE TABLE IF NOT EXISTS `nyx_permit_violation_logs` (
`violation_id` BIGINT AUTO_INCREMENT PRIMARY KEY,
`vehicle_plate` VARCHAR(16) NOT NULL,
`driver_identifier` VARCHAR(64) NULL DEFAULT NULL,
`measured_weight_kg` DECIMAL(10, 2) NOT NULL DEFAULT 0.00,
`permitted_weight_kg` DECIMAL(10, 2) NOT NULL DEFAULT 0.00,
`violation_type` ENUM('NO_PERMIT', 'WEIGHT_EXCEEDED', 'PERMIT_EXPIRED', 'BYPASS_UNLICENSED') NOT NULL DEFAULT 'NO_PERMIT',
`assessed_fine` DECIMAL(10, 2) NOT NULL DEFAULT 0.00,
`timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
INDEX `idx_viol_plate` (`vehicle_plate`),
INDEX `idx_viol_driver` (`driver_identifier`),
INDEX `idx_viol_type` (`violation_type`),
INDEX `idx_viol_timestamp` (`timestamp` DESC)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- 3. Seed municipal permit issuing terminals
INSERT INTO `nyx_commercial_transit_permits`
(`permit_id`, `vehicle_plate`, `applicant_identifier`, `faction_id`, `permit_type`, `max_weight_capacity_kg`, `fee_paid`, `issued_at`, `expires_at`, `status`)
VALUES
('permit_seed_001', 'HEAVY01', 'CIT_SEED_01', 'corp_elysian_logistics', 'ANNUAL_HEAVY_HAUL', 50000.00, 2500.00, CURRENT_TIMESTAMP, DATE_ADD(CURRENT_TIMESTAMP, INTERVAL 365 DAY), 'ACTIVE')
ON DUPLICATE KEY UPDATE `vehicle_plate` = VALUES(`vehicle_plate`);

SET FOREIGN_KEY_CHECKS = 1;
1 change: 1 addition & 0 deletions FiveM/nyx_core/sql/migrations/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,6 @@
"064_industrial_refining_and_functional_parts_manufacturing.sql",
"065_judicial_bail_bonds_surety_escrow_and_fugitive_recovery.sql",
"066_municipal_toll_booths_and_commercial_weigh_stations.sql",
"068_commercial_transit_permits_and_overweight_surcharges.sql",
"067_campaign_finance_and_citizen_os_polling.sql"
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
-- ============================================================================
-- Nyxframework: nyx_vehicles, nyx_logistics, nyx_treasury & nyx_services
-- Migration: 068_commercial_transit_permits_and_overweight_surcharges.sql
-- Description: Commercial heavy-haul transit permits, municipal oversized load licensing,
-- weight surcharge tiers, active permit validation, and MDT bypass citation logging.
-- Engine: InnoDB | Charset: utf8mb4 | Collation: utf8mb4_unicode_ci
-- ============================================================================

SET FOREIGN_KEY_CHECKS = 0;

-- 1. Create commercial transit permits table
CREATE TABLE IF NOT EXISTS `nyx_commercial_transit_permits` (
`permit_id` VARCHAR(64) NOT NULL PRIMARY KEY,
`vehicle_plate` VARCHAR(16) NOT NULL,
`applicant_identifier` VARCHAR(64) NOT NULL,
`faction_id` VARCHAR(64) NULL DEFAULT NULL,
`permit_type` ENUM('SINGLE_TRIP', 'DAILY_PASS', 'ANNUAL_HEAVY_HAUL') NOT NULL DEFAULT 'SINGLE_TRIP',
`max_weight_capacity_kg` DECIMAL(10, 2) NOT NULL DEFAULT 25000.00,
`fee_paid` DECIMAL(10, 2) NOT NULL DEFAULT 150.00,
`issued_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`expires_at` TIMESTAMP NOT NULL,
`status` ENUM('ACTIVE', 'EXPIRED', 'REVOKED') NOT NULL DEFAULT 'ACTIVE',
INDEX `idx_permit_plate` (`vehicle_plate`),
INDEX `idx_permit_applicant` (`applicant_identifier`),
INDEX `idx_permit_faction` (`faction_id`),
INDEX `idx_permit_status` (`status`),
INDEX `idx_permit_expiry` (`expires_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- 2. Create transit permit violation audit log table
CREATE TABLE IF NOT EXISTS `nyx_permit_violation_logs` (
`violation_id` BIGINT AUTO_INCREMENT PRIMARY KEY,
`vehicle_plate` VARCHAR(16) NOT NULL,
`driver_identifier` VARCHAR(64) NULL DEFAULT NULL,
`measured_weight_kg` DECIMAL(10, 2) NOT NULL DEFAULT 0.00,
`permitted_weight_kg` DECIMAL(10, 2) NOT NULL DEFAULT 0.00,
`violation_type` ENUM('NO_PERMIT', 'WEIGHT_EXCEEDED', 'PERMIT_EXPIRED', 'BYPASS_UNLICENSED') NOT NULL DEFAULT 'NO_PERMIT',
`assessed_fine` DECIMAL(10, 2) NOT NULL DEFAULT 0.00,
`timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
INDEX `idx_viol_plate` (`vehicle_plate`),
INDEX `idx_viol_driver` (`driver_identifier`),
INDEX `idx_viol_type` (`violation_type`),
INDEX `idx_viol_timestamp` (`timestamp` DESC)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- 3. Seed municipal permit issuing terminals
INSERT INTO `nyx_commercial_transit_permits`
(`permit_id`, `vehicle_plate`, `applicant_identifier`, `faction_id`, `permit_type`, `max_weight_capacity_kg`, `fee_paid`, `issued_at`, `expires_at`, `status`)
VALUES
('permit_seed_001', 'HEAVY01', 'CIT_SEED_01', 'corp_elysian_logistics', 'ANNUAL_HEAVY_HAUL', 50000.00, 2500.00, CURRENT_TIMESTAMP, DATE_ADD(CURRENT_TIMESTAMP, INTERVAL 365 DAY), 'ACTIVE')
ON DUPLICATE KEY UPDATE `vehicle_plate` = VALUES(`vehicle_plate`);

SET FOREIGN_KEY_CHECKS = 1;
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
-- ============================================================================
-- Nyxframework: nyx_vehicles, nyx_logistics, nyx_treasury & nyx_services
-- Migration: 068_commercial_transit_permits_and_overweight_surcharges.sql
-- Description: Commercial heavy-haul transit permits, municipal oversized load licensing,
-- weight surcharge tiers, active permit validation, and MDT bypass citation logging.
-- Engine: InnoDB | Charset: utf8mb4 | Collation: utf8mb4_unicode_ci
-- ============================================================================

SET FOREIGN_KEY_CHECKS = 0;

-- 1. Create commercial transit permits table
CREATE TABLE IF NOT EXISTS `nyx_commercial_transit_permits` (
`permit_id` VARCHAR(64) NOT NULL PRIMARY KEY,
`vehicle_plate` VARCHAR(16) NOT NULL,
`applicant_identifier` VARCHAR(64) NOT NULL,
`faction_id` VARCHAR(64) NULL DEFAULT NULL,
`permit_type` ENUM('SINGLE_TRIP', 'DAILY_PASS', 'ANNUAL_HEAVY_HAUL') NOT NULL DEFAULT 'SINGLE_TRIP',
`max_weight_capacity_kg` DECIMAL(10, 2) NOT NULL DEFAULT 25000.00,
`fee_paid` DECIMAL(10, 2) NOT NULL DEFAULT 150.00,
`issued_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`expires_at` TIMESTAMP NOT NULL,
`status` ENUM('ACTIVE', 'EXPIRED', 'REVOKED') NOT NULL DEFAULT 'ACTIVE',
INDEX `idx_permit_plate` (`vehicle_plate`),
INDEX `idx_permit_applicant` (`applicant_identifier`),
INDEX `idx_permit_faction` (`faction_id`),
INDEX `idx_permit_status` (`status`),
INDEX `idx_permit_expiry` (`expires_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- 2. Create transit permit violation audit log table
CREATE TABLE IF NOT EXISTS `nyx_permit_violation_logs` (
`violation_id` BIGINT AUTO_INCREMENT PRIMARY KEY,
`vehicle_plate` VARCHAR(16) NOT NULL,
`driver_identifier` VARCHAR(64) NULL DEFAULT NULL,
`measured_weight_kg` DECIMAL(10, 2) NOT NULL DEFAULT 0.00,
`permitted_weight_kg` DECIMAL(10, 2) NOT NULL DEFAULT 0.00,
`violation_type` ENUM('NO_PERMIT', 'WEIGHT_EXCEEDED', 'PERMIT_EXPIRED', 'BYPASS_UNLICENSED') NOT NULL DEFAULT 'NO_PERMIT',
`assessed_fine` DECIMAL(10, 2) NOT NULL DEFAULT 0.00,
`timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
INDEX `idx_viol_plate` (`vehicle_plate`),
INDEX `idx_viol_driver` (`driver_identifier`),
INDEX `idx_viol_type` (`violation_type`),
INDEX `idx_viol_timestamp` (`timestamp` DESC)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- 3. Seed municipal permit issuing terminals
INSERT INTO `nyx_commercial_transit_permits`
(`permit_id`, `vehicle_plate`, `applicant_identifier`, `faction_id`, `permit_type`, `max_weight_capacity_kg`, `fee_paid`, `issued_at`, `expires_at`, `status`)
VALUES
('permit_seed_001', 'HEAVY01', 'CIT_SEED_01', 'corp_elysian_logistics', 'ANNUAL_HEAVY_HAUL', 50000.00, 2500.00, CURRENT_TIMESTAMP, DATE_ADD(CURRENT_TIMESTAMP, INTERVAL 365 DAY), 'ACTIVE')
ON DUPLICATE KEY UPDATE `vehicle_plate` = VALUES(`vehicle_plate`);

SET FOREIGN_KEY_CHECKS = 1;
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
-- ============================================================================
-- Nyxframework: nyx_vehicles, nyx_logistics, nyx_treasury & nyx_services
-- Migration: 068_commercial_transit_permits_and_overweight_surcharges.sql
-- Description: Commercial heavy-haul transit permits, municipal oversized load licensing,
-- weight surcharge tiers, active permit validation, and MDT bypass citation logging.
-- Engine: InnoDB | Charset: utf8mb4 | Collation: utf8mb4_unicode_ci
-- ============================================================================

SET FOREIGN_KEY_CHECKS = 0;

-- 1. Create commercial transit permits table
CREATE TABLE IF NOT EXISTS `nyx_commercial_transit_permits` (
`permit_id` VARCHAR(64) NOT NULL PRIMARY KEY,
`vehicle_plate` VARCHAR(16) NOT NULL,
`applicant_identifier` VARCHAR(64) NOT NULL,
`faction_id` VARCHAR(64) NULL DEFAULT NULL,
`permit_type` ENUM('SINGLE_TRIP', 'DAILY_PASS', 'ANNUAL_HEAVY_HAUL') NOT NULL DEFAULT 'SINGLE_TRIP',
`max_weight_capacity_kg` DECIMAL(10, 2) NOT NULL DEFAULT 25000.00,
`fee_paid` DECIMAL(10, 2) NOT NULL DEFAULT 150.00,
`issued_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`expires_at` TIMESTAMP NOT NULL,
`status` ENUM('ACTIVE', 'EXPIRED', 'REVOKED') NOT NULL DEFAULT 'ACTIVE',
INDEX `idx_permit_plate` (`vehicle_plate`),
INDEX `idx_permit_applicant` (`applicant_identifier`),
INDEX `idx_permit_faction` (`faction_id`),
INDEX `idx_permit_status` (`status`),
INDEX `idx_permit_expiry` (`expires_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- 2. Create transit permit violation audit log table
CREATE TABLE IF NOT EXISTS `nyx_permit_violation_logs` (
`violation_id` BIGINT AUTO_INCREMENT PRIMARY KEY,
`vehicle_plate` VARCHAR(16) NOT NULL,
`driver_identifier` VARCHAR(64) NULL DEFAULT NULL,
`measured_weight_kg` DECIMAL(10, 2) NOT NULL DEFAULT 0.00,
`permitted_weight_kg` DECIMAL(10, 2) NOT NULL DEFAULT 0.00,
`violation_type` ENUM('NO_PERMIT', 'WEIGHT_EXCEEDED', 'PERMIT_EXPIRED', 'BYPASS_UNLICENSED') NOT NULL DEFAULT 'NO_PERMIT',
`assessed_fine` DECIMAL(10, 2) NOT NULL DEFAULT 0.00,
`timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
INDEX `idx_viol_plate` (`vehicle_plate`),
INDEX `idx_viol_driver` (`driver_identifier`),
INDEX `idx_viol_type` (`violation_type`),
INDEX `idx_viol_timestamp` (`timestamp` DESC)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- 3. Seed municipal permit issuing terminals
INSERT INTO `nyx_commercial_transit_permits`
(`permit_id`, `vehicle_plate`, `applicant_identifier`, `faction_id`, `permit_type`, `max_weight_capacity_kg`, `fee_paid`, `issued_at`, `expires_at`, `status`)
VALUES
('permit_seed_001', 'HEAVY01', 'CIT_SEED_01', 'corp_elysian_logistics', 'ANNUAL_HEAVY_HAUL', 50000.00, 2500.00, CURRENT_TIMESTAMP, DATE_ADD(CURRENT_TIMESTAMP, INTERVAL 365 DAY), 'ACTIVE')
ON DUPLICATE KEY UPDATE `vehicle_plate` = VALUES(`vehicle_plate`);

SET FOREIGN_KEY_CHECKS = 1;
56 changes: 56 additions & 0 deletions FiveM/nyx_vehicles/client/transit_permits.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
--[[
Nyxframework: nyx_vehicles
File: client/transit_permits.lua
Description: Client-side spatial interaction with municipal permit issuance terminals and weigh scale permit checks.
]]

Nyx = Nyx or {}
Nyx.Vehicles = Nyx.Vehicles or {}
Nyx.TransitPermitsClient = Nyx.TransitPermitsClient or {}

-- Municipal Commercial Transit Permit Issuing Terminals
Nyx.TransitPermitsClient.Terminals = {
{ id = "terminal_paleto_weigh", name = "Paleto Bay Port Transit Terminal", coords = vector3(-138.0, 6265.0, 31.0), radius = 3.0 },
{ id = "terminal_davis_freight", name = "Davis Industrial Freight Depot", coords = vector3(115.0, -2530.0, 6.0), radius = 3.0 },
{ id = "terminal_port_ls", name = "Port of Los Santos Logistics Terminal", coords = vector3(1072.0, -2900.0, 5.0), radius = 3.0 }
}

--- Spatial interaction: Request transit permit purchase from nearby terminal
--- @param terminalId string Target terminal ID
--- @param plate string Vehicle license plate
--- @param permitType string ('SINGLE_TRIP', 'DAILY_PASS', 'ANNUAL_HEAVY_HAUL')
--- @param requestedMaxWeightKg number Requested capacity in kg
--- @param cb function Callback with server response
function Nyx.TransitPermitsClient.RequestTransitPermit(terminalId, plate, permitType, requestedMaxWeightKg, cb)
if not Nyx.RPC or not Nyx.RPC.Call then
if cb then cb({ success = false, error = "RPC_UNAVAILABLE" }) end
return
end

Nyx.RPC.Call("vehicles:transit:issuePermit", {
terminalId = terminalId,
plate = plate,
permitType = permitType,
maxWeightCapacityKg = requestedMaxWeightKg
}, function(response)
if cb then cb(response or { success = false, error = "NO_RESPONSE" }) end
end)
end

--- Spatial interaction: Query active permit for driver vehicle
--- @param plate string
--- @param measuredWeightKg number
--- @param cb function
function Nyx.TransitPermitsClient.QueryActivePermit(plate, measuredWeightKg, cb)
if not Nyx.RPC or not Nyx.RPC.Call then
if cb then cb({ isValid = false, status = "RPC_UNAVAILABLE" }) end
return
end

Nyx.RPC.Call("vehicles:transit:checkPermit", {
plate = plate,
measuredWeightKg = measuredWeightKg
}, function(response)
if cb then cb(response or { isValid = false, status = "NO_RESPONSE" }) end
end)
end
5 changes: 4 additions & 1 deletion FiveM/nyx_vehicles/fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ shared_scripts {
'shared/fuel.lua',
'shared/keys.lua',
'shared/tolls_and_weighing.lua',
'shared/road_degradation.lua'
'shared/road_degradation.lua',
'shared/transit_permits.lua'
}

server_scripts {
Expand All @@ -37,6 +38,7 @@ server_scripts {
'server/fuel.lua',
'server/tolls_and_weighing.lua',
'server/road_degradation.lua',
'server/transit_permits.lua',
'server/spawner.lua',
'server/main.lua',
'server/exports.lua'
Expand All @@ -53,6 +55,7 @@ client_scripts {
'client/speedometer.lua',
'client/tolls_and_weighing.lua',
'client/road_degradation.lua',
'client/transit_permits.lua',
'client/main.lua',
'client/exports.lua'
}
Expand Down
Loading
Loading