Skip to content

Commit 4344c3a

Browse files
authored
Merge branch 'main' into fix-isboss-sync
2 parents 8e2628d + a45efe7 commit 4344c3a

File tree

4 files changed

+188
-2
lines changed

4 files changed

+188
-2
lines changed

locale/en.lua

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ local Translations = {
1717
no_permission = 'You don\'t have permissions for this..',
1818
no_waypoint = 'No Waypoint Set.',
1919
tp_error = 'Error While Teleporting.',
20-
connecting_database_error = '[QBCORE] - A database error occurred while connecting to the server. (Is the SQL server on?)',
21-
connecting_database_timeout = '[QBCORE] - Connection to database timed out. (Is the SQL server on?)',
20+
ban_table_not_found = '[QBCORE] - Unable to find the bans table in the database. Please ensure you have imported the SQL file correctly.',
21+
connecting_database_error = '[QBCORE] - An error occurred while connecting to the database. Ensure that the SQL server is running and that the details in the server.cfg file are correct.',
22+
connecting_database_timeout = '[QBCORE] - The database connection has timed out. Ensure that the SQL server is running and that the details in the server.cfg file are correct.',
2223
},
2324
success = {
2425
server_opened = 'The server has been opened',

locale/ml.lua

+132
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
local Translations = {
2+
error = {
3+
not_online = 'പ്ലെയർ ഓൺലൈനല്ല',
4+
wrong_format = 'തെറ്റായ ഫോർമാറ്റ്',
5+
missing_args = 'എല്ലാ വാദങ്ങളും നൽകിയിട്ടില്ല (x, y, z)',
6+
missing_args2 = 'എല്ലാ വാദങ്ങളും പൂരിപ്പിക്കണം!',
7+
no_access = 'ഈ കമാൻഡിലേക്ക് പ്രവേശനമില്ല',
8+
company_too_poor = 'നിങ്ങളുടെ തൊഴിലുടമ തകർന്നിരിക്കുന്നു',
9+
item_not_exist = 'ഇനം നിലവിലില്ല',
10+
too_heavy = 'ഇൻവെൻ്ററി വളരെ നിറഞ്ഞിരിക്കുന്നു',
11+
location_not_exist = 'സ്ഥാനം നിലവിലില്ല',
12+
duplicate_license = '[QBCORE] - ഡ്യൂപ്ലിക്കേറ്റ് റോക്ക്സ്റ്റാർ ലൈസൻസ് കണ്ടെത്തി',
13+
no_valid_license = '[QBCORE] - സാധുവായ റോക്ക്സ്റ്റാർ ലൈസൻസ് കണ്ടെത്തിയില്ല',
14+
not_whitelisted = '[QBCORE] - ഈ സെർവറിനായി നിങ്ങളെ വൈറ്റ്‌ലിസ്റ്റ് ചെയ്‌തിട്ടില്ല',
15+
server_already_open = 'സെർവർ ഇതിനകം തുറന്നിരിക്കുന്നു',
16+
server_already_closed = 'സെർവർ ഇതിനകം അടച്ചിരിക്കുന്നു',
17+
no_permission = 'നിങ്ങൾക്ക് ഇതിന് അനുമതിയില്ല..',
18+
no_waypoint = 'വേപോയിൻ്റ് സെറ്റ് ഇല്ല.',
19+
tp_error = 'ടെലിപോർട്ടിംഗ് സമയത്ത് പിശക്.',
20+
connecting_database_error = '[QBCORE] - സെർവറിലേക്ക് കണക്‌റ്റ് ചെയ്യുമ്പോൾ ഒരു ഡാറ്റാബേസ് പിശക് സംഭവിച്ചു. (SQL സെർവർ ഓണാണോ?)',
21+
connecting_database_timeout = '[QBCORE] - ഡാറ്റാബേസിലേക്കുള്ള കണക്ഷൻ കാലഹരണപ്പെട്ടു. (SQL സെർവർ ഓണാണോ?)',
22+
},
23+
success = {
24+
server_opened = 'സെർവർ തുറന്നിരിക്കുന്നു',
25+
server_closed = 'സെർവർ അടച്ചു',
26+
teleported_waypoint = 'വേപോയിൻ്റിലേക്ക് ടെലിപോർട്ട് ചെയ്തു.',
27+
},
28+
info = {
29+
received_paycheck = 'നിങ്ങളുടെ ശമ്പളം നിങ്ങൾക്ക് ലഭിച്ചു $%{value}',
30+
job_info = 'ജോലി: %{value} | ഗ്രേഡ്: %{value2} | കടമ: %{value3}',
31+
gang_info = 'സംഘം: %{value} | ഗ്രേഡ്: %{value2}',
32+
on_duty = 'നിങ്ങൾ ഇപ്പോൾ ഡ്യൂട്ടിയിലാണ്!',
33+
off_duty = 'നിങ്ങൾ ഇപ്പോൾ ഡ്യൂട്ടിക്ക് പുറത്താണ്!',
34+
checking_ban = 'ഹലോ %s. നിങ്ങളെ നിരോധിച്ചിട്ടുണ്ടോ എന്ന് ഞങ്ങൾ പരിശോധിക്കുന്നു.',
35+
join_server = 'സ്വാഗതം %s {Server Name}.',
36+
checking_whitelisted = 'ഹലോ %s. ഞങ്ങൾ നിങ്ങളുടെ അലവൻസ് പരിശോധിക്കുന്നു.',
37+
exploit_banned = 'വഞ്ചനയ്ക്ക് നിങ്ങളെ വിലക്കിയിട്ടുണ്ട്. കൂടുതൽ വിവരങ്ങൾക്ക് ഞങ്ങളുടെ ഡിസ്കോർഡ് പരിശോധിക്കുക: %{discord}',
38+
exploit_dropped = 'ചൂഷണത്തിന് നിങ്ങളെ പുറത്താക്കി',
39+
},
40+
command = {
41+
tp = {
42+
help = 'ടിപി ടു പ്ലെയർ അല്ലെങ്കിൽ കോർഡുകൾ (അഡ്മിൻ മാത്രം)',
43+
params = {
44+
x = { name = 'id/x', help = 'കളിക്കാരൻ്റെ ഐഡി അല്ലെങ്കിൽ X സ്ഥാനം' },
45+
y = { name = 'y', help = 'Y സ്ഥാനം' },
46+
z = { name = 'z', help = 'Z സ്ഥാനം' },
47+
},
48+
},
49+
tpm = { help = 'TP മാർക്കറിലേക്ക് (അഡ്മിൻ മാത്രം)' },
50+
togglepvp = { help = 'സെർവറിൽ PVP ടോഗിൾ ചെയ്യുക (അഡ്മിൻ മാത്രം)' },
51+
addpermission = {
52+
help = 'കളിക്കാർക്ക് അനുമതി നൽകുക (ദൈവം മാത്രം)',
53+
params = {
54+
id = { name = 'id', help = 'കളിക്കാരൻ്റെ ഐഡി' },
55+
permission = { name = 'അനുമതി', help = 'അനുമതി നില' },
56+
},
57+
},
58+
removepermission = {
59+
help = 'കളിക്കാരുടെ അനുമതികൾ നീക്കം ചെയ്യുക (ദൈവം മാത്രം)',
60+
params = {
61+
id = { name = 'id', help = 'കളിക്കാരൻ്റെ ഐഡി' },
62+
permission = { name = 'അനുമതി', help = 'അനുമതി നില' },
63+
},
64+
},
65+
openserver = { help = 'എല്ലാവർക്കുമായി സെർവർ തുറക്കുക (അഡ്മിൻ മാത്രം)' },
66+
closeserver = {
67+
help = 'അനുമതിയില്ലാത്ത ആളുകൾക്കായി സെർവർ അടയ്ക്കുക (അഡ്മിൻ മാത്രം)',
68+
params = {
69+
reason = { name = 'കാരണം', help = 'അടയ്ക്കാനുള്ള കാരണം (ഓപ്ഷണൽ)' },
70+
},
71+
},
72+
car = {
73+
help = 'സ്പോൺ വെഹിക്കിൾ (അഡ്മിൻ മാത്രം)',
74+
params = {
75+
model = { name = 'മാതൃക', help = 'വാഹനത്തിൻ്റെ മോഡൽ പേര്' },
76+
},
77+
},
78+
dv = { help = 'വാഹനം ഇല്ലാതാക്കുക (അഡ്മിൻ മാത്രം)' },
79+
dvall = { help = 'എല്ലാ വാഹനങ്ങളും ഇല്ലാതാക്കുക (അഡ്മിൻ മാത്രം)' },
80+
dvp = { help = 'എല്ലാ പെഡുകളും ഇല്ലാതാക്കുക (അഡ്മിൻ മാത്രം)' },
81+
dvo = { help = 'എല്ലാ ഒബ്ജക്റ്റുകളും ഇല്ലാതാക്കുക (അഡ്മിൻ മാത്രം)' },
82+
givemoney = {
83+
help = 'ഒരു കളിക്കാരന് പണം നൽകുക (അഡ്മിൻ മാത്രം)',
84+
params = {
85+
id = { name = 'id', help = 'പ്ലെയർ ഐഡി' },
86+
moneytype = { name = 'പണത്തിൻ്റെ തരം', help = 'പണത്തിൻ്റെ തരം (പണം, ബാങ്ക്, ക്രിപ്റ്റോ)' },
87+
amount = { name = 'തുക', help = 'ആകെ തുക' },
88+
},
89+
},
90+
setmoney = {
91+
help = 'കളിക്കാരുടെ പണം സജ്ജീകരിക്കുക (അഡ്മിൻ മാത്രം)',
92+
params = {
93+
id = { name = 'id', help = 'പ്ലെയർ ഐഡി' },
94+
moneytype = { name = 'പണത്തിൻ്റെ തരം', help = 'പണത്തിൻ്റെ തരം (പണം, ബാങ്ക്, ക്രിപ്റ്റോ)' },
95+
amount = { name = 'തുക', help = 'ആകെ തുക' },
96+
},
97+
},
98+
job = { help = 'നിങ്ങളുടെ ജോലി പരിശോധിക്കുക' },
99+
setjob = {
100+
help = 'കളിക്കാരുടെ ജോലി സജ്ജീകരിക്കുക (അഡ്മിൻ മാത്രം)',
101+
params = {
102+
id = { name = 'id', help = 'പ്ലെയർ ഐഡി' },
103+
job = { name = 'ജോലി', help = 'ജോലിയുടെ പേര്' },
104+
grade = { name = 'ഗ്രേഡ്', help = 'ജോലി ഗ്രേഡ്' },
105+
},
106+
},
107+
gang = { help = 'നിങ്ങളുടെ സംഘത്തെ പരിശോധിക്കുക' },
108+
setgang = {
109+
help = 'ഒരു കളിക്കാരുടെ സംഘത്തെ സജ്ജമാക്കുക (അഡ്മിൻ മാത്രം)',
110+
params = {
111+
id = { name = 'id', help = 'പ്ലെയർ ഐഡി' },
112+
gang = { name = 'സംഘം', help = 'സംഘത്തിൻ്റെ പേര്' },
113+
grade = { name = 'ഗ്രേഡ്', help = 'ഗാംഗ് ഗ്രേഡ്' },
114+
},
115+
},
116+
ooc = { help = 'OOC ചാറ്റ് സന്ദേശം' },
117+
me = {
118+
help = 'പ്രാദേശിക സന്ദേശം കാണിക്കുക',
119+
params = {
120+
message = { name = 'സന്ദേശം', help = 'അയയ്ക്കാനുള്ള സന്ദേശം' }
121+
},
122+
},
123+
},
124+
}
125+
126+
if GetConvar('qb_locale', 'en') == 'ml' then
127+
Lang = Locale:new({
128+
phrases = Translations,
129+
warnOnMissing = true,
130+
fallbackLang = Lang,
131+
})
132+
end

server/events.lua

+23
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,21 @@ AddEventHandler('playerDropped', function(reason)
1919
end)
2020

2121
-- Player Connecting
22+
local readyFunction = MySQL.ready
23+
local databaseConnected, bansTableExists = readyFunction == nil, readyFunction == nil
24+
if readyFunction ~= nil then
25+
MySQL.ready(function()
26+
databaseConnected = true
27+
28+
local DatabaseInfo = QBCore.Functions.GetDatabaseInfo()
29+
if not DatabaseInfo or not DatabaseInfo.exists then return end
30+
31+
local result = MySQL.query.await('SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = ? AND TABLE_NAME = "bans";', {DatabaseInfo.database})
32+
if result and result[1] then
33+
bansTableExists = true
34+
end
35+
end)
36+
end
2237

2338
local function onPlayerConnecting(name, _, deferrals)
2439
local src = source
@@ -28,6 +43,10 @@ local function onPlayerConnecting(name, _, deferrals)
2843
return deferrals.done(QBCore.Config.Server.ClosedReason)
2944
end
3045

46+
if not databaseConnected then
47+
return deferrals.done(Lang:t('error.connecting_database_error'))
48+
end
49+
3150
if QBCore.Config.Server.Whitelist then
3251
Wait(0)
3352
deferrals.update(string.format(Lang:t('info.checking_whitelisted'), name))
@@ -49,6 +68,10 @@ local function onPlayerConnecting(name, _, deferrals)
4968
Wait(0)
5069
deferrals.update(string.format(Lang:t('info.checking_ban'), name))
5170

71+
if not bansTableExists then
72+
return deferrals.done(Lang:t('error.ban_table_not_found'))
73+
end
74+
5275
local success, isBanned, reason = pcall(QBCore.Functions.IsPlayerBanned, src)
5376
if not success then return deferrals.done(Lang:t('error.connecting_database_error')) end
5477
if isBanned then return deferrals.done(reason) end

server/functions.lua

+30
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,36 @@ function QBCore.Functions.IsPlayerBanned(source)
623623
return false
624624
end
625625

626+
-- Retrieves information about the database connection.
627+
--- @return table; A table containing the database information.
628+
function QBCore.Functions.GetDatabaseInfo()
629+
local details = {
630+
exists = false,
631+
database = "",
632+
}
633+
local connectionString = GetConvar("mysql_connection_string", "")
634+
635+
if connectionString == "" then
636+
return details
637+
elseif connectionString:find("mysql://") then
638+
connectionString = connectionString:sub(9, -1)
639+
details.database = connectionString:sub(connectionString:find("/") + 1, -1):gsub("[%?]+[%w%p]*$", "")
640+
details.exists = true
641+
return details
642+
else
643+
connectionString = { string.strsplit(";", connectionString) }
644+
645+
for i = 1, #connectionString do
646+
local v = connectionString[i]
647+
if v:match("database") then
648+
details.database = v:sub(10, #v)
649+
details.exists = true
650+
return details
651+
end
652+
end
653+
end
654+
end
655+
626656
---Check for duplicate license
627657
---@param license any
628658
---@return boolean

0 commit comments

Comments
 (0)