mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-08-29 01:01:24 +00:00
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:
@@ -197,5 +197,5 @@ All lua code should be done using all the best practices of proper lua using the
|
||||
|
||||
### 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.
|
||||
|
||||
+8
-8
@@ -36,7 +36,7 @@ RegisterNetEvent('QBCore:Command:GoToMarker', function()
|
||||
|
||||
local blipMarker <const> = GetFirstBlipInfoId(8)
|
||||
if not DoesBlipExist(blipMarker) then
|
||||
QBCore.Functions.Notify('No Waypoint Set.', "error",5000)
|
||||
QBCore.Functions.Notify('No Waypoint Set.', "error", 5000)
|
||||
return 'marker'
|
||||
end
|
||||
|
||||
@@ -107,12 +107,12 @@ RegisterNetEvent('QBCore:Command:GoToMarker', function()
|
||||
-- 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.
|
||||
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
|
||||
|
||||
-- If Z coord was found, set coords in found coords.
|
||||
SetPedCoordsKeepVehicle(ped, x, y, groundZ)
|
||||
QBCore.Functions.Notify('Teleported To Waypoint.', "success",5000)
|
||||
QBCore.Functions.Notify('Teleported To Waypoint.', "success", 5000)
|
||||
end)
|
||||
|
||||
-- Vehicle Commands
|
||||
@@ -196,16 +196,16 @@ end)
|
||||
|
||||
local function Draw3DText(coords, str)
|
||||
local onScreen, worldX, worldY = World3dToScreen2d(coords.x, coords.y, coords.z)
|
||||
local camCoords = GetGameplayCamCoord()
|
||||
local scale = 200 / (GetGameplayCamFov() * #(camCoords - coords))
|
||||
local camCoords = GetGameplayCamCoord()
|
||||
local scale = 200 / (GetGameplayCamFov() * #(camCoords - coords))
|
||||
if onScreen then
|
||||
SetTextScale(1.0, 0.5 * scale)
|
||||
SetTextFont(4)
|
||||
SetTextColour(255, 255, 255, 255)
|
||||
SetTextEdge(2, 0, 0, 0, 150)
|
||||
SetTextProportional(1)
|
||||
SetTextOutline()
|
||||
SetTextCentre(1)
|
||||
SetTextProportional(1)
|
||||
SetTextOutline()
|
||||
SetTextCentre(1)
|
||||
BeginTextCommandDisplayText("STRING")
|
||||
AddTextComponentSubstringPlayerName(str)
|
||||
EndTextCommandDisplayText(worldX, worldY)
|
||||
|
||||
+3
-3
@@ -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.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.DontAllowMinus = {'cash', 'crypto'} -- Money that is not allowed going in minus
|
||||
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.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
|
||||
|
||||
@@ -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.Discord = "" -- Discord invite link
|
||||
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 = {}
|
||||
|
||||
|
||||
+25
-25
@@ -5,43 +5,43 @@ description 'QB-Core'
|
||||
version '1.1.0'
|
||||
|
||||
shared_scripts {
|
||||
'config.lua',
|
||||
'config.lua',
|
||||
'shared/locale.lua',
|
||||
'locale/en.lua', -- replace with desired language
|
||||
'shared/main.lua',
|
||||
'shared/items.lua',
|
||||
'shared/jobs.lua',
|
||||
'shared/vehicles.lua',
|
||||
'shared/gangs.lua',
|
||||
'shared/weapons.lua'
|
||||
'locale/en.lua', -- replace with desired language
|
||||
'shared/main.lua',
|
||||
'shared/items.lua',
|
||||
'shared/jobs.lua',
|
||||
'shared/vehicles.lua',
|
||||
'shared/gangs.lua',
|
||||
'shared/weapons.lua'
|
||||
}
|
||||
|
||||
client_scripts {
|
||||
'client/main.lua',
|
||||
'client/functions.lua',
|
||||
'client/loops.lua',
|
||||
'client/events.lua',
|
||||
'client/drawtext.lua'
|
||||
'client/main.lua',
|
||||
'client/functions.lua',
|
||||
'client/loops.lua',
|
||||
'client/events.lua',
|
||||
'client/drawtext.lua'
|
||||
}
|
||||
|
||||
server_scripts {
|
||||
'@oxmysql/lib/MySQL.lua',
|
||||
'server/main.lua',
|
||||
'server/functions.lua',
|
||||
'server/player.lua',
|
||||
'server/events.lua',
|
||||
'server/commands.lua',
|
||||
'server/exports.lua',
|
||||
'server/debug.lua'
|
||||
'@oxmysql/lib/MySQL.lua',
|
||||
'server/main.lua',
|
||||
'server/functions.lua',
|
||||
'server/player.lua',
|
||||
'server/events.lua',
|
||||
'server/commands.lua',
|
||||
'server/exports.lua',
|
||||
'server/debug.lua'
|
||||
}
|
||||
|
||||
ui_page 'html/index.html'
|
||||
|
||||
files {
|
||||
'html/index.html',
|
||||
'html/css/style.css',
|
||||
'html/css/drawtext.css',
|
||||
'html/js/*.js'
|
||||
'html/index.html',
|
||||
'html/css/style.css',
|
||||
'html/css/drawtext.css',
|
||||
'html/js/*.js'
|
||||
}
|
||||
|
||||
dependency 'oxmysql'
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;500&display=swap");
|
||||
|
||||
:root {
|
||||
--primary-bg: rgba(23, 23, 23, 90%);
|
||||
--active-bg: #dc143c;
|
||||
@@ -15,6 +16,7 @@
|
||||
font-family: "Poppins", sans-serif !important;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.text {
|
||||
position: absolute;
|
||||
background: var(--primary-bg);
|
||||
@@ -47,11 +49,13 @@
|
||||
left: 45vw;
|
||||
top: -100px;
|
||||
}
|
||||
|
||||
.top.show {
|
||||
transition: 0.5s;
|
||||
top: 10px;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.top.hide {
|
||||
transition: 0.5s;
|
||||
top: -100px;
|
||||
@@ -62,11 +66,13 @@
|
||||
top: 50%;
|
||||
right: -100px;
|
||||
}
|
||||
|
||||
.right.show {
|
||||
transition: 0.5s;
|
||||
right: 10px;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.right.hide {
|
||||
transition: 0.5s;
|
||||
right: -100px;
|
||||
@@ -83,8 +89,9 @@
|
||||
left: 10px;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.left.hide {
|
||||
transition: 0.5s;
|
||||
left: -100px;
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -10,7 +10,7 @@ html::-webkit-scrollbar {
|
||||
border-left: 0.5rem solid #20bb44;
|
||||
font-size: 1.5vh;
|
||||
}
|
||||
|
||||
|
||||
.primary {
|
||||
background-color: rgba(23, 23, 23, 90%);
|
||||
border-radius: 10px;
|
||||
@@ -18,7 +18,7 @@ html::-webkit-scrollbar {
|
||||
border-left: 5px solid #1c75d2;
|
||||
font-size: 1.5vh;
|
||||
}
|
||||
|
||||
|
||||
.error {
|
||||
background-color: rgba(23, 23, 23, 90%);
|
||||
border-radius: 10px;
|
||||
@@ -26,7 +26,7 @@ html::-webkit-scrollbar {
|
||||
border-left: 5px solid #c10114;
|
||||
font-size: 1.5vh;
|
||||
}
|
||||
|
||||
|
||||
.police {
|
||||
background-color: rgba(23, 23, 23, 90%);
|
||||
border-radius: 10px;
|
||||
@@ -34,7 +34,7 @@ html::-webkit-scrollbar {
|
||||
border-left: 5px solid #2197f2;
|
||||
font-size: 1.5vh;
|
||||
}
|
||||
|
||||
|
||||
.ambulance {
|
||||
background-color: rgba(23, 23, 23, 90%);
|
||||
border-radius: 10px;
|
||||
@@ -42,7 +42,7 @@ html::-webkit-scrollbar {
|
||||
border-left: 5px solid #f44236;
|
||||
font-size: 1.5vh;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
.success {
|
||||
@@ -78,4 +78,4 @@ html::-webkit-scrollbar {
|
||||
border-radius: 10px;
|
||||
box-shadow: 0rem 0rem 0.1rem 0.05rem #000000;
|
||||
border-left: 5px solid #f44236;
|
||||
}
|
||||
}
|
||||
+9
-35
@@ -1,46 +1,20 @@
|
||||
<html>
|
||||
<head>
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Poppins&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
<link
|
||||
href="https://cdn.jsdelivr.net/npm/quasar@2.1.0/dist/quasar.prod.css"
|
||||
rel="stylesheet"
|
||||
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>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet" />
|
||||
<link href="https://cdn.jsdelivr.net/npm/quasar@2.1.0/dist/quasar.prod.css" rel="stylesheet" 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 src="js/drawtext.js"></script>
|
||||
<link rel="stylesheet" href="css/drawtext.css">
|
||||
</head>
|
||||
<body style="font-family: 'Poppins', sans-serif">
|
||||
<div
|
||||
id="q-app"
|
||||
style="min-height: 100vh"
|
||||
></div>
|
||||
<div id="q-app" style="min-height: 100vh"></div>
|
||||
<div id="drawtext-container">
|
||||
<div id="text" class="text"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
+93
-93
@@ -1,124 +1,124 @@
|
||||
let direction = null;
|
||||
|
||||
const drawText = async (textData) => {
|
||||
const text = document.getElementById("text");
|
||||
let {position} = textData;
|
||||
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;
|
||||
}
|
||||
const text = document.getElementById("text");
|
||||
let {position} = textData;
|
||||
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;
|
||||
document.getElementById("drawtext-container").style.display = "block";
|
||||
await sleep(100);
|
||||
addClass(text, "show");
|
||||
text.innerHTML = textData.text;
|
||||
document.getElementById("drawtext-container").style.display = "block";
|
||||
await sleep(100);
|
||||
addClass(text, "show");
|
||||
};
|
||||
|
||||
const changeText = async (textData) => {
|
||||
const text = document.getElementById("text");
|
||||
let {position} = textData;
|
||||
const text = document.getElementById("text");
|
||||
let {position} = textData;
|
||||
|
||||
removeClass(text, "show");
|
||||
addClass(text, "pressed");
|
||||
addClass(text, "hide");
|
||||
removeClass(text, "show");
|
||||
addClass(text, "pressed");
|
||||
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, "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, "right");
|
||||
removeClass(text, "top");
|
||||
removeClass(text, "bottom");
|
||||
removeClass(text, "hide");
|
||||
removeClass(text, "pressed");
|
||||
document.getElementById("drawtext-container").style.display = "none";
|
||||
}, 1000);
|
||||
document.getElementById("drawtext-container").style.display = "none";
|
||||
}, 1000);
|
||||
};
|
||||
|
||||
const keyPressed = () => {
|
||||
const text = document.getElementById("text");
|
||||
addClass(text, "pressed");
|
||||
const text = document.getElementById("text");
|
||||
addClass(text, "pressed");
|
||||
};
|
||||
|
||||
window.addEventListener("message", (event) => {
|
||||
const data = event.data;
|
||||
const action = data.action;
|
||||
const textData = data.data;
|
||||
switch (action) {
|
||||
case "DRAW_TEXT":
|
||||
return drawText(textData);
|
||||
case "CHANGE_TEXT":
|
||||
return changeText(textData);
|
||||
case "HIDE_TEXT":
|
||||
return hideText();
|
||||
case "KEY_PRESSED":
|
||||
return keyPressed();
|
||||
default:
|
||||
return;
|
||||
}
|
||||
const data = event.data;
|
||||
const action = data.action;
|
||||
const textData = data.data;
|
||||
switch (action) {
|
||||
case "DRAW_TEXT":
|
||||
return drawText(textData);
|
||||
case "CHANGE_TEXT":
|
||||
return changeText(textData);
|
||||
case "HIDE_TEXT":
|
||||
return hideText();
|
||||
case "KEY_PRESSED":
|
||||
return keyPressed();
|
||||
default:
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
const sleep = (ms) => {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
};
|
||||
|
||||
const removeClass = (element, name) => {
|
||||
if (element.classList.contains(name)) {
|
||||
element.classList.remove(name);
|
||||
}
|
||||
if (element.classList.contains(name)) {
|
||||
element.classList.remove(name);
|
||||
}
|
||||
};
|
||||
|
||||
const addClass = (element, name) => {
|
||||
if (!element.classList.contains(name)) {
|
||||
element.classList.add(name);
|
||||
}
|
||||
if (!element.classList.contains(name)) {
|
||||
element.classList.add(name);
|
||||
}
|
||||
};
|
||||
|
||||
+2
-2
@@ -37,9 +37,9 @@ function QBCore.Debug(tbl, indent)
|
||||
end
|
||||
|
||||
function QBCore.ShowError(resource, msg)
|
||||
print('\x1b[31m['..resource..':ERROR]\x1b[0m '..msg)
|
||||
print('\x1b[31m[' .. resource .. ':ERROR]\x1b[0m ' .. msg)
|
||||
end
|
||||
|
||||
function QBCore.ShowSuccess(resource, msg)
|
||||
print('\x1b[32m['..resource..':LOG]\x1b[0m '..msg)
|
||||
print('\x1b[32m[' .. resource .. ':LOG]\x1b[0m ' .. msg)
|
||||
end
|
||||
|
||||
+14
-14
@@ -216,31 +216,31 @@ QBCore.Functions.CreateCallback('QBCore:HasItem', function(source, cb, items, am
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
if not Player then return cb(false) end
|
||||
local isTable = type(items) == 'table'
|
||||
local isArray = isTable and table.type(items) == 'array' or false
|
||||
local totalItems = #items
|
||||
local count = 0
|
||||
local isArray = isTable and table.type(items) == 'array' or false
|
||||
local totalItems = #items
|
||||
local count = 0
|
||||
local kvIndex = 2
|
||||
if isTable and not isArray then
|
||||
if isTable and not isArray then
|
||||
totalItems = 0
|
||||
for _ in pairs(items) do totalItems += 1 end
|
||||
kvIndex = 1
|
||||
end
|
||||
if isTable then
|
||||
for k, v in pairs(items) do
|
||||
local itemKV = {k, v}
|
||||
local item = Player.Functions.GetItemByName(itemKV[kvIndex])
|
||||
for k, v in pairs(items) do
|
||||
local itemKV = {k, v}
|
||||
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
|
||||
count += 1
|
||||
end
|
||||
end
|
||||
if count == totalItems then
|
||||
retval = true
|
||||
end
|
||||
else -- Single item as string
|
||||
local item = Player.Functions.GetItemByName(items)
|
||||
end
|
||||
if count == totalItems then
|
||||
retval = true
|
||||
end
|
||||
else -- Single item as string
|
||||
local item = Player.Functions.GetItemByName(items)
|
||||
if item and not amount or (item and amount and item.amount >= amount) then
|
||||
retval = true
|
||||
end
|
||||
end
|
||||
end
|
||||
cb(retval)
|
||||
end)
|
||||
|
||||
+16
-2
@@ -10,10 +10,11 @@ local function AddJob(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')
|
||||
return true, "success"
|
||||
end
|
||||
|
||||
QBCore.Functions.AddJob = AddJob
|
||||
exports('AddJob', AddJob)
|
||||
|
||||
@@ -46,6 +47,7 @@ local function AddJobs(jobs)
|
||||
TriggerEvent('QBCore:Server:UpdateObject')
|
||||
return true, message, nil
|
||||
end
|
||||
|
||||
QBCore.Functions.AddJobs = AddJobs
|
||||
exports('AddJobs', AddJobs)
|
||||
|
||||
@@ -65,6 +67,7 @@ local function RemoveJob(jobName)
|
||||
TriggerEvent('QBCore:Server:UpdateObject')
|
||||
return true, "success"
|
||||
end
|
||||
|
||||
QBCore.Functions.RemoveJob = RemoveJob
|
||||
exports('RemoveJob', RemoveJob)
|
||||
|
||||
@@ -84,6 +87,7 @@ local function UpdateJob(jobName, job)
|
||||
TriggerEvent('QBCore:Server:UpdateObject')
|
||||
return true, "success"
|
||||
end
|
||||
|
||||
QBCore.Functions.UpdateJob = UpdateJob
|
||||
exports('UpdateJob', UpdateJob)
|
||||
|
||||
@@ -103,6 +107,7 @@ local function AddItem(itemName, item)
|
||||
TriggerEvent('QBCore:Server:UpdateObject')
|
||||
return true, "success"
|
||||
end
|
||||
|
||||
QBCore.Functions.AddItem = AddItem
|
||||
exports('AddItem', AddItem)
|
||||
|
||||
@@ -119,6 +124,7 @@ local function UpdateItem(itemName, item)
|
||||
TriggerEvent('QBCore:Server:UpdateObject')
|
||||
return true, "success"
|
||||
end
|
||||
|
||||
QBCore.Functions.UpdateItem = UpdateItem
|
||||
exports('UpdateItem', UpdateItem)
|
||||
|
||||
@@ -151,6 +157,7 @@ local function AddItems(items)
|
||||
TriggerEvent('QBCore:Server:UpdateObject')
|
||||
return true, message, nil
|
||||
end
|
||||
|
||||
QBCore.Functions.AddItems = AddItems
|
||||
exports('AddItems', AddItems)
|
||||
|
||||
@@ -170,6 +177,7 @@ local function RemoveItem(itemName)
|
||||
TriggerEvent('QBCore:Server:UpdateObject')
|
||||
return true, "success"
|
||||
end
|
||||
|
||||
QBCore.Functions.RemoveItem = RemoveItem
|
||||
exports('RemoveItem', RemoveItem)
|
||||
|
||||
@@ -189,6 +197,7 @@ local function AddGang(gangName, gang)
|
||||
TriggerEvent('QBCore:Server:UpdateObject')
|
||||
return true, "success"
|
||||
end
|
||||
|
||||
QBCore.Functions.AddGang = AddGang
|
||||
exports('AddGang', AddGang)
|
||||
|
||||
@@ -221,6 +230,7 @@ local function AddGangs(gangs)
|
||||
TriggerEvent('QBCore:Server:UpdateObject')
|
||||
return true, message, nil
|
||||
end
|
||||
|
||||
QBCore.Functions.AddGangs = AddGangs
|
||||
exports('AddGangs', AddGangs)
|
||||
|
||||
@@ -240,6 +250,7 @@ local function RemoveGang(gangName)
|
||||
TriggerEvent('QBCore:Server:UpdateObject')
|
||||
return true, "success"
|
||||
end
|
||||
|
||||
QBCore.Functions.RemoveGang = RemoveGang
|
||||
exports('RemoveGang', RemoveGang)
|
||||
|
||||
@@ -259,6 +270,7 @@ local function UpdateGang(gangName, gang)
|
||||
TriggerEvent('QBCore:Server:UpdateObject')
|
||||
return true, "success"
|
||||
end
|
||||
|
||||
QBCore.Functions.UpdateGang = UpdateGang
|
||||
exports('UpdateGang', UpdateGang)
|
||||
|
||||
@@ -269,6 +281,7 @@ local function GetCoreVersion(InvokingResource)
|
||||
end
|
||||
return resourceVersion
|
||||
end
|
||||
|
||||
QBCore.Functions.GetCoreVersion = GetCoreVersion
|
||||
exports('GetCoreVersion', GetCoreVersion)
|
||||
|
||||
@@ -284,6 +297,7 @@ local function ExploitBan(playerId, origin)
|
||||
'Anti Cheat'
|
||||
})
|
||||
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
|
||||
|
||||
exports('ExploitBan', ExploitBan)
|
||||
|
||||
@@ -374,11 +374,11 @@ function QBCore.Functions.HasItem(source, items, amount)
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
if not Player then return false end
|
||||
local isTable = type(items) == 'table'
|
||||
local isArray = isTable and table.type(items) == 'array' or false
|
||||
local totalItems = #items
|
||||
local isArray = isTable and table.type(items) == 'array' or false
|
||||
local totalItems = #items
|
||||
local count = 0
|
||||
local kvIndex = 2
|
||||
if isTable and not isArray then
|
||||
if isTable and not isArray then
|
||||
totalItems = 0
|
||||
for _ in pairs(items) do totalItems += 1 end
|
||||
kvIndex = 1
|
||||
|
||||
+9
-9
@@ -600,19 +600,19 @@ function QBCore.Player.DeleteCharacter(source, citizenid)
|
||||
local result = MySQL.scalar.await('SELECT license FROM players where citizenid = ?', { citizenid })
|
||||
if license == result then
|
||||
local query = "DELETE FROM %s WHERE citizenid = ?"
|
||||
local tableCount = #playertables
|
||||
local queries = table.create(tableCount, 0)
|
||||
local tableCount = #playertables
|
||||
local queries = table.create(tableCount, 0)
|
||||
|
||||
for i = 1, tableCount do
|
||||
local v = playertables[i]
|
||||
queries[i] = {query = query:format(v.table), values = { citizenid }}
|
||||
end
|
||||
for i = 1, tableCount do
|
||||
local v = playertables[i]
|
||||
queries[i] = {query = query:format(v.table), values = { citizenid }}
|
||||
end
|
||||
|
||||
MySQL.transaction(queries, function(result2)
|
||||
if result2 then
|
||||
TriggerEvent('qb-log:server:CreateLog', 'joinleave', 'Character Deleted', 'red', '**' .. GetPlayerName(source) .. '** ' .. license .. ' deleted **' .. citizenid .. '**..')
|
||||
if result2 then
|
||||
TriggerEvent('qb-log:server:CreateLog', 'joinleave', 'Character Deleted', 'red', '**' .. GetPlayerName(source) .. '** ' .. license .. ' deleted **' .. citizenid .. '**..')
|
||||
end
|
||||
end)
|
||||
end)
|
||||
else
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user