Installations

Step 1 โžก Dependencies

This is one of the most important parts, since without the dependencies, the resource will never work or not start, here we will list the dependencies with their respective links for you to download and add them to your server.

pre-configured for PolyZone in client_editable.lua/server_editable.lua
pre-configured for ox_lib in client_editable.lua/server_editable.lua
pre-configured for ox_inventory in client_editable.lua/server_editable.lua

Step 2 โžก Resources in server.cfg

if you are using ESX โžก NEVER, but NEVER, you must place the resources above es_extended, if you do this they will never work and will throw errors

The correct order of the resources is as follows, always keeping es_extended, sfjob and its cores above, but the other normal resources below

ensure sfpolice

Step 3 โžก Database

Run query/SQL query and paste below code

CREATE TABLE `jobs_police_cars` (
  `id` int(11) NOT NULL,
  `plate` varchar(16) NOT NULL,
  `status` text NOT NULL DEFAULT ('[]'),
  `notes` text NOT NULL DEFAULT ('[]'),
  `towtruck` text NOT NULL DEFAULT ('[]')
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

CREATE TABLE `jobs_police_category` (
  `id` int(11) NOT NULL,
  `name` varchar(64) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

CREATE TABLE `jobs_police_matters` (
  `id` int(11) NOT NULL,
  `title` varchar(128) NOT NULL,
  `date` varchar(32) NOT NULL,
  `date_create` varchar(32) NOT NULL,
  `whoAdd` varchar(64) NOT NULL,
  `status` int(11) NOT NULL DEFAULT 0,
  `citizens` text NOT NULL DEFAULT ('[]'),
  `officers` text NOT NULL DEFAULT ('[]'),
  `cars` text NOT NULL DEFAULT ('[]'),
  `photos` text NOT NULL DEFAULT ('[]'),
  `message` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

CREATE TABLE `jobs_police_otherdata` (
  `lastWantedPeoples` text NOT NULL DEFAULT ('[]'),
  `lastWantedCars` text NOT NULL DEFAULT ('[]')
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

INSERT INTO `jobs_police_otherdata` (`lastWantedPeoples`, `lastWantedCars`) VALUES ('[]', '[]');

CREATE TABLE `jobs_police_players` (
  `id` int(11) NOT NULL,
  `cid` varchar(64) NOT NULL,
  `avatar` varchar(1024) DEFAULT NULL,
  `status` text NOT NULL DEFAULT ('[]'),
  `notes` text NOT NULL DEFAULT ('[]'),
  `historyJudgments` text NOT NULL DEFAULT ('[]')
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

CREATE TABLE `jobs_police_regulations` (
  `id` int(11) NOT NULL,
  `name` varchar(128) NOT NULL,
  `category` int(11) NOT NULL,
  `money` int(11) NOT NULL,
  `time` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

CREATE TABLE `sf_customstash` (
  `id` int(11) NOT NULL,
  `name` varchar(128) NOT NULL,
  `job` varchar(32) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

CREATE TABLE `jobs_police_evidenceItems` (
  `id` int(11) NOT NULL,
  `item` varchar(64) NOT NULL,
  `name` varchar(128) NOT NULL,
  `serial` varchar(64) NOT NULL,
  `date` varchar(64) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

ALTER TABLE `jobs_police_cars` ADD PRIMARY KEY (`id`);
ALTER TABLE `jobs_police_category` ADD PRIMARY KEY (`id`);
ALTER TABLE `jobs_police_matters` ADD PRIMARY KEY (`id`);
ALTER TABLE `jobs_police_players` ADD PRIMARY KEY (`id`);
ALTER TABLE `jobs_police_regulations` ADD PRIMARY KEY (`id`);
ALTER TABLE `sf_customstash` ADD PRIMARY KEY (`id`);
ALTER TABLE `jobs_police_evidenceItems` ADD PRIMARY KEY (`id`);

ALTER TABLE `jobs_police_cars` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
ALTER TABLE `jobs_police_category` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
ALTER TABLE `jobs_police_matters` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
ALTER TABLE `jobs_police_players` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
ALTER TABLE `jobs_police_regulations` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
ALTER TABLE `sf_customstash` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
ALTER TABLE `jobs_police_evidenceItems` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;;

Example data:

INSERT INTO `jobs_police_category` (`id`, `name`) VALUES
(1, 'Traffic offenses'),
(2, 'Other');

A vin column should be added to the table with vehicles. For example, in ESX, in the owned_vehicles table, add the vin column varchar(32) not null.

ALTER TABLE `owned_vehicles` ADD `vin` varchar(32) NOT NULL AFTER `plate`;

Step 4 โžก folder install-need-data

Copy the data to the appropriate scripts or database, everything is described there.

Step 5 โžก folder install-need-data

Add the VIN number generation code to the script where the vehicle can be purchased so that the VIN number is generated (in the script, e.g.: esx_vehicleshop)

function GenerateVIN()
	local foundNumber = false
	local vin = nil
	while not foundNumber do
		vin = makeid(16)
		local result = exports.oxmysql:executeSync('SELECT COUNT(*) AS `count` FROM `owned_vehicles` WHERE `vin`=@info',{['@info'] = vin})
		local count  = tonumber(result[1].count)
		if count == 0 then
		  foundNumber = true
		end
	end
	return vin
end

local charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
math.randomseed(os.time())
function makeid(length)
	local ret = {}
	local r
	for i = 1, length do
		r = math.random(1, #charset)
		table.insert(ret, charset:sub(r, r))
	end
	return table.concat(ret)
end

Step 6 โžก Click on Config

Last updated