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 mods 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 mods 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]
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]
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]
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)