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 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/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..c9c1a0c 100644 --- a/config.lua +++ b/config.lua @@ -16,10 +16,13 @@ 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.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 ["LT_WELD_SUPPLY"] = { - name = "LT Weld Ssupply", + name = "LT Weld Supply", positions = { vector2(1219.7977294922, -1369.8439941406), vector2(1177.3232421875, -1366.3834228516), 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 = ?", {