From f5b18da087f0df3aee3fba1b051703b87a4fede4 Mon Sep 17 00:00:00 2001 From: Kasey FItton Date: Mon, 15 Jul 2024 10:11:14 +0100 Subject: [PATCH] Fix(client): fix exploits --- client/blipsnames.lua | 369 +++++++++++++++++++++--------------------- client/client.lua | 5 +- client/events.lua | 129 ++++++++------- client/noclip.lua | 5 +- server/server.lua | 4 + 5 files changed, 273 insertions(+), 239 deletions(-) diff --git a/client/blipsnames.lua b/client/blipsnames.lua index 2099a3a..d3c9896 100644 --- a/client/blipsnames.lua +++ b/client/blipsnames.lua @@ -14,216 +14,225 @@ CreateThread(function() end) RegisterNetEvent('qb-admin:client:toggleBlips', function() - if not ShowBlips then - ShowBlips = true - NetCheck1 = true - QBCore.Functions.Notify(Lang:t('success.blips_activated'), 'success') - else - ShowBlips = false - QBCore.Functions.Notify(Lang:t('error.blips_deactivated'), 'error') - end + QBCore.Functions.TriggerCallback('qb-admin:isAdmin', function(isAdmin) + if not isAdmin then return end + if not ShowBlips then + ShowBlips = true + NetCheck1 = true + QBCore.Functions.Notify(Lang:t('success.blips_activated'), 'success') + else + ShowBlips = false + QBCore.Functions.Notify(Lang:t('error.blips_deactivated'), 'error') + end + end) end) RegisterNetEvent('qb-admin:client:toggleNames', function() - if not ShowNames then - ShowNames = true - NetCheck2 = true - QBCore.Functions.Notify(Lang:t('success.names_activated'), 'success') - else - ShowNames = false - QBCore.Functions.Notify(Lang:t('error.names_deactivated'), 'error') - end + QBCore.Functions.TriggerCallback('qb-admin:isAdmin', function(isAdmin) + if not isAdmin then return end + if not ShowNames then + ShowNames = true + NetCheck2 = true + QBCore.Functions.Notify(Lang:t('success.names_activated'), 'success') + else + ShowNames = false + QBCore.Functions.Notify(Lang:t('error.names_deactivated'), 'error') + end + end) end) RegisterNetEvent('qb-admin:client:Show', function(players) - for _, player in pairs(players) do - local playeridx = GetPlayerFromServerId(player.id) - local ped = GetPlayerPed(playeridx) - local blip = GetBlipFromEntity(ped) - local name = 'ID: ' .. player.id .. ' | ' .. player.name + QBCore.Functions.TriggerCallback('qb-admin:isAdmin', function(isAdmin) + if not isAdmin then return end + for _, player in pairs(players) do + local playeridx = GetPlayerFromServerId(player.id) + local ped = GetPlayerPed(playeridx) + local blip = GetBlipFromEntity(ped) + local name = 'ID: ' .. player.id .. ' | ' .. player.name - local Tag = CreateFakeMpGamerTag(ped, name, false, false, '', false) - SetMpGamerTagAlpha(Tag, 0, 255) -- Sets "MP_TAG_GAMER_NAME" bar alpha to 100% (not needed just as a fail safe) - SetMpGamerTagAlpha(Tag, 2, 255) -- Sets "MP_TAG_HEALTH_ARMOUR" bar alpha to 100% - SetMpGamerTagAlpha(Tag, 4, 255) -- Sets "MP_TAG_AUDIO_ICON" bar alpha to 100% - SetMpGamerTagAlpha(Tag, 6, 255) -- Sets "MP_TAG_PASSIVE_MODE" bar alpha to 100% - SetMpGamerTagHealthBarColour(Tag, 25) --https://wiki.rage.mp/index.php?title=Fonts_and_Colors + local Tag = CreateFakeMpGamerTag(ped, name, false, false, '', false) + SetMpGamerTagAlpha(Tag, 0, 255) -- Sets "MP_TAG_GAMER_NAME" bar alpha to 100% (not needed just as a fail safe) + SetMpGamerTagAlpha(Tag, 2, 255) -- Sets "MP_TAG_HEALTH_ARMOUR" bar alpha to 100% + SetMpGamerTagAlpha(Tag, 4, 255) -- Sets "MP_TAG_AUDIO_ICON" bar alpha to 100% + SetMpGamerTagAlpha(Tag, 6, 255) -- Sets "MP_TAG_PASSIVE_MODE" bar alpha to 100% + SetMpGamerTagHealthBarColour(Tag, 25) --https://wiki.rage.mp/index.php?title=Fonts_and_Colors - if ShowNames then - SetMpGamerTagVisibility(Tag, 0, true) -- Activates the player ID Char name and FiveM name - SetMpGamerTagVisibility(Tag, 2, true) -- Activates the health (and armor if they have it on) bar below the player names - if NetworkIsPlayerTalking(playeridx) then - SetMpGamerTagVisibility(Tag, 4, true) -- If player is talking a voice icon will show up on the left side of the name + if ShowNames then + SetMpGamerTagVisibility(Tag, 0, true) -- Activates the player ID Char name and FiveM name + SetMpGamerTagVisibility(Tag, 2, true) -- Activates the health (and armor if they have it on) bar below the player names + if NetworkIsPlayerTalking(playeridx) then + SetMpGamerTagVisibility(Tag, 4, true) -- If player is talking a voice icon will show up on the left side of the name + else + SetMpGamerTagVisibility(Tag, 4, false) + end + if GetPlayerInvincible(playeridx) then + SetMpGamerTagVisibility(Tag, 6, true) -- If player is in godmode a circle with a line through it will show up + else + SetMpGamerTagVisibility(Tag, 6, false) + end else + SetMpGamerTagVisibility(Tag, 0, false) + SetMpGamerTagVisibility(Tag, 2, false) SetMpGamerTagVisibility(Tag, 4, false) - end - if GetPlayerInvincible(playeridx) then - SetMpGamerTagVisibility(Tag, 6, true) -- If player is in godmode a circle with a line through it will show up - else SetMpGamerTagVisibility(Tag, 6, false) + RemoveMpGamerTag(Tag) -- Unloads the tags till you activate it again + NetCheck2 = false end - else - SetMpGamerTagVisibility(Tag, 0, false) - SetMpGamerTagVisibility(Tag, 2, false) - SetMpGamerTagVisibility(Tag, 4, false) - SetMpGamerTagVisibility(Tag, 6, false) - RemoveMpGamerTag(Tag) -- Unloads the tags till you activate it again - NetCheck2 = false - end - -- Blips Logic - if ShowBlips then - if not DoesBlipExist(blip) then - blip = AddBlipForEntity(ped) - SetBlipSprite(blip, 1) - ShowHeadingIndicatorOnBlip(blip, true) - else - local veh = GetVehiclePedIsIn(ped, false) - local blipSprite = GetBlipSprite(blip) - --Payer Death - if not GetEntityHealth(ped) then - if blipSprite ~= 274 then - SetBlipSprite(blip, 274) --Dead icon - ShowHeadingIndicatorOnBlip(blip, false) - end - --Player in Vehicle - elseif veh ~= 0 then - local classveh = GetVehicleClass(veh) - local modelveh = GetEntityModel(veh) - --MotorCycles (8) or Cycles (13) - if classveh == 8 or classveh == 13 then - if blipSprite ~= 226 then - SetBlipSprite(blip, 226) --Motorcycle icon - ShowHeadingIndicatorOnBlip(blip, false) - end - --OffRoad (9) - elseif classveh == 9 then - if blipSprite ~= 757 then - SetBlipSprite(blip, 757) --OffRoad icon - ShowHeadingIndicatorOnBlip(blip, false) - end - --Industrial (10) - elseif classveh == 10 then - if blipSprite ~= 477 then - SetBlipSprite(blip, 477) --Truck icon - ShowHeadingIndicatorOnBlip(blip, false) - end - --Utility (11) - elseif classveh == 11 then - if blipSprite ~= 477 then - SetBlipSprite(blip, 477) --Truck icon despite finding better one - ShowHeadingIndicatorOnBlip(blip, false) - end - --Vans (12) - elseif classveh == 12 then - if blipSprite ~= 67 then - SetBlipSprite(blip, 67) --Van icon - ShowHeadingIndicatorOnBlip(blip, false) - end - --Boats (14) - elseif classveh == 14 then - if blipSprite ~= 427 then - SetBlipSprite(blip, 427) --Boat icon - ShowHeadingIndicatorOnBlip(blip, false) - end - --Helicopters (15) - elseif classveh == 15 then - if blipSprite ~= 422 then - SetBlipSprite(blip, 422) --Moving helicopter icon + -- Blips Logic + if ShowBlips then + if not DoesBlipExist(blip) then + blip = AddBlipForEntity(ped) + SetBlipSprite(blip, 1) + ShowHeadingIndicatorOnBlip(blip, true) + else + local veh = GetVehiclePedIsIn(ped, false) + local blipSprite = GetBlipSprite(blip) + --Payer Death + if not GetEntityHealth(ped) then + if blipSprite ~= 274 then + SetBlipSprite(blip, 274) --Dead icon ShowHeadingIndicatorOnBlip(blip, false) end - --Planes (16) - elseif classveh == 16 then - if modelveh == 'besra' or modelveh == 'hydra' or modelveh == 'lazer' then - if blipSprite ~= 424 then - SetBlipSprite(blip, 424) --Jet icon + --Player in Vehicle + elseif veh ~= 0 then + local classveh = GetVehicleClass(veh) + local modelveh = GetEntityModel(veh) + --MotorCycles (8) or Cycles (13) + if classveh == 8 or classveh == 13 then + if blipSprite ~= 226 then + SetBlipSprite(blip, 226) --Motorcycle icon ShowHeadingIndicatorOnBlip(blip, false) end - elseif blipSprite ~= 423 then - SetBlipSprite(blip, 423) --Plane icon - ShowHeadingIndicatorOnBlip(blip, false) - end - --Service (17) - elseif classveh == 17 then - if blipSprite ~= 198 then - SetBlipSprite(blip, 198) --Taxi icon - ShowHeadingIndicatorOnBlip(blip, false) - end - --Emergency (18) - elseif classveh == 18 then - if blipSprite ~= 56 then - SetBlipSprite(blip, 56) --Cop icon - ShowHeadingIndicatorOnBlip(blip, false) - end - --Military (19) - elseif classveh == 19 then - if modelveh == 'rhino' then - if blipSprite ~= 421 then - SetBlipSprite(blip, 421) --Tank icon + --OffRoad (9) + elseif classveh == 9 then + if blipSprite ~= 757 then + SetBlipSprite(blip, 757) --OffRoad icon ShowHeadingIndicatorOnBlip(blip, false) end - elseif blipSprite ~= 750 then - SetBlipSprite(blip, 750) --Military truck icon - ShowHeadingIndicatorOnBlip(blip, false) - end - --Commercial (20) - elseif classveh == 20 then - if blipSprite ~= 477 then - SetBlipSprite(blip, 477) --Truck icon - ShowHeadingIndicatorOnBlip(blip, false) - end - --Every car (0, 1, 2, 3, 4, 5, 6, 7) - else - if modelveh == 'insurgent' or modelveh == 'insurgent2' or modelveh == 'limo2' then - if blipSprite ~= 426 then - SetBlipSprite(blip, 426) --Armed car icon + --Industrial (10) + elseif classveh == 10 then + if blipSprite ~= 477 then + SetBlipSprite(blip, 477) --Truck icon ShowHeadingIndicatorOnBlip(blip, false) end - elseif blipSprite ~= 225 then - SetBlipSprite(blip, 225) --Car icon - ShowHeadingIndicatorOnBlip(blip, true) + --Utility (11) + elseif classveh == 11 then + if blipSprite ~= 477 then + SetBlipSprite(blip, 477) --Truck icon despite finding better one + ShowHeadingIndicatorOnBlip(blip, false) + end + --Vans (12) + elseif classveh == 12 then + if blipSprite ~= 67 then + SetBlipSprite(blip, 67) --Van icon + ShowHeadingIndicatorOnBlip(blip, false) + end + --Boats (14) + elseif classveh == 14 then + if blipSprite ~= 427 then + SetBlipSprite(blip, 427) --Boat icon + ShowHeadingIndicatorOnBlip(blip, false) + end + --Helicopters (15) + elseif classveh == 15 then + if blipSprite ~= 422 then + SetBlipSprite(blip, 422) --Moving helicopter icon + ShowHeadingIndicatorOnBlip(blip, false) + end + --Planes (16) + elseif classveh == 16 then + if modelveh == 'besra' or modelveh == 'hydra' or modelveh == 'lazer' then + if blipSprite ~= 424 then + SetBlipSprite(blip, 424) --Jet icon + ShowHeadingIndicatorOnBlip(blip, false) + end + elseif blipSprite ~= 423 then + SetBlipSprite(blip, 423) --Plane icon + ShowHeadingIndicatorOnBlip(blip, false) + end + --Service (17) + elseif classveh == 17 then + if blipSprite ~= 198 then + SetBlipSprite(blip, 198) --Taxi icon + ShowHeadingIndicatorOnBlip(blip, false) + end + --Emergency (18) + elseif classveh == 18 then + if blipSprite ~= 56 then + SetBlipSprite(blip, 56) --Cop icon + ShowHeadingIndicatorOnBlip(blip, false) + end + --Military (19) + elseif classveh == 19 then + if modelveh == 'rhino' then + if blipSprite ~= 421 then + SetBlipSprite(blip, 421) --Tank icon + ShowHeadingIndicatorOnBlip(blip, false) + end + elseif blipSprite ~= 750 then + SetBlipSprite(blip, 750) --Military truck icon + ShowHeadingIndicatorOnBlip(blip, false) + end + --Commercial (20) + elseif classveh == 20 then + if blipSprite ~= 477 then + SetBlipSprite(blip, 477) --Truck icon + ShowHeadingIndicatorOnBlip(blip, false) + end + --Every car (0, 1, 2, 3, 4, 5, 6, 7) + else + if modelveh == 'insurgent' or modelveh == 'insurgent2' or modelveh == 'limo2' then + if blipSprite ~= 426 then + SetBlipSprite(blip, 426) --Armed car icon + ShowHeadingIndicatorOnBlip(blip, false) + end + elseif blipSprite ~= 225 then + SetBlipSprite(blip, 225) --Car icon + ShowHeadingIndicatorOnBlip(blip, true) + end end - end - -- Show number in case of passangers - local passengers = GetVehicleNumberOfPassengers(veh) - if passengers then - if not IsVehicleSeatFree(veh, -1) then - passengers = passengers + 1 + -- Show number in case of passangers + local passengers = GetVehicleNumberOfPassengers(veh) + if passengers then + if not IsVehicleSeatFree(veh, -1) then + passengers = passengers + 1 + end + ShowNumberOnBlip(blip, passengers) + else + HideNumberOnBlip(blip) end - ShowNumberOnBlip(blip, passengers) + --Player on Foot else HideNumberOnBlip(blip) + if blipSprite ~= 1 then + SetBlipSprite(blip, 1) + ShowHeadingIndicatorOnBlip(blip, true) + end end - --Player on Foot - else - HideNumberOnBlip(blip) - if blipSprite ~= 1 then - SetBlipSprite(blip, 1) - ShowHeadingIndicatorOnBlip(blip, true) - end - end - SetBlipRotation(blip, math.ceil(GetEntityHeading(veh))) - SetBlipNameToPlayerName(blip, playeridx) - SetBlipScale(blip, 0.85) + SetBlipRotation(blip, math.ceil(GetEntityHeading(veh))) + SetBlipNameToPlayerName(blip, playeridx) + SetBlipScale(blip, 0.85) - if IsPauseMenuActive() then - SetBlipAlpha(blip, 255) - else - local x1, y1 = table.unpack(GetEntityCoords(PlayerPedId(), true)) - local x2, y2 = table.unpack(GetEntityCoords(GetPlayerPed(playeridx), true)) - local distance = (math.floor(math.abs(math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2))) / -1)) + 900 - if distance < 0 then - distance = 0 - elseif distance > 255 then - distance = 255 + if IsPauseMenuActive() then + SetBlipAlpha(blip, 255) + else + local x1, y1 = table.unpack(GetEntityCoords(PlayerPedId(), true)) + local x2, y2 = table.unpack(GetEntityCoords(GetPlayerPed(playeridx), true)) + local distance = (math.floor(math.abs(math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2))) / -1)) + 900 + if distance < 0 then + distance = 0 + elseif distance > 255 then + distance = 255 + end + SetBlipAlpha(blip, distance) end - SetBlipAlpha(blip, distance) end + else + RemoveBlip(blip) + NetCheck1 = false end - else - RemoveBlip(blip) - NetCheck1 = false end - end + end) end) diff --git a/client/client.lua b/client/client.lua index 97ecbe0..7fe3e96 100644 --- a/client/client.lua +++ b/client/client.lua @@ -26,7 +26,10 @@ local menu14 = MenuV:CreateMenu(false, Lang:t('menu.entity_view_options'), menuL local menu15 = MenuV:CreateMenu(false, Lang:t('menu.spawn_weapons'), menuLocation, 220, 20, 60, 'size-125', 'none', 'menuv', 'test15') RegisterNetEvent('qb-admin:client:openMenu', function() - MenuV:OpenMenu(menu1) + QBCore.Functions.TriggerCallback('qb-admin:isAdmin', function(isAdmin) + if not isAdmin then return end + MenuV:OpenMenu(menu1) + end) end) --[[ diff --git a/client/events.lua b/client/events.lua index 4b969d0..fd15232 100644 --- a/client/events.lua +++ b/client/events.lua @@ -20,27 +20,30 @@ local isSpectating = false -- Events RegisterNetEvent('qb-admin:client:spectate', function(targetPed) - local myPed = PlayerPedId() - local targetplayer = GetPlayerFromServerId(targetPed) - local target = GetPlayerPed(targetplayer) - if not isSpectating then - isSpectating = true - SetEntityVisible(myPed, false) -- Set invisible - SetEntityCollision(myPed, false, false) -- Set collision - SetEntityInvincible(myPed, true) -- Set invincible - NetworkSetEntityInvisibleToNetwork(myPed, true) -- Set invisibility - lastSpectateCoord = GetEntityCoords(myPed) -- save my last coords - NetworkSetInSpectatorMode(true, target) -- Enter Spectate Mode - else - isSpectating = false - NetworkSetInSpectatorMode(false, target) -- Remove From Spectate Mode - NetworkSetEntityInvisibleToNetwork(myPed, false) -- Set Visible - SetEntityCollision(myPed, true, true) -- Set collision - SetEntityCoords(myPed, lastSpectateCoord) -- Return Me To My Coords - SetEntityVisible(myPed, true) -- Remove invisible - SetEntityInvincible(myPed, false) -- Remove godmode - lastSpectateCoord = nil -- Reset Last Saved Coords - end + QBCore.Functions.TriggerCallback('qb-admin:isAdmin', function(isAdmin) + if not isAdmin then return end + local myPed = PlayerPedId() + local targetplayer = GetPlayerFromServerId(targetPed) + local target = GetPlayerPed(targetplayer) + if not isSpectating then + isSpectating = true + SetEntityVisible(myPed, false) -- Set invisible + SetEntityCollision(myPed, false, false) -- Set collision + SetEntityInvincible(myPed, true) -- Set invincible + NetworkSetEntityInvisibleToNetwork(myPed, true) -- Set invisibility + lastSpectateCoord = GetEntityCoords(myPed) -- save my last coords + NetworkSetInSpectatorMode(true, target) -- Enter Spectate Mode + else + isSpectating = false + NetworkSetInSpectatorMode(false, target) -- Remove From Spectate Mode + NetworkSetEntityInvisibleToNetwork(myPed, false) -- Set Visible + SetEntityCollision(myPed, true, true) -- Set collision + SetEntityCoords(myPed, lastSpectateCoord) -- Return Me To My Coords + SetEntityVisible(myPed, true) -- Remove invisible + SetEntityInvincible(myPed, false) -- Remove godmode + lastSpectateCoord = nil -- Reset Last Saved Coords + end + end) end) RegisterNetEvent('qb-admin:client:SendReport', function(name, src, msg) @@ -58,22 +61,25 @@ end RegisterNetEvent('qb-admin:client:SaveCar', function() - local ped = PlayerPedId() - local veh = GetVehiclePedIsIn(ped) - - if veh ~= nil and veh ~= 0 then - local plate = QBCore.Functions.GetPlate(veh) - local props = QBCore.Functions.GetVehicleProperties(veh) - local hash = props.model - local vehname = getVehicleFromVehList(hash) - if QBCore.Shared.Vehicles[vehname] ~= nil and next(QBCore.Shared.Vehicles[vehname]) ~= nil then - TriggerServerEvent('qb-admin:server:SaveCar', props, QBCore.Shared.Vehicles[vehname], GetHashKey(veh), plate) + QBCore.Functions.TriggerCallback('qb-admin:isAdmin', function(isAdmin) + if not isAdmin then return end + local ped = PlayerPedId() + local veh = GetVehiclePedIsIn(ped) + + if veh ~= nil and veh ~= 0 then + local plate = QBCore.Functions.GetPlate(veh) + local props = QBCore.Functions.GetVehicleProperties(veh) + local hash = props.model + local vehname = getVehicleFromVehList(hash) + if QBCore.Shared.Vehicles[vehname] ~= nil and next(QBCore.Shared.Vehicles[vehname]) ~= nil then + TriggerServerEvent('qb-admin:server:SaveCar', props, QBCore.Shared.Vehicles[vehname], GetHashKey(veh), plate) + else + QBCore.Functions.Notify(Lang:t('error.no_store_vehicle_garage'), 'error') + end else - QBCore.Functions.Notify(Lang:t('error.no_store_vehicle_garage'), 'error') + QBCore.Functions.Notify(Lang:t('error.no_vehicle'), 'error') end - else - QBCore.Functions.Notify(Lang:t('error.no_vehicle'), 'error') - end + end) end) local function LoadPlayerModel(skin) @@ -94,32 +100,38 @@ local function isPedAllowedRandom(skin) end RegisterNetEvent('qb-admin:client:SetModel', function(skin) - local ped = PlayerPedId() - local model = GetHashKey(skin) - SetEntityInvincible(ped, true) + QBCore.Functions.TriggerCallback('qb-admin:isAdmin', function(isAdmin) + if not isAdmin then return end + local ped = PlayerPedId() + local model = GetHashKey(skin) + SetEntityInvincible(ped, true) - if IsModelInCdimage(model) and IsModelValid(model) then - LoadPlayerModel(model) - SetPlayerModel(PlayerId(), model) + if IsModelInCdimage(model) and IsModelValid(model) then + LoadPlayerModel(model) + SetPlayerModel(PlayerId(), model) - if isPedAllowedRandom(skin) then - SetPedRandomComponentVariation(ped, true) - end + if isPedAllowedRandom(skin) then + SetPedRandomComponentVariation(ped, true) + end - SetModelAsNoLongerNeeded(model) - end - SetEntityInvincible(ped, false) + SetModelAsNoLongerNeeded(model) + end + SetEntityInvincible(ped, false) + end) end) RegisterNetEvent('qb-admin:client:SetSpeed', function(speed) - local ped = PlayerId() - if speed == 'fast' then - SetRunSprintMultiplierForPlayer(ped, 1.49) - SetSwimMultiplierForPlayer(ped, 1.49) - else - SetRunSprintMultiplierForPlayer(ped, 1.0) - SetSwimMultiplierForPlayer(ped, 1.0) - end + QBCore.Functions.TriggerCallback('qb-admin:isAdmin', function(isAdmin) + if not isAdmin then return end + local ped = PlayerId() + if speed == 'fast' then + SetRunSprintMultiplierForPlayer(ped, 1.49) + SetSwimMultiplierForPlayer(ped, 1.49) + else + SetRunSprintMultiplierForPlayer(ped, 1.0) + SetSwimMultiplierForPlayer(ped, 1.0) + end + end) end) RegisterNetEvent('qb-admin:client:GiveNuiFocus', function(focus, mouse) @@ -142,6 +154,9 @@ function PerformanceUpgradeVehicle(vehicle, customWheels) end RegisterNetEvent('qb-admin:client:maxmodVehicle', function() - local vehicle = GetVehiclePedIsIn(PlayerPedId()) - PerformanceUpgradeVehicle(vehicle) + QBCore.Functions.TriggerCallback('qb-admin:isAdmin', function(isAdmin) + if not isAdmin then return end + local vehicle = GetVehiclePedIsIn(PlayerPedId()) + PerformanceUpgradeVehicle(vehicle) + end) end) diff --git a/client/noclip.lua b/client/noclip.lua index b7fc09f..676c045 100644 --- a/client/noclip.lua +++ b/client/noclip.lua @@ -266,7 +266,10 @@ ToggleNoClip = function(state) end RegisterNetEvent('qb-admin:client:ToggleNoClip', function() - ToggleNoClip(not IsNoClipping) + QBCore.Functions.TriggerCallback('qb-admin:isAdmin', function(isAdmin) + if not isAdmin then return end + ToggleNoClip(not IsNoClipping) + end) end) AddEventHandler('onResourceStop', function(resourceName) diff --git a/server/server.lua b/server/server.lua index 2b36ab5..4e26967 100644 --- a/server/server.lua +++ b/server/server.lua @@ -28,6 +28,10 @@ QBCore.Functions.CreateCallback('test:getplayers', function(_, cb) -- WORKS cb(players) end) +QBCore.Functions.CreateCallback('qb-admin:isAdmin', function(src, cb) -- WORKS + cb(QBCore.Functions.HasPermission(src, 'admin') or IsPlayerAceAllowed(src, 'command')) +end) + QBCore.Functions.CreateCallback('qb-admin:server:getrank', function(source, cb) if QBCore.Functions.HasPermission(source, 'god') or IsPlayerAceAllowed(source, 'command') then cb(true)