Server/commands.lua

local tgiCore = tgiCoreExports:getCore()
local adminPerm = config.tgiannServer and { "tgi" } or config.framework == "qb" and "god" or "admin"

tgiCore.CommandsAdd("givekey", "Give a key (Admin Only)", { { name = "id", help = "Player ID" } }, false, function(source, args)
    local src = source
    local id = tonumber(args[1])
    local Player = config.tgiannServer and tgiCore.getPlayerById(id) or tgiCore.getPlayer(id)
    local targetSrc = tgiCore.getSource(Player)
    local playerPed = GetPlayerPed(targetSrc)
    if not GetVehiclePedIsIn(playerPed) then
        return tgiCore.notif(src, "The player is not inside the vehicle", "error")
    end
    TriggerClientEvent("tgiann-hotwire:client:giveKey", targetSrc)
end, adminPerm)

Last updated