Skip to content

Commit

Permalink
CallCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
TonybynMp4 committed Jun 6, 2023
1 parent 15f3b09 commit c2a33fa
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
7 changes: 7 additions & 0 deletions client/events.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ RegisterNetEvent('QBCore:Client:PvpHasToggled', function(pvp_state)
SetCanAttackFriendly(cache.ped, pvp_state, false)
NetworkSetFriendlyFireOption(pvp_state)
end)

-- Trigger Command
--- @deprecated
RegisterNetEvent('QBCore:Command:CallCommand', function(command)
ExecuteCommand(command)
end)

-- Teleport Commands

---@param coords vector3
Expand Down
15 changes: 15 additions & 0 deletions server/events.lua
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,21 @@ RegisterNetEvent('QBCore:ToggleDuty', function()
TriggerClientEvent('QBCore:Client:SetDuty', src, Player.PlayerData.job.onduty)
end)

--- @deprecated
RegisterNetEvent('QBCore:CallCommand', function(command, args)
local src = source
if not QBCore.Commands.List[command] then return end
local Player = QBCore.Functions.GetPlayer(src)
if not Player then return end
if IsPlayerAceAllowed(src, string.format('command.%s', command)) then
local commandString = command
for _, value in pairs(args) do
commandString = string.format('%s %s', commandString, value)
end
TriggerClientEvent('QBCore:Command:CallCommand', src, commandString)
end
end)

---@deprecated call server function QBCore.Functions.CreateVehicle instead.
QBCore.Functions.CreateCallback('QBCore:Server:SpawnVehicle', function(source, cb, model, coords, warp)
print(string.format("%s invoked deprecated callback QBCore:Server:SpawnVehicle. Call server function QBCore.Functions.CreateVehicle instead.", GetInvokingResource()))
Expand Down

0 comments on commit c2a33fa

Please sign in to comment.