Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Z3rio authored Aug 29, 2024
2 parents a945c69 + 404338f commit bcbebb4
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Dependencies
- [qb-core](https://github.com/qbcore-framework/qb-core)
- [qb-logs](https://github.com/qbcore-framework/qb-logs) - For logging transfer and other history
- [qb-smallresources](https://github.com/qbcore-framework/qb-smallresources) - For logging transfer and other history

## Features
- Stashes (Personal and/or Shared)
Expand Down
57 changes: 57 additions & 0 deletions locales/cs.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
local Translations = {
progress = {
['snowballs'] = 'Sbíráš sněhové koule..',
},
notify = {
['failed'] = 'Nepovedlo se',
['canceled'] = 'Zrušeno',
['vlocked'] = 'Vozidlo uzamčeno',
['notowned'] = 'Tento předmět nevlastníš!',
['missitem'] = 'Nemáš tento předmět!',
['nonb'] = 'Nikdo v okolí není!',
['noaccess'] = 'Nepřístupné',
['nosell'] = 'Tento předmět nemůžeš prodat.',
['itemexist'] = 'Předmět neexistuje',
['notencash'] = 'Nemáš dost hotovosti..',
['noitem'] = 'Nemáš správné předměty..',
['gsitem'] = 'Nemůžeš si dát předmět sám sobě?',
['tftgitem'] = 'Jsi příliš daleko na to, aby sis dal předmět!',
['infound'] = 'Předmět, který se snažíš dát, nebyl nalezen!',
['iifound'] = 'Nalezen nesprávný předmět, zkus to znovu!',
['gitemrec'] = 'Dostal jsi ',
['gitemfrom'] = ' Od ',
['gitemyg'] = 'Dal jsi ',
['gitinvfull'] = 'Inventář druhého hráče je plný!',
['giymif'] = 'Tvůj inventář je plný!',
['gitydhei'] = 'Nemáš dost tohoto předmětu',
['gitydhitt'] = 'Nemáš dost předmětů na přenos',
['navt'] = 'Neplatný typ..',
['anfoc'] = 'Argumenty nejsou správně vyplněny..',
['yhg'] = 'Dal jsi ',
['cgitem'] = 'Nelze dát předmět!',
['idne'] = 'Předmět neexistuje',
['pdne'] = 'Hráč není online',
},
inf_mapping = {
['opn_inv'] = 'Otevři inventář',
['tog_slots'] = 'Přepíná sloty klávesových zkratek',
['use_item'] = 'Používá předmět ve slotu ',
},
menu = {
['vending'] = 'Automat',
['bin'] = 'Otevři kontejner',
['craft'] = 'Craft',
['o_bag'] = 'Otevři tašku',
},
interaction = {
['craft'] = '~g~E~w~ - Craft',
},
}

if GetConvar('qb_locale', 'en') == 'cs' then
Lang = Locale:new({
phrases = Translations,
warnOnMissing = true,
fallbackLang = Lang,
})
end
60 changes: 55 additions & 5 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -124,24 +124,26 @@ end)
-- Functions

local function checkWeapon(source, item)
local currentWeapon = type(item) == 'table' and item.name or item
local ped = GetPlayerPed(source)
local weapon = GetSelectedPedWeapon(ped)
local weaponInfo = QBCore.Shared.Weapons[weapon]
if weaponInfo and weaponInfo.name == item.name then
if weaponInfo and weaponInfo.name == currentWeapon then
RemoveWeaponFromPed(ped, weapon)
TriggerClientEvent('qb-weapons:client:UseWeapon', source, { name = currentWeapon }, false)
end
end

-- Events

RegisterNetEvent('qb-inventory:server:openVending', function()
RegisterNetEvent('qb-inventory:server:openVending', function(data)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
if not Player then return end
CreateShop({
name = 'vending',
label = 'Vending Machine',
coords = vendingMachineCoords,
coords = data.coords,
slots = #Config.VendingItems,
items = Config.VendingItems
})
Expand Down Expand Up @@ -183,6 +185,54 @@ RegisterNetEvent('qb-inventory:server:useItem', function(item)
if itemData.type == 'weapon' then
TriggerClientEvent('qb-weapons:client:UseWeapon', src, itemData, itemData.info.quality and itemData.info.quality > 0)
TriggerClientEvent('qb-inventory:client:ItemBox', src, itemInfo, 'use')
elseif itemData.name == 'id_card' then
UseItem(itemData.name, src, itemData)
TriggerClientEvent('qb-inventory:client:ItemBox', source, itemInfo, 'use')
local playerPed = GetPlayerPed(src)
local playerCoords = GetEntityCoords(playerPed)
local players = QBCore.Functions.GetPlayers()
local gender = item.info.gender == 0 and 'Male' or 'Female'
for _, v in pairs(players) do
local targetPed = GetPlayerPed(v)
local dist = #(playerCoords - GetEntityCoords(targetPed))
if dist < 3.0 then
TriggerClientEvent('chat:addMessage', v, {
template = '<div class="chat-message advert" style="background: linear-gradient(to right, rgba(5, 5, 5, 0.6), #74807c); display: flex;"><div style="margin-right: 10px;"><i class="far fa-id-card" style="height: 100%;"></i><strong> {0}</strong><br> <strong>Civ ID:</strong> {1} <br><strong>First Name:</strong> {2} <br><strong>Last Name:</strong> {3} <br><strong>Birthdate:</strong> {4} <br><strong>Gender:</strong> {5} <br><strong>Nationality:</strong> {6}</div></div>',
args = {
'ID Card',
item.info.citizenid,
item.info.firstname,
item.info.lastname,
item.info.birthdate,
gender,
item.info.nationality
}
})
end
end
elseif itemData.name == 'driver_license' then
UseItem(itemData.name, src, itemData)
TriggerClientEvent('qb-inventory:client:ItemBox', src, itemInfo, 'use')
local playerPed = GetPlayerPed(src)
local playerCoords = GetEntityCoords(playerPed)
local players = QBCore.Functions.GetPlayers()
for _, v in pairs(players) do
local targetPed = GetPlayerPed(v)
local dist = #(playerCoords - GetEntityCoords(targetPed))
if dist < 3.0 then
TriggerClientEvent('chat:addMessage', v, {
template = '<div class="chat-message advert" style="background: linear-gradient(to right, rgba(5, 5, 5, 0.6), #657175); display: flex;"><div style="margin-right: 10px;"><i class="far fa-id-card" style="height: 100%;"></i><strong> {0}</strong><br> <strong>First Name:</strong> {1} <br><strong>Last Name:</strong> {2} <br><strong>Birth Date:</strong> {3} <br><strong>Licenses:</strong> {4}</div></div>',
args = {
'Drivers License',
item.info.firstname,
item.info.lastname,
item.info.birthdate,
item.info.type
}
}
)
end
end
else
UseItem(itemData.name, src, itemData)
TriggerClientEvent('qb-inventory:client:ItemBox', src, itemInfo, 'use')
Expand Down Expand Up @@ -357,13 +407,13 @@ QBCore.Functions.CreateCallback('qb-inventory:server:giveItem', function(source,
return
end

local removeItem = RemoveItem(source, item, giveAmount, slot, 'Item given to ID #'..target)
local removeItem = RemoveItem(source, item, giveAmount, slot, 'Item given to ID #' .. target)
if not removeItem then
cb(false)
return
end

local giveItem = AddItem(target, item, giveAmount, false, info, 'Item given from ID #'..source)
local giveItem = AddItem(target, item, giveAmount, false, info, 'Item given from ID #' .. source)
if not giveItem then
cb(false)
return
Expand Down

0 comments on commit bcbebb4

Please sign in to comment.