@Vespura you create less tables if you do it like this. Maybe you can OR the components too or?
function ApplyWeaponLoadout (ped, weapons)
local hash
local ammo
ped = ped or GetPlayerPed(-1)
RemoveAllPedWeapons(ped)
for _, weapon in pairs(weapons) do
hash = MODULE.UTILS.toModel(weapon[1])
ammo = weapon[2] or 1
GiveWeaponToPed(ped, hash, ammo, false, weapon[4] == true)
for i, component in ipairs(weapon[3]) do
GiveWeaponComponentToPed(ped, hash, component)
end
end
end
ApplyWeaponLoadout(PlayerPedId(), {
CombatPistol = { 0x5EF9FEC4, 200, { 0x359B7AAE, 0xD67B4F2D } }, -- Flashlight | Extended Clip
CarbineRifle = { 0x83BF0278, 200, { 0x7BC4CDDC, 0x91109691, 0xC164F53, 0xA0D89C42 }, true } -- Flashlight | Extended Clip | Grip | Scope
})
1 Like