Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move function to scope #115

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
22 changes: 11 additions & 11 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -981,17 +981,6 @@ local function CreateNewDrop(source, fromSlot, toSlot, itemAmount, created)
end
end

local function OpenInventoryById(source, targetId)
local QBPlayer = QBCore.Functions.GetPlayer(source)
local TargetPlayer = QBCore.Functions.GetPlayer(tonumber(targetId))
if not QBPlayer or not TargetPlayer then return end
if Player(targetId).state.inv_busy then TriggerClientEvent("ps-inventory:client:closeinv", targetId) end
Wait(1500)
Player(targetId).state.inv_busy = true
OpenInventory("otherplayer", targetId, nil, source)
end

exports('OpenInventoryById', OpenInventoryById)

local function OpenInventory(name, id, other, origin)

Expand Down Expand Up @@ -1238,6 +1227,17 @@ local function OpenInventory(name, id, other, origin)
end
exports('OpenInventory',OpenInventory)

local function OpenInventoryById(source, targetId)
local QBPlayer = QBCore.Functions.GetPlayer(source)
local TargetPlayer = QBCore.Functions.GetPlayer(tonumber(targetId))
if not QBPlayer or not TargetPlayer then return end
if Player(targetId).state.inv_busy then TriggerClientEvent("ps-inventory:client:closeinv", targetId) end
Wait(1500)
Player(targetId).state.inv_busy = true
OpenInventory("otherplayer", targetId, nil, source)
end

exports('OpenInventoryById', OpenInventoryById)
-- Events

AddEventHandler('QBCore:Server:PlayerLoaded', function(Player)
Expand Down