-
Notifications
You must be signed in to change notification settings - Fork 4
/
config.lua
128 lines (103 loc) · 5.48 KB
/
config.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
SUPPORTED_WEAPONS_HASH = {}
SUPPORTED_EQUIPMENT = {}
local REGISTERED_PEDS = {}
local REGISTERED_WPNS = {}
-- Function to create equipment definition
local function createEquipmentDefinition(id_holstered, id_drawn, texture_holstered, texture_drawn)
return {
["id_holstered"] = id_holstered,
["id_drawn"] = id_drawn,
["texture_holstered"] = texture_holstered,
["texture_drawn"] = texture_drawn or texture_holstered
}
end
-- Function to register a ped
local function registerPed(ped_name)
local ped_hash = GetHashKey(ped_name)
if not IsModelValid(ped_hash) then
error("invalid ped: " .. tostring(ped_name))
end
REGISTERED_PEDS[ped_name] = ped_hash
end
-- Function to register a weapon
local function registerWeapon(weapon_name)
local weapon_hash = GetHashKey(weapon_name)
if not IsWeaponValid(weapon_hash) then
error("Invalid weapon " .. tostring(weapon_name))
end
REGISTERED_WPNS[weapon_name] = weapon_hash
SUPPORTED_WEAPONS_HASH[weapon_hash] = true
end
-- Function to register equipment
local function registerEquipment(ped_hash, component_id, weapon_hash, id_holstered, id_drawn, texture_holstered, texture_drawn)
local equipment_definition = createEquipmentDefinition(id_holstered, id_drawn, texture_holstered, texture_drawn)
local weapon_list = SUPPORTED_EQUIPMENT[ped_hash] or {}
local component_list = weapon_list[weapon_hash] or {}
local equipment_list = component_list[component_id] or {}
equipment_list[equipment_definition.id_drawn] = equipment_definition
equipment_list[equipment_definition.id_holstered] = equipment_definition
component_list[component_id] = equipment_list
weapon_list[weapon_hash] = component_list
SUPPORTED_EQUIPMENT[ped_hash] = weapon_list
end
-- Function to mass register equipment within an explicit range
local function registerEquipmentRange(ped_hash, component_id, weapon_hash, id_holstered_init, id_holstered_max, id_drawn_offset, texture_holstered, texture_drawn)
for i = id_holstered_init, id_holstered_max, 2 do
registerEquipment(ped_hash, component_id, weapon_hash, i, i + id_drawn_offset, texture_holstered, texture_drawn)
end
end
-- see https://www.lcpdfr.com/wiki/lspdfr/04/modding/doc/component/ OR https://wiki.rage.mp/index.php?title=Clothes
local COMPONENTS = {
["head"] = 0,
["berd"] = 1, -- masks
["hair"] = 2, -- hair styles
["uppr"] = 3, -- torso: shirt etc [MIGHT BE HANDS]
["lowr"] = 4, -- legs: pants
["jbib"] = 5, -- Bags and Parachutes
["feet"] = 6, -- shoes
["teef"] = 7, -- holster
["accs"] = 8, -- belt
["task"] = 9, -- vests or body armor
["decl"] = 10, -- overlays like text and emblems.
["hand"] = 11 -- hands and arms
}
--[[
##### ##### DO NOT CHANGE VALUES ABOVE ##### #####
##### ##### CONFIG STARTS HERE ##### #####
##### ##### MODIFY BELOW TO YOUR LIKINGS ##### #####
##### ##### SEE README.md FOR DOCUMENTATION ##### #####
]]--
PAUSE_DURATION_BETWEEN_UPDATES_IN_MS = 200
-- see https://docs.fivem.net/docs/game-references/ped-models/ for more ped models
registerPed("mp_f_freemode_01")
registerPed("mp_m_freemode_01")
-- Add more peds as needed
-- see https://wiki.rage.mp/index.php?title=Weapons
registerWeapon("weapon_combatpistol")
registerWeapon("weapon_revolver")
registerWeapon("weapon_revolver_mk2")
registerWeapon("weapon_doubleaction")
registerWeapon("weapon_navyrevolver")
-- Add more weapons as needed
-- Female MP Ped
registerEquipment(REGISTERED_PEDS.mp_f_freemode_01, COMPONENTS.teef, REGISTERED_WPNS.weapon_combatpistol, 3, 1)
registerEquipment(REGISTERED_PEDS.mp_f_freemode_01, COMPONENTS.teef, REGISTERED_WPNS.weapon_combatpistol, 6, 5)
registerEquipment(REGISTERED_PEDS.mp_f_freemode_01, COMPONENTS.teef, REGISTERED_WPNS.weapon_combatpistol, 8, 2)
registerEquipment(REGISTERED_PEDS.mp_f_freemode_01, COMPONENTS.teef, REGISTERED_WPNS.weapon_combatpistol, 29, 30)
registerEquipment(REGISTERED_PEDS.mp_f_freemode_01, COMPONENTS.teef, REGISTERED_WPNS.weapon_combatpistol, 81, 82)
registerEquipment(REGISTERED_PEDS.mp_f_freemode_01, COMPONENTS.accs, REGISTERED_WPNS.weapon_combatpistol, 9, 10)
-- Male MP Ped
registerEquipment(REGISTERED_PEDS.mp_m_freemode_01, COMPONENTS.teef, REGISTERED_WPNS.weapon_combatpistol, 1, 3)
registerEquipment(REGISTERED_PEDS.mp_m_freemode_01, COMPONENTS.teef, REGISTERED_WPNS.weapon_combatpistol, 6, 5)
registerEquipment(REGISTERED_PEDS.mp_m_freemode_01, COMPONENTS.teef, REGISTERED_WPNS.weapon_combatpistol, 8, 2)
registerEquipment(REGISTERED_PEDS.mp_m_freemode_01, COMPONENTS.teef, REGISTERED_WPNS.weapon_combatpistol, 42, 43)
registerEquipment(REGISTERED_PEDS.mp_m_freemode_01, COMPONENTS.teef, REGISTERED_WPNS.weapon_combatpistol, 110, 111)
registerEquipment(REGISTERED_PEDS.mp_m_freemode_01, COMPONENTS.teef, REGISTERED_WPNS.weapon_combatpistol, 119, 120)
registerEquipment(REGISTERED_PEDS.mp_m_freemode_01, COMPONENTS.accs, REGISTERED_WPNS.weapon_combatpistol, 16, 18)
--[[ examples for different weapons
registerEquipment(REGISTERED_PEDS.mp_m_freemode_01, COMPONENTS.teef, REGISTERED_WPNS.weapon_revolver, 8, 2)
registerEquipment(REGISTERED_PEDS.mp_m_freemode_01, COMPONENTS.teef, REGISTERED_WPNS.weapon_revolver_mk2, 8, 2)
registerEquipment(REGISTERED_PEDS.mp_m_freemode_01, COMPONENTS.teef, REGISTERED_WPNS.weapon_doubleaction, 8, 2)
registerEquipment(REGISTERED_PEDS.mp_m_freemode_01, COMPONENTS.teef, REGISTERED_WPNS.weapon_navyrevolver, 8, 2)
]]--
-- Add more equipment as needed