Skip to main content

Beginner BLT modding

This guide will be a full tutorial on how to make your first BLT mod with a suitable example to follow along.

The example mod will hide all modsjobs from Crime.Net which are not stealthable.

mod.txt

Every mod needs this file. This file is responsible for loading your mod with BLT. Below you will find the mod.txt used for this example which can serve as a template as well. Most of the fields should be self explanatory expect for the hooks. We will get back to this later.

{
	"name": "Hide loud jobs",
	"description": "Hides modsjobs from crime.net which are not stealthable",
	"author": "Your name",
	"version": "1.0",
	"blt_version": 2,
	"hooks": [
		{
			"hook_id": "lib/managers/crimenetmanager",
			"script_path": "mod.lua"
		}
	]
}

mod.lua [Hard Overwrite]

This method is the most powerful although not very compatible-friendly approach.

  • PRO: You are in full control by modifying the original source code
  • CON: Only 1 mod installed can hard-overwrite the function. All other mods manipulating the same function will not work.
function CrimeNetGui:add_server_job(data)
	if managers.job:is_job_ghostable(data.job_id) then
		local gui_data = self:_create_job_gui(data, "server")
		gui_data.server = true
		gui_data.host_name = data.host_name
		self._jobs[data.id] = gui_data
	end
end

mod.lua [Soft Overwrite]

Not recommended.
local old_add_server_job = CrimeNetGui.add_server_job

function CrimeNetGui:add_server_job(data)
	if managers.job:is_job_ghostable(data.job_id) then
		old_add_server_job(self, data)
	end
end

mod.lua [Hook]

Recommended.

This method is very compatible friendly and

Hooks:PostHook(CrimeNetGui, 'add_server_job', 'hideloudjobs_crimenetgui',
function(self, data)
	if not managers.job:is_job_ghostable(data.job_id) then
		self:remove_job(data.id, true)
	end
end)

Folder Structure