From 9692fc88505c9fc16a89abd4e2d936896eface98 Mon Sep 17 00:00:00 2001 From: Ricardo Madureira <73558483+NamelessN3K0@users.noreply.github.com> Date: Wed, 25 Oct 2023 23:21:20 +0100 Subject: [PATCH 1/4] Added ability for owner to remove container with config --- client/targets/oxtarget.lua | 2 +- client/targets/qbtarget.lua | 2 +- client/targets/qtarget.lua | 2 +- config.lua | 2 ++ server/server.lua | 7 +++++-- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/client/targets/oxtarget.lua b/client/targets/oxtarget.lua index 36e0574..4168ace 100644 --- a/client/targets/oxtarget.lua +++ b/client/targets/oxtarget.lua @@ -22,7 +22,7 @@ function Ox_target( private, entity ) icon = "fas fa-trash", distance = 1.0, label = "Delete Container", - canInteract = function() return SuperUser() end, + --canInteract = function() return SuperUser() end, onSelect = function() DeleteContainer(private, entity) end }, { diff --git a/client/targets/qbtarget.lua b/client/targets/qbtarget.lua index 3111f63..fd33717 100644 --- a/client/targets/qbtarget.lua +++ b/client/targets/qbtarget.lua @@ -19,7 +19,7 @@ function Qb_target( private, entity ) { icon = "fas fa-box", label = "Delete Container", - canInteract = function() return SuperUser() end, + --canInteract = function() return SuperUser() end, action = function() DeleteContainer(private, entity) end }, { diff --git a/client/targets/qtarget.lua b/client/targets/qtarget.lua index 93f4e7a..c79f8d3 100644 --- a/client/targets/qtarget.lua +++ b/client/targets/qtarget.lua @@ -19,7 +19,7 @@ function Qtarget( private, entity ) { icon = "fas fa-trash", label = "Delete Container", - canInteract = function() return SuperUser() end, + --canInteract = function() return SuperUser() end, action = function() DeleteContainer(private, entity) end }, { diff --git a/config.lua b/config.lua index d65f655..471b816 100644 --- a/config.lua +++ b/config.lua @@ -16,6 +16,8 @@ Config.FrameWork = "qb" -- qb/esx Config.input = "qb-input" -- keep-input / qb-input / ox_lib (ESX) Config.esx_target = "ox_target" -- ox_target / qtarget (ONLY ESX won't effect qbcore) +Config.CanOwnerRemove = false -- Can the owner of the container remove it? (If False only admins can remove containers) + Config.container_depots = { -- when adding new zone make sure it has enough minZ and maxZ or might get into issue with placing system ["LT_WELD_SUPPLY"] = { diff --git a/server/server.lua b/server/server.lua index fa804c7..f3cf75d 100644 --- a/server/server.lua +++ b/server/server.lua @@ -344,10 +344,13 @@ RegisterNetEvent("keep-containers:server:container:delete", function( random_id, local src = source local player = Player(src) local citizenid = GetCitizenId(player) - - if not is_super_user(citizenid) then + local citizenidCheck = MySQL.scalar.await('SELECT `owner_citizenid` FROM `keep_containers` WHERE `random_id` = ? LIMIT 1', {random_id}) -- grabs associated owner id + if not Config.CanOwnerRemove and not is_super_user(citizenid) then --if owners cant remove and player not super user exit Notification_S(src, "Hmm, you can't do that!", "primary") return + elseif Config.CanOwnerRemove and citizenidCheck ~= citizenid then --if owners can remove and player not owner exit + Notification_S(src, "Hmm, you don't own this!", "primary") + return end MySQL.Async.execute("UPDATE keep_containers SET deleted = ?, deleted_by = ? WHERE random_id = ? AND zone = ?", { From b43da80ece15b1b4b8526640621fce5fe196e3ca Mon Sep 17 00:00:00 2001 From: Ricardo Madureira <73558483+NamelessN3K0@users.noreply.github.com> Date: Wed, 25 Oct 2023 23:22:57 +0100 Subject: [PATCH 2/4] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 4ab0c45..8424e76 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ OR - Dynamic object loading - Little bit of admin control (WIP) - Container placer! (i don't know what to call it!) +- Ability for the owner to remove the container (Config) ## Preview From e62d01c8e5e4a32e413b52916771333796f62351 Mon Sep 17 00:00:00 2001 From: Ricardo Madureira <73558483+NamelessN3K0@users.noreply.github.com> Date: Wed, 25 Oct 2023 23:33:08 +0100 Subject: [PATCH 3/4] Ssuply typo fix --- config.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.lua b/config.lua index 471b816..3777192 100644 --- a/config.lua +++ b/config.lua @@ -21,7 +21,7 @@ Config.CanOwnerRemove = false -- Can the owner of the container remove it? (If F Config.container_depots = { -- when adding new zone make sure it has enough minZ and maxZ or might get into issue with placing system ["LT_WELD_SUPPLY"] = { - name = "LT Weld Ssupply", + name = "LT Weld Supply", positions = { vector2(1219.7977294922, -1369.8439941406), vector2(1177.3232421875, -1366.3834228516), From d8d5232b352346bd6970623d1a8e01fe843009c2 Mon Sep 17 00:00:00 2001 From: Ricardo Madureira <73558483+NamelessN3K0@users.noreply.github.com> Date: Thu, 26 Oct 2023 00:03:55 +0100 Subject: [PATCH 4/4] Added config to enable and disable blips --- client/client.lua | 2 +- config.lua | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/client/client.lua b/client/client.lua index 2dea3ce..d0ede12 100644 --- a/client/client.lua +++ b/client/client.lua @@ -140,7 +140,7 @@ local function Init() if loaded then return end loaded = true for k, v in pairs(Config.container_depots) do - CreateBlip(v.blip) + if Config.EnableBlips then CreateBlip(v.blip) end --create blip if enabled ZONE[k] = PolyZone:Create(v.positions, { name = "c_depot " .. k, minZ = v.minz, diff --git a/config.lua b/config.lua index 3777192..c9c1a0c 100644 --- a/config.lua +++ b/config.lua @@ -17,6 +17,7 @@ Config.input = "qb-input" -- keep-input / qb-input / ox_lib (ESX) Config.esx_target = "ox_target" -- ox_target / qtarget (ONLY ESX won't effect qbcore) Config.CanOwnerRemove = false -- Can the owner of the container remove it? (If False only admins can remove containers) +Config.EnableBlips = true -- enable / diable blips on the map Config.container_depots = { -- when adding new zone make sure it has enough minZ and maxZ or might get into issue with placing system