Skip to content

Commit 8be7f1e

Browse files
Merge branch 'main' into main
2 parents 2f1067a + 9adb33b commit 8be7f1e

File tree

13 files changed

+342
-98
lines changed

13 files changed

+342
-98
lines changed

client/events.lua

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ RegisterNetEvent('QBCore:Client:VehicleInfo', function(info)
164164
local hasKeys = true
165165

166166
if GetResourceState('qb-vehiclekeys') == 'started' then
167-
hasKeys = exports['qb-vehiclekeys']:HasKeys()
167+
hasKeys = exports['qb-vehiclekeys']:HasKeys(plate)
168168
end
169169

170170
local data = {
@@ -208,15 +208,22 @@ end)
208208

209209
-- Client Callback
210210
RegisterNetEvent('QBCore:Client:TriggerClientCallback', function(name, ...)
211-
QBCore.Functions.TriggerClientCallback(name, function(...)
211+
if not QBCore.ClientCallbacks[name] then return end
212+
213+
QBCore.ClientCallbacks[name](function(...)
212214
TriggerServerEvent('QBCore:Server:TriggerClientCallback', name, ...)
213215
end, ...)
214216
end)
215217

216218
-- Server Callback
217219
RegisterNetEvent('QBCore:Client:TriggerCallback', function(name, ...)
218220
if QBCore.ServerCallbacks[name] then
219-
QBCore.ServerCallbacks[name](...)
221+
QBCore.ServerCallbacks[name].promise:resolve(...)
222+
223+
if QBCore.ServerCallbacks[name].callback then
224+
QBCore.ServerCallbacks[name].callback(...)
225+
end
226+
220227
QBCore.ServerCallbacks[name] = nil
221228
end
222229
end)

client/functions.lua

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,26 @@ function QBCore.Functions.CreateClientCallback(name, cb)
66
QBCore.ClientCallbacks[name] = cb
77
end
88

9-
function QBCore.Functions.TriggerClientCallback(name, cb, ...)
10-
if not QBCore.ClientCallbacks[name] then return end
11-
QBCore.ClientCallbacks[name](cb, ...)
12-
end
9+
function QBCore.Functions.TriggerCallback(name, ...)
10+
local cb = nil
11+
local args = { ... }
12+
13+
if QBCore.Shared.IsFunction(args[1]) then
14+
cb = args[1]
15+
table.remove(args, 1)
16+
end
1317

14-
function QBCore.Functions.TriggerCallback(name, cb, ...)
15-
QBCore.ServerCallbacks[name] = cb
16-
TriggerServerEvent('QBCore:Server:TriggerCallback', name, ...)
18+
QBCore.ServerCallbacks[name] = {
19+
callback = cb,
20+
promise = promise.new()
21+
}
22+
23+
TriggerServerEvent('QBCore:Server:TriggerCallback', name, table.unpack(args))
24+
25+
if cb == nil then
26+
Citizen.Await(QBCore.ServerCallbacks[name].promise)
27+
return QBCore.ServerCallbacks[name].promise.value
28+
end
1729
end
1830

1931
function QBCore.Debug(resource, obj, depth)
@@ -36,6 +48,13 @@ function QBCore.Functions.HasItem(items, amount)
3648
return exports['qb-inventory']:HasItem(items, amount)
3749
end
3850

51+
---Returns the full character name
52+
---@return string
53+
function QBCore.Functions.GetName()
54+
local charinfo = QBCore.PlayerData.charinfo
55+
return charinfo.firstname .. ' ' .. charinfo.lastname
56+
end
57+
3958
---@param entity number - The entity to look at
4059
---@param timeout number - The time in milliseconds before the function times out
4160
---@param speed number - The speed at which the entity should turn
@@ -1075,3 +1094,12 @@ function QBCore.Functions.GetGroundHash(entity)
10751094
local retval, success, endCoords, surfaceNormal, materialHash, entityHit = GetShapeTestResultEx(num)
10761095
return materialHash, entityHit, surfaceNormal, endCoords, success, retval
10771096
end
1097+
1098+
for functionName, func in pairs(QBCore.Functions) do
1099+
if type(func) == 'function' then
1100+
exports(functionName, func)
1101+
end
1102+
end
1103+
1104+
-- Access a specific function directly:
1105+
-- exports['qb-core']:Notify('Hello Player!')

client/main.lua

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,46 @@ QBCore.Shared = QBShared
55
QBCore.ClientCallbacks = {}
66
QBCore.ServerCallbacks = {}
77

8-
exports('GetCoreObject', function()
9-
return QBCore
10-
end)
8+
-- Get the full QBCore object (default behavior):
9+
-- local QBCore = GetCoreObject()
1110

12-
-- To use this export in a script instead of manifest method
13-
-- Just put this line of code below at the very top of the script
14-
-- local QBCore = exports['qb-core']:GetCoreObject()
11+
-- Get only specific parts of QBCore:
12+
-- local QBCore = GetCoreObject({'Players', 'Config'})
13+
14+
local function GetCoreObject(filters)
15+
if not filters then return QBCore end
16+
local results = {}
17+
for i = 1, #filters do
18+
local key = filters[i]
19+
if QBCore[key] then
20+
results[key] = QBCore[key]
21+
end
22+
end
23+
return results
24+
end
25+
exports('GetCoreObject', GetCoreObject)
26+
27+
local function GetSharedItems()
28+
return QBShared.Items
29+
end
30+
exports('GetSharedItems', GetSharedItems)
31+
32+
local function GetSharedVehicles()
33+
return QBShared.Vehicles
34+
end
35+
exports('GetSharedVehicles', GetSharedVehicles)
36+
37+
local function GetSharedWeapons()
38+
return QBShared.Weapons
39+
end
40+
exports('GetSharedWeapons', GetSharedWeapons)
41+
42+
local function GetSharedJobs()
43+
return QBShared.Jobs
44+
end
45+
exports('GetSharedJobs', GetSharedJobs)
46+
47+
local function GetSharedGangs()
48+
return QBShared.Gangs
49+
end
50+
exports('GetSharedGangs', GetSharedGangs)

fxmanifest.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ game 'gta5'
33
lua54 'yes'
44
author 'Kakarot'
55
description 'Core resource for the framework, contains all the core functionality and features'
6-
version '1.2.6'
6+
version '1.3.0'
77

88
shared_scripts {
99
'config.lua',

locale/tr.lua

Lines changed: 119 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,127 @@
11
local Translations = {
22
error = {
3-
not_online = 'Oyuncu çevrimiçi değil.',
4-
wrong_format = 'Yanlış format.',
5-
missing_args = 'Hiçbir argüman girilmedi. (x, y, z)',
6-
missing_args2 = 'Tüm argümanlar doldurulmalıdır.',
7-
no_access = 'Bu komuta erişimin yok.',
8-
company_too_poor = 'Şirketin hiç parası yok.',
9-
item_not_exist = 'Eşya mevcut değil.',
10-
too_heavy = 'Envanter çok dolu',
11-
duplicate_license = 'Aynı rockstar lisansı zaten şu an sunucuda!',
12-
no_valid_license = 'Geçerli bir rockstar lisans bulunamadı.',
13-
not_whitelisted = 'Bu sunucuda whitelistin yok.'
3+
not_online = 'Oyuncu çevrimdışı',
4+
wrong_format = 'Hatalı format',
5+
missing_args = 'Tüm argümanlar girilmedi (x, y, z)',
6+
missing_args2 = 'Tüm argümanlar doldurulmalıdır!',
7+
no_access = 'Bu komut için erişiminiz yok',
8+
company_too_poor = 'İşvereniniz iflas etti',
9+
item_not_exist = 'Eşya mevcut değil',
10+
too_heavy = 'Envanter çok dolu',
11+
location_not_exist = 'Konum mevcut değil',
12+
duplicate_license = '[QBCORE] - Aynı Rockstar Lisansı Bulundu',
13+
no_valid_license = '[QBCORE] - Geçerli Rockstar Lisansı Bulunamadı',
14+
not_whitelisted = '[QBCORE] - Bu sunucu için beyaz listedesiniz',
15+
server_already_open = 'Sunucu zaten açık',
16+
server_already_closed = 'Sunucu zaten kapalı',
17+
no_permission = 'Bu işlem için yetkiniz yok...',
18+
no_waypoint = 'Bir işaret noktası ayarlanmamış.',
19+
tp_error = 'Taşınırken hata oluştu.',
20+
ban_table_not_found = '[QBCORE] - Veritabanında yasaklılar tablosu bulunamadı. Lütfen SQL dosyasının doğru şekilde yüklendiğinden emin olun.',
21+
connecting_database_error = '[QBCORE] - Veritabanına bağlanırken hata oluştu. SQL sunucusunun çalıştığından ve server.cfg dosyasındaki bilgilerin doğru olduğundan emin olun.',
22+
connecting_database_timeout = '[QBCORE] - Veritabanı bağlantısı zaman aşımına uğradı. SQL sunucusunun çalıştığından ve server.cfg dosyasındaki bilgilerin doğru olduğundan emin olun.',
23+
},
24+
success = {
25+
server_opened = 'Sunucu açıldı',
26+
server_closed = 'Sunucu kapandı',
27+
teleported_waypoint = 'İşaret noktasına taşındınız.',
1428
},
15-
success = {},
1629
info = {
17-
received_paycheck = '$%{value} tutarında bir maaş çeki aldın.',
18-
job_info = 'İş: %{value} | Seviye: %{value2} | Görev: %{value3}',
30+
received_paycheck = 'Maaşınızı $%{value} aldınız',
31+
job_info = 'İş: %{value} | Seviye: %{value2} | Görevde: %{value3}',
1932
gang_info = 'Çete: %{value} | Seviye: %{value2}',
20-
on_duty = 'Mesaiye girdin.',
21-
off_duty = 'Mesaiden çıktın.',
22-
checking_ban = 'Merhaba %s. Banlı mısın diye kontrol ediyoruz.',
23-
join_server = 'Merhaba %s. {Server Name} adlı sunucumuza hoş geldin.',
24-
checking_whitelisted = 'Merhaba %s. Whitelist\'in var mı diye kontrol ediyoruz.'
25-
}
33+
on_duty = 'Artık görevdeyiniz!',
34+
off_duty = 'Artık görev dışında oldunuz!',
35+
checking_ban = 'Merhaba %s. Yasaklı olup olmadığınızı kontrol ediyoruz.',
36+
join_server = 'Hoşgeldiniz %s, {Sunucu Adı}\'na.',
37+
checking_whitelisted = 'Merhaba %s. İzin durumunuzu kontrol ediyoruz.',
38+
exploit_banned = 'Hile yaptığınız için yasaklandınız. Daha fazla bilgi için Discord\'umuza göz atın: %{discord}',
39+
exploit_dropped = 'Hile yapmaktan dolayı sunucudan atıldınız',
40+
},
41+
command = {
42+
tp = {
43+
help = 'Oyuncuya veya Koordinatlara TP (Sadece Admin)',
44+
params = {
45+
x = { name = 'id/x', help = 'Oyuncu ID\'si veya X konumu' },
46+
y = { name = 'y', help = 'Y konumu' },
47+
z = { name = 'z', help = 'Z konumu' },
48+
},
49+
},
50+
tpm = { help = 'İşaret noktasına TP (Sadece Admin)' },
51+
togglepvp = { help = 'Sunucuda PVP modunu aç/kapat (Sadece Admin)' },
52+
addpermission = {
53+
help = 'Oyuncuya Yetki Ver (Tanrı Yetkisi)',
54+
params = {
55+
id = { name = 'id', help = 'Oyuncu ID\'si' },
56+
permission = { name = 'permission', help = 'Yetki seviyesi' },
57+
},
58+
},
59+
removepermission = {
60+
help = 'Oyuncudan Yetki Al (Tanrı Yetkisi)',
61+
params = {
62+
id = { name = 'id', help = 'Oyuncu ID\'si' },
63+
permission = { name = 'permission', help = 'Yetki seviyesi' },
64+
},
65+
},
66+
openserver = { help = 'Sunucuyu herkes için aç (Sadece Admin)' },
67+
closeserver = {
68+
help = 'Sunucuyu yetkisi olmayanlar için kapat (Sadece Admin)',
69+
params = {
70+
reason = { name = 'reason', help = 'Kapanma nedeni (isteğe bağlı)' },
71+
},
72+
},
73+
car = {
74+
help = 'Araç Spawn Et (Sadece Admin)',
75+
params = {
76+
model = { name = 'model', help = 'Araç model adı' },
77+
},
78+
},
79+
dv = { help = 'Aracı Sil (Sadece Admin)' },
80+
dvall = { help = 'Tüm Araçları Sil (Sadece Admin)' },
81+
dvp = { help = 'Tüm Pedleri Sil (Sadece Admin)' },
82+
dvo = { help = 'Tüm Objeleri Sil (Sadece Admin)' },
83+
givemoney = {
84+
help = 'Bir Oyuncuya Para Ver (Sadece Admin)',
85+
params = {
86+
id = { name = 'id', help = 'Oyuncu ID\'si' },
87+
moneytype = { name = 'moneytype', help = 'Para türü (nakit, banka, kripto)' },
88+
amount = { name = 'amount', help = 'Verilecek para miktarı' },
89+
},
90+
},
91+
setmoney = {
92+
help = 'Oyuncunun Para Miktarını Ayarla (Sadece Admin)',
93+
params = {
94+
id = { name = 'id', help = 'Oyuncu ID\'si' },
95+
moneytype = { name = 'moneytype', help = 'Para türü (nakit, banka, kripto)' },
96+
amount = { name = 'amount', help = 'Para miktarı' },
97+
},
98+
},
99+
job = { help = 'İşinizi Kontrol Edin' },
100+
setjob = {
101+
help = 'Bir Oyuncunun İşini Ayarla (Sadece Admin)',
102+
params = {
103+
id = { name = 'id', help = 'Oyuncu ID\'si' },
104+
job = { name = 'job', help = 'İş adı' },
105+
grade = { name = 'grade', help = 'İş seviyesi' },
106+
},
107+
},
108+
gang = { help = 'Çetenizi Kontrol Edin' },
109+
setgang = {
110+
help = 'Bir Oyuncunun Çetesini Ayarla (Sadece Admin)',
111+
params = {
112+
id = { name = 'id', help = 'Oyuncu ID\'si' },
113+
gang = { name = 'gang', help = 'Çete adı' },
114+
grade = { name = 'grade', help = 'Çete seviyesi' },
115+
},
116+
},
117+
ooc = { help = 'OOC Sohbet Mesajı' },
118+
me = {
119+
help = 'Yerel mesaj gönder',
120+
params = {
121+
message = { name = 'message', help = 'Gönderilecek mesaj' }
122+
},
123+
},
124+
},
26125
}
27126

28127
if GetConvar('qb_locale', 'en') == 'tr' then

server/commands.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,9 @@ QBCore.Commands.Add('tp', Lang:t('command.tp.help'), { { name = Lang:t('command.
104104
local x = tonumber((args[1]:gsub(',', ''))) + .0
105105
local y = tonumber((args[2]:gsub(',', ''))) + .0
106106
local z = tonumber((args[3]:gsub(',', ''))) + .0
107+
local heading = args[4] and tonumber((args[4]:gsub(',', ''))) + .0 or false
107108
if x ~= 0 and y ~= 0 and z ~= 0 then
108-
TriggerClientEvent('QBCore:Command:TeleportToCoords', source, x, y, z)
109+
TriggerClientEvent('QBCore:Command:TeleportToCoords', source, x, y, z, heading)
109110
else
110111
TriggerClientEvent('QBCore:Notify', source, Lang:t('error.wrong_format'), 'error')
111112
end

server/events.lua

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ local databaseConnected, bansTableExists = readyFunction == nil, readyFunction =
3232
if readyFunction ~= nil then
3333
MySQL.ready(function()
3434
databaseConnected = true
35-
35+
3636
local DatabaseInfo = QBCore.Functions.GetDatabaseInfo()
3737
if not DatabaseInfo or not DatabaseInfo.exists then return end
3838

@@ -125,15 +125,23 @@ end)
125125
-- Client Callback
126126
RegisterNetEvent('QBCore:Server:TriggerClientCallback', function(name, ...)
127127
if QBCore.ClientCallbacks[name] then
128-
QBCore.ClientCallbacks[name](...)
128+
QBCore.ClientCallbacks[name].promise:resolve(...)
129+
130+
if QBCore.ClientCallbacks[name].callback then
131+
QBCore.ClientCallbacks[name].callback(...)
132+
end
133+
129134
QBCore.ClientCallbacks[name] = nil
130135
end
131136
end)
132137

133138
-- Server Callback
134139
RegisterNetEvent('QBCore:Server:TriggerCallback', function(name, ...)
140+
if not QBCore.ServerCallbacks[name] then return end
141+
135142
local src = source
136-
QBCore.Functions.TriggerCallback(name, src, function(...)
143+
144+
QBCore.ServerCallbacks[name](src, function(...)
137145
TriggerClientEvent('QBCore:Client:TriggerCallback', src, name, ...)
138146
end, ...)
139147
end)

0 commit comments

Comments
 (0)