Skip to content

new playerid compatibility #617

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

Closed
wants to merge 1 commit into from
Closed
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
11 changes: 5 additions & 6 deletions server/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

QBCore.Commands.Add('giveitem', 'Give An Item (Admin Only)', { { name = 'id', help = 'Player ID' }, { name = 'item', help = 'Name of the item (not a label)' }, { name = 'amount', help = 'Amount of items' } }, false, function(source, args)
local id = tonumber(args[1])
local player = QBCore.Functions.GetPlayer(id)
local player = QBCore.Functions.GetPlayerByPlayerId(id)
local amount = tonumber(args[3]) or 1
local itemData = QBCore.Shared.Items[tostring(args[2]):lower()]
if player then
Expand Down Expand Up @@ -84,11 +84,10 @@ end, 'god')

QBCore.Commands.Add('clearinv', 'Clear Inventory (Admin Only)', { { name = 'id', help = 'Player ID' } }, false, function(source, args)
local id = tonumber(args[1])
if not id then
ClearInventory(source)
return
end
ClearInventory(id)
if not id then return ClearInventory(source) end
local Player = QBCore.Functions.GetPlayerByPlayerId(id)
if not Player then return end
ClearInventory(Player.PlayerData.source)
end, 'admin')

-- Keybindings
Expand Down