forked from Simnation/Main
ed
This commit is contained in:
parent
8a40491de2
commit
3cfe5d57dc
3 changed files with 156 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue