Skip to content

Commit

Permalink
Merge pull request #203 from Luke20201/main
Browse files Browse the repository at this point in the history
Move Ammo Types into the Config instead of server.lua
  • Loading branch information
GhzGarage authored Nov 19, 2024
2 parents c1f3776 + dec706a commit c9f8397
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
10 changes: 10 additions & 0 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ Config.DurabilityBlockedWeapons = {
'weapon_unarmed',
}

Config.AmmoTypes = {
pistol_ammo = { ammoType = 'AMMO_PISTOL', amount = 30 },
rifle_ammo = { ammoType = 'AMMO_RIFLE', amount = 30 },
smg_ammo = { ammoType = 'AMMO_SMG', amount = 30 },
shotgun_ammo = { ammoType = 'AMMO_SHOTGUN', amount = 10 },
mg_ammo = { ammoType = 'AMMO_MG', amount = 30 },
snp_ammo = { ammoType = 'AMMO_SNIPER', amount = 10 },
emp_ammo = { ammoType = 'AMMO_EMPLAUNCHER', amount = 10 },
}

Config.Throwables = {
'ball',
'bzgas',
Expand Down
12 changes: 1 addition & 11 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -205,17 +205,7 @@ end, 'god')
-- Items

-- AMMO
local AmmoTypes = {
pistol_ammo = { ammoType = 'AMMO_PISTOL', amount = 30 },
rifle_ammo = { ammoType = 'AMMO_RIFLE', amount = 30 },
smg_ammo = { ammoType = 'AMMO_SMG', amount = 30 },
shotgun_ammo = { ammoType = 'AMMO_SHOTGUN', amount = 10 },
mg_ammo = { ammoType = 'AMMO_MG', amount = 30 },
snp_ammo = { ammoType = 'AMMO_SNIPER', amount = 10 },
emp_ammo = { ammoType = 'AMMO_EMPLAUNCHER', amount = 10 }
}

for ammoItem, properties in pairs(AmmoTypes) do
for ammoItem, properties in pairs(Config.AmmoTypes) do
QBCore.Functions.CreateUseableItem(ammoItem, function(source, item)
TriggerClientEvent('qb-weapons:client:AddAmmo', source, properties.ammoType, properties.amount, item)
end)
Expand Down

0 comments on commit c9f8397

Please sign in to comment.