Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

New features with config #11

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion client/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion client/targets/oxtarget.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
{
Expand Down
2 changes: 1 addition & 1 deletion client/targets/qbtarget.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
{
Expand Down
2 changes: 1 addition & 1 deletion client/targets/qtarget.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
{
Expand Down
5 changes: 4 additions & 1 deletion config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
7 changes: 5 additions & 2 deletions server/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ?", {
Expand Down