Skip to content

Commit

Permalink
Update to locals and config
Browse files Browse the repository at this point in the history
Update to remove labels and modified locals to Lang
  • Loading branch information
Demo4889 authored Jan 12, 2022
1 parent 56f773f commit 571a042
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 242 deletions.
34 changes: 17 additions & 17 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ RegisterNetEvent('weapon:client:AddAmmo', function(type, amount, itemData)
local total = GetAmmoInPedWeapon(ped, weapon)
local found, maxAmmo = GetMaxAmmo(ped, weapon)
if total < maxAmmo then
QBCore.Functions.Progressbar("taking_bullets", LangWeapons:t('info.loading_bullets'), math.random(4000, 6000), false, true, {
QBCore.Functions.Progressbar("taking_bullets", Lang:t('info.loading_bullets'), math.random(4000, 6000), false, true, {
disableMovement = false,
disableCarMovement = false,
disableMouse = false,
Expand All @@ -93,19 +93,19 @@ RegisterNetEvent('weapon:client:AddAmmo', function(type, amount, itemData)
TriggerServerEvent("weapons:server:AddWeaponAmmo", CurrentWeaponData, total + amount)
TriggerServerEvent('QBCore:Server:RemoveItem', itemData.name, 1, itemData.slot)
TriggerEvent('inventory:client:ItemBox', QBCore.Shared.Items[itemData.name], "remove")
TriggerEvent('QBCore:Notify', LangWeapons:t('success.reloaded'), "success")
TriggerEvent('QBCore:Notify', Lang:t('success.reloaded'), "success")
end
end, function()
QBCore.Functions.Notify(LangWeapons:t('error.canceled'), "error")
QBCore.Functions.Notify(Lang:t('error.canceled'), "error")
end)
else
QBCore.Functions.Notify(LangWeapons:t('error.max_ammo'), "error")
QBCore.Functions.Notify(Lang:t('error.max_ammo'), "error")
end
else
QBCore.Functions.Notify(LangWeapons:t('error.no_weapon'), "error")
QBCore.Functions.Notify(Lang:t('error.no_weapon'), "error")
end
else
QBCore.Functions.Notify(LangWeapons:t('error.no_weapon'), "error")
QBCore.Functions.Notify(Lang:t('error.no_weapon'), "error")
end
end)

Expand All @@ -119,11 +119,11 @@ RegisterNetEvent("weapons:client:EquipAttachment", function(ItemData, attachment
if WeaponAttachments[WeaponData.name][attachment]['item'] == ItemData.name then
TriggerServerEvent("weapons:server:EquipAttachment", ItemData, CurrentWeaponData, WeaponAttachments[WeaponData.name][attachment])
else
QBCore.Functions.Notify(LangWeapons:t('error.no_support_attachment'), "error")
QBCore.Functions.Notify(Lang:t('error.no_support_attachment'), "error")
end
end
else
QBCore.Functions.Notify(LangWeapons:t('error.no_weapon_in_hand'), "error")
QBCore.Functions.Notify(Lang:t('error.no_weapon_in_hand'), "error")
end
end)

Expand Down Expand Up @@ -188,7 +188,7 @@ CreateThread(function()
else
if weapon ~= -1569615261 then
TriggerEvent('inventory:client:CheckWeapon', QBCore.Shared.Weapons[weapon]["name"])
QBCore.Functions.Notify(LangWeapons:t('error.weapon_broken'), "error")
QBCore.Functions.Notify(Lang:t('error.weapon_broken'), "error")
MultiplierAmount = 0
end
end
Expand All @@ -212,20 +212,20 @@ CreateThread(function()
if distance < 1 then
if data.IsRepairing then
if data.RepairingData.CitizenId ~= PlayerData.citizenid then
DrawText3Ds(data.coords.x, data.coords.y, data.coords.z, LangWeapons:t('info.repairshop_not_usable'))
DrawText3Ds(data.coords.x, data.coords.y, data.coords.z, Lang:t('info.repairshop_not_usable'))
else
if not data.RepairingData.Ready then
DrawText3Ds(data.coords.x, data.coords.y, data.coords.z, LangWeapons:t('info.weapon_will_repair'))
DrawText3Ds(data.coords.x, data.coords.y, data.coords.z, Lang:t('info.weapon_will_repair'))
else
DrawText3Ds(data.coords.x, data.coords.y, data.coords.z, LangWeapons:t('info.take_weapon_back'))
DrawText3Ds(data.coords.x, data.coords.y, data.coords.z, Lang:t('info.take_weapon_back'))
end
end
else
if CurrentWeaponData and next(CurrentWeaponData) then
if not data.RepairingData.Ready then
local WeaponData = QBCore.Shared.Weapons[GetHashKey(CurrentWeaponData.name)]
local WeaponClass = (QBCore.Shared.SplitStr(WeaponData.ammotype, "_")[2]):lower()
DrawText3Ds(data.coords.x, data.coords.y, data.coords.z, LangWeapons:t('info.repair_weapon_price', { value = Config.WeaponRepairCosts[WeaponClass] }))
DrawText3Ds(data.coords.x, data.coords.y, data.coords.z, Lang:t('info.repair_weapon_price', { value = Config.WeaponRepairCosts[WeaponClass] }))
if IsControlJustPressed(0, 38) then
QBCore.Functions.TriggerCallback('weapons:server:RepairWeapon', function(HasMoney)
if HasMoney then
Expand All @@ -235,19 +235,19 @@ CreateThread(function()
end
else
if data.RepairingData.CitizenId ~= PlayerData.citizenid then
DrawText3Ds(data.coords.x, data.coords.y, data.coords.z, LangWeapons:t('info.repairshop_not_usable'))
DrawText3Ds(data.coords.x, data.coords.y, data.coords.z, Lang:t('info.repairshop_not_usable'))
else
DrawText3Ds(data.coords.x, data.coords.y, data.coords.z, LangWeapons:t('info.take_weapon_back'))
DrawText3Ds(data.coords.x, data.coords.y, data.coords.z, Lang:t('info.take_weapon_back'))
if IsControlJustPressed(0, 38) then
TriggerServerEvent('weapons:server:TakeBackWeapon', k, data)
end
end
end
else
if data.RepairingData.CitizenId == nil then
DrawText3Ds(data.coords.x, data.coords.y, data.coords.z, LangWeapons:t('error.no_weapon_in_hand'))
DrawText3Ds(data.coords.x, data.coords.y, data.coords.z, Lang:t('error.no_weapon_in_hand'))
elseif data.RepairingData.CitizenId == PlayerData.citizenid then
DrawText3Ds(data.coords.x, data.coords.y, data.coords.z, LangWeapons:t('info.take_weapon_back'))
DrawText3Ds(data.coords.x, data.coords.y, data.coords.z, Lang:t('info.take_weapon_back'))
if IsControlJustPressed(0, 38) then
TriggerServerEvent('weapons:server:TakeBackWeapon', k, data)
end
Expand Down
Loading

0 comments on commit 571a042

Please sign in to comment.