Installations
server.cfg
Add the command to your server.cfg file and make sure that the script is started.
ensure mt_parking
config.lua
You can configure everything in config.lua. Once you have made your desired changes, you'll need to restart your server to ensure that everything works smoothly.
Config = {}
-- This parameter dictates the spawning distance of vehicles in relation to the nearest player, measured in meters.
Config.spawnDistance = 500.0
-- This parameter determines the timeframe for removing a vehicle entry from the database table upon invoking the cleanup function. The timeframe is specified in hours; for instance, 24 * 7 equals one week.
Config.cleanUpThresholdTime = 24 * 7
-- Set this to true if you also want the cleanup to run at a specific time of day.
Config.useCleanUpTask = true
-- Used exclusively when the 'useCleanUpTask' parameter is configured to 'true'.
Config.cleanUpTaskTime = {
hours = 3,
minutes = 0,
seconds = 0
}
-- This feature allows you to set a time limit for vehicle deletion (in minutes). Set it to 0 if you do not wish to utilize this function. This option proves particularly beneficial for managing vehicles on expansive servers with high player traffic.
Config.deleteTimer = 0
-- Despawns any vehicles located more than x meters away from a player.
Config.deleteDistance = 25.0
-- The timing for displaying notifications prior to despawning must be in descending order in minutes and less than the Config.deleteTimer.
Config.deleteNotificationTimes = { 5, 3, 2, 1 }
-- Notification to be displayed to players before vehicle deletion (utilize %s as a placeholder for the remaining time in minutes).
Config.timeLeftNotification = "Vehicles will be despawned in %s minutes."
-- Notification to alert players when deleting vehicles.
Config.deleteNotification = "Removing vehicles..."
-- Set this to false if you prefer entities not to appear scorched when they are completely broken.
Config.renderScorched = true
-- Please list the vehicle classes you do not wish to save here. If you want a specific number blacklisted, simply remove '--' in front of it.
Config.blacklistclasse = {
-- 0, -- Compacts
-- 1, -- Sedans
-- 2, -- SUVs
-- 3, -- Coupes
-- 4, -- Muscle
-- 5, -- Sports Classics
-- 6, -- Sports
-- 7, -- Super
-- 8, -- Motorcycles
-- 9, -- Off-road
--10, -- Industrial
--11, -- Utility
--12, -- Vans
--13, -- Cycles
--14, -- Boats
--15, -- Helicopters
--16, -- Planes
--17, -- Service
--18, -- Emergency
--19, -- Military
--20, -- Commercial
--21, -- Trains
}
-- Any other vehicles that you do not wish to save can be inserted here (using 'MODELNAME' as a placeholder).
Config.blacklistcar = {
--`mule`,
--`t20`,
}
-- Please deposit any unwanted vehicle license plates here. Case sensitivity is not an issue, and partial strings are acceptable.
Config.blacklistplates = {
--"MTservice",
--"LS 1234",
}
es_extandet
Please adjust the code in your file functions.lua
in the directory es_extended/client/
as follows:
Find the following function:
function ESX.Game.DeleteVehicle(vehicle)
SetEntityAsMissionEntity(vehicle, false, true)
DeleteVehicle(vehicle)
end
Change it to:
ESX.Game.DeleteVehicle = function(vehicle)
if not DoesEntityExist(vehicle) then
return
end
if NetworkGetEntityIsNetworked(vehicle) then
TriggerServerEvent("mt_parking:deleteVehicle", GetVehicleNumberPlateText(vehicle), true)
Citizen.Wait(500)
end
SetEntityAsMissionEntity(vehicle, false, true)
DeleteVehicle(vehicle)
end
MySQL
Please insert the following MySQL
code into your MySQL
server to record the positions of the cars.
CREATE TABLE IF NOT EXISTS `mt_parking` (
`plate` varchar(8) NOT NULL,
`px` float NOT NULL,
`py` float NOT NULL,
`pz` float NOT NULL,
`rx` float NOT NULL,
`ry` float NOT NULL,
`rz` float NOT NULL,
`tuning` text NOT NULL,
`info` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`plate`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Last updated
Was this helpful?