1
0
Fork 0
forked from Simnation/Main
This commit is contained in:
Nordi98 2025-07-28 02:37:52 +02:00
parent 8a40491de2
commit 3cfe5d57dc
3 changed files with 156 additions and 2 deletions

View file

@ -59,3 +59,32 @@ end)
RegisterNetEvent('trash:client:notifyEmptied', function()
lib.notify(Config.Notifications.trashCanEmptied)
end)
-- Get the trash can the player is looking at (for admin command)
RegisterNetEvent('trash:client:getTargetTrashCan', function()
local playerPed = PlayerPedId()
local coords = GetEntityCoords(playerPed)
local found = false
-- Check if we're looking at a trash can
if currentEntity and DoesEntityExist(currentEntity) then
local model = GetEntityModel(currentEntity)
-- Check if this model is in our trash can list
for _, trashModel in ipairs(Config.TrashCanModels) do
if model == GetHashKey(trashModel) then
found = true
break
end
end
if found then
local containerID = GetContainerIDFromEntity(currentEntity)
TriggerServerEvent('trash:server:fillTargetTrashCan', containerID)
else
lib.notify(Config.Notifications.noTrashCanFound)
end
else
lib.notify(Config.Notifications.noTrashCanFound)
end
end)