๐Ÿงพ
docs.scriptsfivem.com
  • ๐Ÿ‘‹Welcome
  • ๐ŸงพResources
    • ๐Ÿ“ฑsfphone
      • Installations
      • Config
      • Exports
      • Open phone
    • ๐Ÿš—sfracing
      • Installations
      • Config
      • Exports
    • ๐Ÿ’ตsfbanking
      • Installations
      • Config
      • Exports
    • ๐Ÿ’ปsfctab
      • Installations
      • Config
      • Open tablet
      • Exports // Triggers
    • ๐Ÿ› ๏ธsfcrafting
      • Installations
      • Config
      • Open crafting table
    • ๐Ÿ””sfnotify
      • Installations
      • Config
      • Exports // Triggers
    • ๐Ÿ‘ทโ€โ™‚๏ธsfjob
      • Installations
      • Config
      • Exports // Triggers
    • ๐Ÿ’ปsfjobtab
      • Installations
      • Config
      • Triggers
    • โŒšsfgps
      • Installations
      • Config
      • Exports
    • ๐Ÿ‘ฎsfpolice
      • Installations
      • Config
      • Exports/Triggers
    • ๐Ÿฅsfems
      • Installations
      • Config
      • Exports/Triggers
    • ๐Ÿ…ฟ๏ธsfgarages
      • Installations
      • Config
      • Exports/Triggers
    • ๐Ÿ›๏ธsfdoj
      • Installations
      • Config
      • Exports/Triggers
    • ๐ŸŽฃsffishing
      • Installations
      • Config
      • Triggers
    • ๐Ÿš—sfvehicleshop
      • Installations
      • Config
    • ๐Ÿ”งsfmechanic
      • Installations
      • Config
      • Exports/Triggers
    • ๐Ÿฐsfjail
      • Installations
      • Config
      • Exports
    • ๐Ÿ”‘sfkeys
      • Exports
Powered by GitBook
On this page
  • Step 1 โžก Dependencies
  • Not required but recommended:
  • Step 2 โžก Resources in server.cfg
  • Step 3 โžก Database
  • Step 4 โžก folder install-need-data
  • Step 5 โžก folder install-need-data
  • Step 6 โžก Click on Config
  1. Resources
  2. sfpolice

Installations

PrevioussfpoliceNextConfig

Last updated 13 days ago

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.

Not required but recommended:

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 ('[]'),
  `historyowner` 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 ('[]'),
  `fingerprint` int(2) NOT NULL DEFAULT 0
) 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
GitHub - overextended/oxmysql: MySQL resource for FXServer.GitHub
GitHub - citizenfx/screenshot-basic: FiveM client screenshot resourceGitHub
GitHub - mkafrin/PolyZone: PolyZone is a FiveM mod to define zones of different shapes and test whether a point is inside or outside of the zoneGitHub
pre-configured for PolyZone in client_editable.lua/server_editable.lua
pre-configured for ox_lib in client_editable.lua/server_editable.lua
GitHub - overextended/ox_lib: A collection of Lua functions to utilise in other resources.GitHub
scriptsfivem.com | High quality resources for your FiveM server! | sfjob
GitHub - overextended/ox_inventory: Slot-based inventory with metadata.GitHub
pre-configured for ox_inventory in client_editable.lua/server_editable.lua
Logo
Logo
Logo
Logo
Logo
Logo