Fix Styling (#758)

* style: ensure consistent indentation

* style: add spacing

* style: add newlines

* style: simplify html

* fix: update javascript indent size in contribution guidelines
This commit is contained in:
David Malchin
2022-07-18 23:45:46 +03:00
committed by GitHub
parent 657f55b599
commit 7fab401ed2
13 changed files with 197 additions and 202 deletions
+1 -1
View File
@@ -197,5 +197,5 @@ All lua code should be done using all the best practices of proper lua using the
### JavaScript Styleguide ### JavaScript Styleguide
- Use 4 Space indentation - Use 2 Space indentation
- Don't repeat yourself.. if you're using the same operations in many different places convert them into a function with flexible variables. - Don't repeat yourself.. if you're using the same operations in many different places convert them into a function with flexible variables.
+8 -8
View File
@@ -36,7 +36,7 @@ RegisterNetEvent('QBCore:Command:GoToMarker', function()
local blipMarker <const> = GetFirstBlipInfoId(8) local blipMarker <const> = GetFirstBlipInfoId(8)
if not DoesBlipExist(blipMarker) then if not DoesBlipExist(blipMarker) then
QBCore.Functions.Notify('No Waypoint Set.', "error",5000) QBCore.Functions.Notify('No Waypoint Set.', "error", 5000)
return 'marker' return 'marker'
end end
@@ -107,12 +107,12 @@ RegisterNetEvent('QBCore:Command:GoToMarker', function()
-- If we can't find the coords, set the coords to the old ones. -- If we can't find the coords, set the coords to the old ones.
-- We don't unpack them before since they aren't in a loop and only called once. -- We don't unpack them before since they aren't in a loop and only called once.
SetPedCoordsKeepVehicle(ped, oldCoords['x'], oldCoords['y'], oldCoords['z'] - 1.0) SetPedCoordsKeepVehicle(ped, oldCoords['x'], oldCoords['y'], oldCoords['z'] - 1.0)
QBCore.Functions.Notify('Error While Teleporting.', "error",5000) QBCore.Functions.Notify('Error While Teleporting.', "error", 5000)
end end
-- If Z coord was found, set coords in found coords. -- If Z coord was found, set coords in found coords.
SetPedCoordsKeepVehicle(ped, x, y, groundZ) SetPedCoordsKeepVehicle(ped, x, y, groundZ)
QBCore.Functions.Notify('Teleported To Waypoint.', "success",5000) QBCore.Functions.Notify('Teleported To Waypoint.', "success", 5000)
end) end)
-- Vehicle Commands -- Vehicle Commands
@@ -196,16 +196,16 @@ end)
local function Draw3DText(coords, str) local function Draw3DText(coords, str)
local onScreen, worldX, worldY = World3dToScreen2d(coords.x, coords.y, coords.z) local onScreen, worldX, worldY = World3dToScreen2d(coords.x, coords.y, coords.z)
local camCoords = GetGameplayCamCoord() local camCoords = GetGameplayCamCoord()
local scale = 200 / (GetGameplayCamFov() * #(camCoords - coords)) local scale = 200 / (GetGameplayCamFov() * #(camCoords - coords))
if onScreen then if onScreen then
SetTextScale(1.0, 0.5 * scale) SetTextScale(1.0, 0.5 * scale)
SetTextFont(4) SetTextFont(4)
SetTextColour(255, 255, 255, 255) SetTextColour(255, 255, 255, 255)
SetTextEdge(2, 0, 0, 0, 150) SetTextEdge(2, 0, 0, 0, 150)
SetTextProportional(1) SetTextProportional(1)
SetTextOutline() SetTextOutline()
SetTextCentre(1) SetTextCentre(1)
BeginTextCommandDisplayText("STRING") BeginTextCommandDisplayText("STRING")
AddTextComponentSubstringPlayerName(str) AddTextComponentSubstringPlayerName(str)
EndTextCommandDisplayText(worldX, worldY) EndTextCommandDisplayText(worldX, worldY)
+3 -3
View File
@@ -6,8 +6,8 @@ QBConfig.UpdateInterval = 5 -- how often to update player data in minutes
QBConfig.StatusInterval = 5000 -- how often to check hunger/thirst status in milliseconds QBConfig.StatusInterval = 5000 -- how often to check hunger/thirst status in milliseconds
QBConfig.Money = {} QBConfig.Money = {}
QBConfig.Money.MoneyTypes = {['cash'] = 500, ['bank'] = 5000, ['crypto'] = 0} -- ['type'] = startamount - Add or remove money types for your server (for ex. ['blackmoney'] = 0), remember once added it will not be removed from the database! QBConfig.Money.MoneyTypes = { ['cash'] = 500, ['bank'] = 5000, ['crypto'] = 0 } -- ['type'] = startamount - Add or remove money types for your server (for ex. ['blackmoney'] = 0), remember once added it will not be removed from the database!
QBConfig.Money.DontAllowMinus = {'cash', 'crypto'} -- Money that is not allowed going in minus QBConfig.Money.DontAllowMinus = { 'cash', 'crypto' } -- Money that is not allowed going in minus
QBConfig.Money.PayCheckTimeOut = 10 -- The time in minutes that it will give the paycheck QBConfig.Money.PayCheckTimeOut = 10 -- The time in minutes that it will give the paycheck
QBConfig.Money.PayCheckSociety = false -- If true paycheck will come from the society account that the player is employed at, requires qb-management QBConfig.Money.PayCheckSociety = false -- If true paycheck will come from the society account that the player is employed at, requires qb-management
@@ -30,7 +30,7 @@ QBConfig.Server.WhitelistPermission = 'admin' -- Permission that's able to enter
QBConfig.Server.PVP = true -- Enable or disable pvp on the server (Ability to shoot other players) QBConfig.Server.PVP = true -- Enable or disable pvp on the server (Ability to shoot other players)
QBConfig.Server.Discord = "" -- Discord invite link QBConfig.Server.Discord = "" -- Discord invite link
QBConfig.Server.CheckDuplicateLicense = true -- Check for duplicate rockstar license on join QBConfig.Server.CheckDuplicateLicense = true -- Check for duplicate rockstar license on join
QBConfig.Server.Permissions = {'god', 'admin', 'mod'} -- Add as many groups as you want here after creating them in your server.cfg QBConfig.Server.Permissions = { 'god', 'admin', 'mod' } -- Add as many groups as you want here after creating them in your server.cfg
QBConfig.Notify = {} QBConfig.Notify = {}
+25 -25
View File
@@ -5,43 +5,43 @@ description 'QB-Core'
version '1.1.0' version '1.1.0'
shared_scripts { shared_scripts {
'config.lua', 'config.lua',
'shared/locale.lua', 'shared/locale.lua',
'locale/en.lua', -- replace with desired language 'locale/en.lua', -- replace with desired language
'shared/main.lua', 'shared/main.lua',
'shared/items.lua', 'shared/items.lua',
'shared/jobs.lua', 'shared/jobs.lua',
'shared/vehicles.lua', 'shared/vehicles.lua',
'shared/gangs.lua', 'shared/gangs.lua',
'shared/weapons.lua' 'shared/weapons.lua'
} }
client_scripts { client_scripts {
'client/main.lua', 'client/main.lua',
'client/functions.lua', 'client/functions.lua',
'client/loops.lua', 'client/loops.lua',
'client/events.lua', 'client/events.lua',
'client/drawtext.lua' 'client/drawtext.lua'
} }
server_scripts { server_scripts {
'@oxmysql/lib/MySQL.lua', '@oxmysql/lib/MySQL.lua',
'server/main.lua', 'server/main.lua',
'server/functions.lua', 'server/functions.lua',
'server/player.lua', 'server/player.lua',
'server/events.lua', 'server/events.lua',
'server/commands.lua', 'server/commands.lua',
'server/exports.lua', 'server/exports.lua',
'server/debug.lua' 'server/debug.lua'
} }
ui_page 'html/index.html' ui_page 'html/index.html'
files { files {
'html/index.html', 'html/index.html',
'html/css/style.css', 'html/css/style.css',
'html/css/drawtext.css', 'html/css/drawtext.css',
'html/js/*.js' 'html/js/*.js'
} }
dependency 'oxmysql' dependency 'oxmysql'
+8 -1
View File
@@ -1,4 +1,5 @@
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;500&display=swap"); @import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;500&display=swap");
:root { :root {
--primary-bg: rgba(23, 23, 23, 90%); --primary-bg: rgba(23, 23, 23, 90%);
--active-bg: #dc143c; --active-bg: #dc143c;
@@ -15,6 +16,7 @@
font-family: "Poppins", sans-serif !important; font-family: "Poppins", sans-serif !important;
font-weight: 300; font-weight: 300;
} }
.text { .text {
position: absolute; position: absolute;
background: var(--primary-bg); background: var(--primary-bg);
@@ -47,11 +49,13 @@
left: 45vw; left: 45vw;
top: -100px; top: -100px;
} }
.top.show { .top.show {
transition: 0.5s; transition: 0.5s;
top: 10px; top: 10px;
opacity: 1; opacity: 1;
} }
.top.hide { .top.hide {
transition: 0.5s; transition: 0.5s;
top: -100px; top: -100px;
@@ -62,11 +66,13 @@
top: 50%; top: 50%;
right: -100px; right: -100px;
} }
.right.show { .right.show {
transition: 0.5s; transition: 0.5s;
right: 10px; right: 10px;
opacity: 1; opacity: 1;
} }
.right.hide { .right.hide {
transition: 0.5s; transition: 0.5s;
right: -100px; right: -100px;
@@ -83,8 +89,9 @@
left: 10px; left: 10px;
opacity: 1; opacity: 1;
} }
.left.hide { .left.hide {
transition: 0.5s; transition: 0.5s;
left: -100px; left: -100px;
opacity: 0; opacity: 0;
} }
+6 -6
View File
@@ -10,7 +10,7 @@ html::-webkit-scrollbar {
border-left: 0.5rem solid #20bb44; border-left: 0.5rem solid #20bb44;
font-size: 1.5vh; font-size: 1.5vh;
} }
.primary { .primary {
background-color: rgba(23, 23, 23, 90%); background-color: rgba(23, 23, 23, 90%);
border-radius: 10px; border-radius: 10px;
@@ -18,7 +18,7 @@ html::-webkit-scrollbar {
border-left: 5px solid #1c75d2; border-left: 5px solid #1c75d2;
font-size: 1.5vh; font-size: 1.5vh;
} }
.error { .error {
background-color: rgba(23, 23, 23, 90%); background-color: rgba(23, 23, 23, 90%);
border-radius: 10px; border-radius: 10px;
@@ -26,7 +26,7 @@ html::-webkit-scrollbar {
border-left: 5px solid #c10114; border-left: 5px solid #c10114;
font-size: 1.5vh; font-size: 1.5vh;
} }
.police { .police {
background-color: rgba(23, 23, 23, 90%); background-color: rgba(23, 23, 23, 90%);
border-radius: 10px; border-radius: 10px;
@@ -34,7 +34,7 @@ html::-webkit-scrollbar {
border-left: 5px solid #2197f2; border-left: 5px solid #2197f2;
font-size: 1.5vh; font-size: 1.5vh;
} }
.ambulance { .ambulance {
background-color: rgba(23, 23, 23, 90%); background-color: rgba(23, 23, 23, 90%);
border-radius: 10px; border-radius: 10px;
@@ -42,7 +42,7 @@ html::-webkit-scrollbar {
border-left: 5px solid #f44236; border-left: 5px solid #f44236;
font-size: 1.5vh; font-size: 1.5vh;
} }
} }
.success { .success {
@@ -78,4 +78,4 @@ html::-webkit-scrollbar {
border-radius: 10px; border-radius: 10px;
box-shadow: 0rem 0rem 0.1rem 0.05rem #000000; box-shadow: 0rem 0rem 0.1rem 0.05rem #000000;
border-left: 5px solid #f44236; border-left: 5px solid #f44236;
} }
+9 -35
View File
@@ -1,46 +1,20 @@
<html> <html>
<head> <head>
<link <link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet" />
href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" <link href="https://cdn.jsdelivr.net/npm/quasar@2.1.0/dist/quasar.prod.css" rel="stylesheet" type="text/css" />
rel="stylesheet" <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" />
/> <link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900|Material+Icons" rel="stylesheet" type="text/css" />
<link <link href="css/style.css" rel="stylesheet" />
href="https://cdn.jsdelivr.net/npm/quasar@2.1.0/dist/quasar.prod.css" <script src="https://cdn.jsdelivr.net/npm/vue@3/dist/vue.global.prod.js" defer></script>
rel="stylesheet" <script src="https://cdn.jsdelivr.net/npm/quasar@2.1.0/dist/quasar.umd.prod.js" defer></script>
type="text/css"
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"
/>
<link
href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900|Material+Icons"
rel="stylesheet"
type="text/css"
/>
<link
href="css/style.css"
rel="stylesheet"
/>
<script
src="https://cdn.jsdelivr.net/npm/vue@3/dist/vue.global.prod.js"
defer
></script>
<script
src="https://cdn.jsdelivr.net/npm/quasar@2.1.0/dist/quasar.umd.prod.js"
defer
></script>
<script type="module" src="js/app.js"></script> <script type="module" src="js/app.js"></script>
<script src="js/drawtext.js"></script> <script src="js/drawtext.js"></script>
<link rel="stylesheet" href="css/drawtext.css"> <link rel="stylesheet" href="css/drawtext.css">
</head> </head>
<body style="font-family: 'Poppins', sans-serif"> <body style="font-family: 'Poppins', sans-serif">
<div <div id="q-app" style="min-height: 100vh"></div>
id="q-app"
style="min-height: 100vh"
></div>
<div id="drawtext-container"> <div id="drawtext-container">
<div id="text" class="text"></div> <div id="text" class="text"></div>
</div> </div>
</body> </body>
</html> </html>
+93 -93
View File
@@ -1,124 +1,124 @@
let direction = null; let direction = null;
const drawText = async (textData) => { const drawText = async (textData) => {
const text = document.getElementById("text"); const text = document.getElementById("text");
let {position} = textData; let {position} = textData;
switch (textData.position) { switch (textData.position) {
case "left": case "left":
addClass(text, position); addClass(text, position);
direction = "left"; direction = "left";
break; break;
case "top": case "top":
addClass(text, position); addClass(text, position);
direction = "top"; direction = "top";
break; break;
case "right": case "right":
addClass(text, position); addClass(text, position);
direction = "right"; direction = "right";
break; break;
default: default:
addClass(text, "left"); addClass(text, "left");
direction = "left"; direction = "left";
break; break;
} }
text.innerHTML = textData.text; text.innerHTML = textData.text;
document.getElementById("drawtext-container").style.display = "block"; document.getElementById("drawtext-container").style.display = "block";
await sleep(100); await sleep(100);
addClass(text, "show"); addClass(text, "show");
}; };
const changeText = async (textData) => { const changeText = async (textData) => {
const text = document.getElementById("text"); const text = document.getElementById("text");
let {position} = textData; let {position} = textData;
removeClass(text, "show"); removeClass(text, "show");
addClass(text, "pressed"); addClass(text, "pressed");
addClass(text, "hide"); addClass(text, "hide");
await sleep(500); await sleep(500);
removeClass(text, "left");
removeClass(text, "right");
removeClass(text, "top");
removeClass(text, "bottom");
removeClass(text, "hide");
removeClass(text, "pressed");
switch (textData.position) {
case "left":
addClass(text, position);
direction = "left";
break;
case "top":
addClass(text, position);
direction = "top";
break;
case "right":
addClass(text, position);
direction = "right";
break;
default:
addClass(text, "left");
direction = "left";
break;
}
text.innerHTML = textData.text;
await sleep(100);
text.classList.add("show");
};
const hideText = async () => {
const text = document.getElementById("text");
removeClass(text, "show");
addClass(text, "hide");
setTimeout(() => {
removeClass(text, "left"); removeClass(text, "left");
removeClass(text, "right"); removeClass(text, "right");
removeClass(text, "top"); removeClass(text, "top");
removeClass(text, "bottom"); removeClass(text, "bottom");
removeClass(text, "hide"); removeClass(text, "hide");
removeClass(text, "pressed"); removeClass(text, "pressed");
document.getElementById("drawtext-container").style.display = "none";
switch (textData.position) { }, 1000);
case "left":
addClass(text, position);
direction = "left";
break;
case "top":
addClass(text, position);
direction = "top";
break;
case "right":
addClass(text, position);
direction = "right";
break;
default:
addClass(text, "left");
direction = "left";
break;
}
text.innerHTML = textData.text;
await sleep(100);
text.classList.add("show");
};
const hideText = async () => {
const text = document.getElementById("text");
removeClass(text, "show");
addClass(text, "hide");
setTimeout(() => {
removeClass(text, "left");
removeClass(text, "right");
removeClass(text, "top");
removeClass(text, "bottom");
removeClass(text, "hide");
removeClass(text, "pressed");
document.getElementById("drawtext-container").style.display = "none";
}, 1000);
}; };
const keyPressed = () => { const keyPressed = () => {
const text = document.getElementById("text"); const text = document.getElementById("text");
addClass(text, "pressed"); addClass(text, "pressed");
}; };
window.addEventListener("message", (event) => { window.addEventListener("message", (event) => {
const data = event.data; const data = event.data;
const action = data.action; const action = data.action;
const textData = data.data; const textData = data.data;
switch (action) { switch (action) {
case "DRAW_TEXT": case "DRAW_TEXT":
return drawText(textData); return drawText(textData);
case "CHANGE_TEXT": case "CHANGE_TEXT":
return changeText(textData); return changeText(textData);
case "HIDE_TEXT": case "HIDE_TEXT":
return hideText(); return hideText();
case "KEY_PRESSED": case "KEY_PRESSED":
return keyPressed(); return keyPressed();
default: default:
return; return;
} }
}); });
const sleep = (ms) => { const sleep = (ms) => {
return new Promise((resolve) => setTimeout(resolve, ms)); return new Promise((resolve) => setTimeout(resolve, ms));
}; };
const removeClass = (element, name) => { const removeClass = (element, name) => {
if (element.classList.contains(name)) { if (element.classList.contains(name)) {
element.classList.remove(name); element.classList.remove(name);
} }
}; };
const addClass = (element, name) => { const addClass = (element, name) => {
if (!element.classList.contains(name)) { if (!element.classList.contains(name)) {
element.classList.add(name); element.classList.add(name);
} }
}; };
+2 -2
View File
@@ -37,9 +37,9 @@ function QBCore.Debug(tbl, indent)
end end
function QBCore.ShowError(resource, msg) function QBCore.ShowError(resource, msg)
print('\x1b[31m['..resource..':ERROR]\x1b[0m '..msg) print('\x1b[31m[' .. resource .. ':ERROR]\x1b[0m ' .. msg)
end end
function QBCore.ShowSuccess(resource, msg) function QBCore.ShowSuccess(resource, msg)
print('\x1b[32m['..resource..':LOG]\x1b[0m '..msg) print('\x1b[32m[' .. resource .. ':LOG]\x1b[0m ' .. msg)
end end
+14 -14
View File
@@ -216,31 +216,31 @@ QBCore.Functions.CreateCallback('QBCore:HasItem', function(source, cb, items, am
local Player = QBCore.Functions.GetPlayer(source) local Player = QBCore.Functions.GetPlayer(source)
if not Player then return cb(false) end if not Player then return cb(false) end
local isTable = type(items) == 'table' local isTable = type(items) == 'table'
local isArray = isTable and table.type(items) == 'array' or false local isArray = isTable and table.type(items) == 'array' or false
local totalItems = #items local totalItems = #items
local count = 0 local count = 0
local kvIndex = 2 local kvIndex = 2
if isTable and not isArray then if isTable and not isArray then
totalItems = 0 totalItems = 0
for _ in pairs(items) do totalItems += 1 end for _ in pairs(items) do totalItems += 1 end
kvIndex = 1 kvIndex = 1
end end
if isTable then if isTable then
for k, v in pairs(items) do for k, v in pairs(items) do
local itemKV = {k, v} local itemKV = {k, v}
local item = Player.Functions.GetItemByName(itemKV[kvIndex]) local item = Player.Functions.GetItemByName(itemKV[kvIndex])
if item and ((amount and item.amount >= amount) or (not amount and not isArray and item.amount >= v) or (not amount and isArray)) then if item and ((amount and item.amount >= amount) or (not amount and not isArray and item.amount >= v) or (not amount and isArray)) then
count += 1 count += 1
end end
end end
if count == totalItems then if count == totalItems then
retval = true retval = true
end end
else -- Single item as string else -- Single item as string
local item = Player.Functions.GetItemByName(items) local item = Player.Functions.GetItemByName(items)
if item and not amount or (item and amount and item.amount >= amount) then if item and not amount or (item and amount and item.amount >= amount) then
retval = true retval = true
end end
end end
cb(retval) cb(retval)
end) end)
+16 -2
View File
@@ -10,10 +10,11 @@ local function AddJob(jobName, job)
QBCore.Shared.Jobs[jobName] = job QBCore.Shared.Jobs[jobName] = job
TriggerClientEvent('QBCore:Client:OnSharedUpdate', -1,'Jobs', jobName, job) TriggerClientEvent('QBCore:Client:OnSharedUpdate', -1, 'Jobs', jobName, job)
TriggerEvent('QBCore:Server:UpdateObject') TriggerEvent('QBCore:Server:UpdateObject')
return true, "success" return true, "success"
end end
QBCore.Functions.AddJob = AddJob QBCore.Functions.AddJob = AddJob
exports('AddJob', AddJob) exports('AddJob', AddJob)
@@ -46,6 +47,7 @@ local function AddJobs(jobs)
TriggerEvent('QBCore:Server:UpdateObject') TriggerEvent('QBCore:Server:UpdateObject')
return true, message, nil return true, message, nil
end end
QBCore.Functions.AddJobs = AddJobs QBCore.Functions.AddJobs = AddJobs
exports('AddJobs', AddJobs) exports('AddJobs', AddJobs)
@@ -65,6 +67,7 @@ local function RemoveJob(jobName)
TriggerEvent('QBCore:Server:UpdateObject') TriggerEvent('QBCore:Server:UpdateObject')
return true, "success" return true, "success"
end end
QBCore.Functions.RemoveJob = RemoveJob QBCore.Functions.RemoveJob = RemoveJob
exports('RemoveJob', RemoveJob) exports('RemoveJob', RemoveJob)
@@ -84,6 +87,7 @@ local function UpdateJob(jobName, job)
TriggerEvent('QBCore:Server:UpdateObject') TriggerEvent('QBCore:Server:UpdateObject')
return true, "success" return true, "success"
end end
QBCore.Functions.UpdateJob = UpdateJob QBCore.Functions.UpdateJob = UpdateJob
exports('UpdateJob', UpdateJob) exports('UpdateJob', UpdateJob)
@@ -103,6 +107,7 @@ local function AddItem(itemName, item)
TriggerEvent('QBCore:Server:UpdateObject') TriggerEvent('QBCore:Server:UpdateObject')
return true, "success" return true, "success"
end end
QBCore.Functions.AddItem = AddItem QBCore.Functions.AddItem = AddItem
exports('AddItem', AddItem) exports('AddItem', AddItem)
@@ -119,6 +124,7 @@ local function UpdateItem(itemName, item)
TriggerEvent('QBCore:Server:UpdateObject') TriggerEvent('QBCore:Server:UpdateObject')
return true, "success" return true, "success"
end end
QBCore.Functions.UpdateItem = UpdateItem QBCore.Functions.UpdateItem = UpdateItem
exports('UpdateItem', UpdateItem) exports('UpdateItem', UpdateItem)
@@ -151,6 +157,7 @@ local function AddItems(items)
TriggerEvent('QBCore:Server:UpdateObject') TriggerEvent('QBCore:Server:UpdateObject')
return true, message, nil return true, message, nil
end end
QBCore.Functions.AddItems = AddItems QBCore.Functions.AddItems = AddItems
exports('AddItems', AddItems) exports('AddItems', AddItems)
@@ -170,6 +177,7 @@ local function RemoveItem(itemName)
TriggerEvent('QBCore:Server:UpdateObject') TriggerEvent('QBCore:Server:UpdateObject')
return true, "success" return true, "success"
end end
QBCore.Functions.RemoveItem = RemoveItem QBCore.Functions.RemoveItem = RemoveItem
exports('RemoveItem', RemoveItem) exports('RemoveItem', RemoveItem)
@@ -189,6 +197,7 @@ local function AddGang(gangName, gang)
TriggerEvent('QBCore:Server:UpdateObject') TriggerEvent('QBCore:Server:UpdateObject')
return true, "success" return true, "success"
end end
QBCore.Functions.AddGang = AddGang QBCore.Functions.AddGang = AddGang
exports('AddGang', AddGang) exports('AddGang', AddGang)
@@ -221,6 +230,7 @@ local function AddGangs(gangs)
TriggerEvent('QBCore:Server:UpdateObject') TriggerEvent('QBCore:Server:UpdateObject')
return true, message, nil return true, message, nil
end end
QBCore.Functions.AddGangs = AddGangs QBCore.Functions.AddGangs = AddGangs
exports('AddGangs', AddGangs) exports('AddGangs', AddGangs)
@@ -240,6 +250,7 @@ local function RemoveGang(gangName)
TriggerEvent('QBCore:Server:UpdateObject') TriggerEvent('QBCore:Server:UpdateObject')
return true, "success" return true, "success"
end end
QBCore.Functions.RemoveGang = RemoveGang QBCore.Functions.RemoveGang = RemoveGang
exports('RemoveGang', RemoveGang) exports('RemoveGang', RemoveGang)
@@ -259,6 +270,7 @@ local function UpdateGang(gangName, gang)
TriggerEvent('QBCore:Server:UpdateObject') TriggerEvent('QBCore:Server:UpdateObject')
return true, "success" return true, "success"
end end
QBCore.Functions.UpdateGang = UpdateGang QBCore.Functions.UpdateGang = UpdateGang
exports('UpdateGang', UpdateGang) exports('UpdateGang', UpdateGang)
@@ -269,6 +281,7 @@ local function GetCoreVersion(InvokingResource)
end end
return resourceVersion return resourceVersion
end end
QBCore.Functions.GetCoreVersion = GetCoreVersion QBCore.Functions.GetCoreVersion = GetCoreVersion
exports('GetCoreVersion', GetCoreVersion) exports('GetCoreVersion', GetCoreVersion)
@@ -284,6 +297,7 @@ local function ExploitBan(playerId, origin)
'Anti Cheat' 'Anti Cheat'
}) })
DropPlayer(playerId, "You have been banned for cheating. Check our Discord for more information: " .. QBCore.Config.Server.Discord) DropPlayer(playerId, "You have been banned for cheating. Check our Discord for more information: " .. QBCore.Config.Server.Discord)
TriggerEvent("qb-log:server:CreateLog", "anticheat", "Anti-Cheat", "red", name.." has been banned for exploiting "..origin, true) TriggerEvent("qb-log:server:CreateLog", "anticheat", "Anti-Cheat", "red", name .. " has been banned for exploiting " .. origin, true)
end end
exports('ExploitBan', ExploitBan) exports('ExploitBan', ExploitBan)
+3 -3
View File
@@ -374,11 +374,11 @@ function QBCore.Functions.HasItem(source, items, amount)
local Player = QBCore.Functions.GetPlayer(source) local Player = QBCore.Functions.GetPlayer(source)
if not Player then return false end if not Player then return false end
local isTable = type(items) == 'table' local isTable = type(items) == 'table'
local isArray = isTable and table.type(items) == 'array' or false local isArray = isTable and table.type(items) == 'array' or false
local totalItems = #items local totalItems = #items
local count = 0 local count = 0
local kvIndex = 2 local kvIndex = 2
if isTable and not isArray then if isTable and not isArray then
totalItems = 0 totalItems = 0
for _ in pairs(items) do totalItems += 1 end for _ in pairs(items) do totalItems += 1 end
kvIndex = 1 kvIndex = 1
+9 -9
View File
@@ -600,19 +600,19 @@ function QBCore.Player.DeleteCharacter(source, citizenid)
local result = MySQL.scalar.await('SELECT license FROM players where citizenid = ?', { citizenid }) local result = MySQL.scalar.await('SELECT license FROM players where citizenid = ?', { citizenid })
if license == result then if license == result then
local query = "DELETE FROM %s WHERE citizenid = ?" local query = "DELETE FROM %s WHERE citizenid = ?"
local tableCount = #playertables local tableCount = #playertables
local queries = table.create(tableCount, 0) local queries = table.create(tableCount, 0)
for i = 1, tableCount do for i = 1, tableCount do
local v = playertables[i] local v = playertables[i]
queries[i] = {query = query:format(v.table), values = { citizenid }} queries[i] = {query = query:format(v.table), values = { citizenid }}
end end
MySQL.transaction(queries, function(result2) MySQL.transaction(queries, function(result2)
if result2 then if result2 then
TriggerEvent('qb-log:server:CreateLog', 'joinleave', 'Character Deleted', 'red', '**' .. GetPlayerName(source) .. '** ' .. license .. ' deleted **' .. citizenid .. '**..') TriggerEvent('qb-log:server:CreateLog', 'joinleave', 'Character Deleted', 'red', '**' .. GetPlayerName(source) .. '** ' .. license .. ' deleted **' .. citizenid .. '**..')
end end
end) end)
else else
DropPlayer(source, 'You Have Been Kicked For Exploitation') DropPlayer(source, 'You Have Been Kicked For Exploitation')
TriggerEvent('qb-log:server:CreateLog', 'anticheat', 'Anti-Cheat', 'white', GetPlayerName(source) .. ' Has Been Dropped For Character Deletion Exploit', true) TriggerEvent('qb-log:server:CreateLog', 'anticheat', 'Anti-Cheat', 'white', GetPlayerName(source) .. ' Has Been Dropped For Character Deletion Exploit', true)