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

Variable for exploit distance check #516

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
25 changes: 13 additions & 12 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ local FingerDrops = {}
local Objects = {}
local QBCore = exports['qb-core']:GetCoreObject()
local updatingCops = false
local exploit_distance_check = 2.5 -- If you are getting exploit bans, increase this number
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be as a config variable. If you want it user-editable, please place it there.


-- Functions
local function UpdateBlips()
Expand Down Expand Up @@ -711,7 +712,7 @@ RegisterNetEvent('police:server:TakeOutImpound', function(plate, garage)
local playerPed = GetPlayerPed(src)
local playerCoords = GetEntityCoords(playerPed)
local targetCoords = Config.Locations['impound'][garage]
if #(playerCoords - targetCoords) > 10.0 then return DropPlayer(src, 'Attempted exploit abuse') end
if #(playerCoords - targetCoords) > exploit_distance_check * 4 then return DropPlayer(src, 'Attempted exploit abuse') end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Magic Number here - I understand why it's *4 but in this case, it would probably be better to just make a separate "impound_exploit_distance_check". Because 10 may be enough but the 2.5 for other things may not.

MySQL.update('UPDATE player_vehicles SET state = ? WHERE plate = ?', { 0, plate })
TriggerClientEvent('QBCore:Notify', src, Lang:t('success.impound_vehicle_removed'), 'success')
end)
Expand All @@ -722,7 +723,7 @@ RegisterNetEvent('police:server:CuffPlayer', function(playerId, isSoftcuff)
local targetPed = GetPlayerPed(playerId)
local playerCoords = GetEntityCoords(playerPed)
local targetCoords = GetEntityCoords(targetPed)
if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, 'Attempted exploit abuse') end
if #(playerCoords - targetCoords) > exploit_distance_check then return DropPlayer(src, 'Attempted exploit abuse') end

local Player = QBCore.Functions.GetPlayer(src)
local CuffedPlayer = QBCore.Functions.GetPlayer(playerId)
Expand All @@ -737,7 +738,7 @@ RegisterNetEvent('police:server:EscortPlayer', function(playerId)
local targetPed = GetPlayerPed(playerId)
local playerCoords = GetEntityCoords(playerPed)
local targetCoords = GetEntityCoords(targetPed)
if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, 'Attempted exploit abuse') end
if #(playerCoords - targetCoords) > exploit_distance_check then return DropPlayer(src, 'Attempted exploit abuse') end

local Player = QBCore.Functions.GetPlayer(source)
local EscortPlayer = QBCore.Functions.GetPlayer(playerId)
Expand All @@ -756,7 +757,7 @@ RegisterNetEvent('police:server:KidnapPlayer', function(playerId)
local targetPed = GetPlayerPed(playerId)
local playerCoords = GetEntityCoords(playerPed)
local targetCoords = GetEntityCoords(targetPed)
if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, 'Attempted exploit abuse') end
if #(playerCoords - targetCoords) > exploit_distance_check then return DropPlayer(src, 'Attempted exploit abuse') end

local Player = QBCore.Functions.GetPlayer(source)
local EscortPlayer = QBCore.Functions.GetPlayer(playerId)
Expand All @@ -776,7 +777,7 @@ RegisterNetEvent('police:server:SetPlayerOutVehicle', function(playerId)
local targetPed = GetPlayerPed(playerId)
local playerCoords = GetEntityCoords(playerPed)
local targetCoords = GetEntityCoords(targetPed)
if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, 'Attempted exploit abuse') end
if #(playerCoords - targetCoords) > exploit_distance_check then return DropPlayer(src, 'Attempted exploit abuse') end

local EscortPlayer = QBCore.Functions.GetPlayer(playerId)
if not QBCore.Functions.GetPlayer(src) or not EscortPlayer then return end
Expand All @@ -794,7 +795,7 @@ RegisterNetEvent('police:server:PutPlayerInVehicle', function(playerId)
local targetPed = GetPlayerPed(playerId)
local playerCoords = GetEntityCoords(playerPed)
local targetCoords = GetEntityCoords(targetPed)
if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, 'Attempted exploit abuse') end
if #(playerCoords - targetCoords) > exploit_distance_check then return DropPlayer(src, 'Attempted exploit abuse') end

local EscortPlayer = QBCore.Functions.GetPlayer(playerId)
if not QBCore.Functions.GetPlayer(src) or not EscortPlayer then return end
Expand All @@ -812,7 +813,7 @@ RegisterNetEvent('police:server:BillPlayer', function(playerId, price)
local targetPed = GetPlayerPed(playerId)
local playerCoords = GetEntityCoords(playerPed)
local targetCoords = GetEntityCoords(targetPed)
if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, 'Attempted exploit abuse') end
if #(playerCoords - targetCoords) > exploit_distance_check then return DropPlayer(src, 'Attempted exploit abuse') end

local Player = QBCore.Functions.GetPlayer(src)
local OtherPlayer = QBCore.Functions.GetPlayer(playerId)
Expand All @@ -829,7 +830,7 @@ RegisterNetEvent('police:server:JailPlayer', function(playerId, time)
local targetPed = GetPlayerPed(playerId)
local playerCoords = GetEntityCoords(playerPed)
local targetCoords = GetEntityCoords(targetPed)
if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, 'Attempted exploit abuse') end
if #(playerCoords - targetCoords) > exploit_distance_check then return DropPlayer(src, 'Attempted exploit abuse') end

local Player = QBCore.Functions.GetPlayer(src)
local OtherPlayer = QBCore.Functions.GetPlayer(playerId)
Expand Down Expand Up @@ -892,7 +893,7 @@ RegisterNetEvent('police:server:SeizeCash', function(playerId)
local targetPed = GetPlayerPed(playerId)
local playerCoords = GetEntityCoords(playerPed)
local targetCoords = GetEntityCoords(targetPed)
if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, 'Attempted exploit abuse') end
if #(playerCoords - targetCoords) > exploit_distance_check then return DropPlayer(src, 'Attempted exploit abuse') end
local Player = QBCore.Functions.GetPlayer(src)
local SearchedPlayer = QBCore.Functions.GetPlayer(playerId)
if not Player or not SearchedPlayer then return end
Expand All @@ -911,7 +912,7 @@ RegisterNetEvent('police:server:SeizeDriverLicense', function(playerId)
local targetPed = GetPlayerPed(playerId)
local playerCoords = GetEntityCoords(playerPed)
local targetCoords = GetEntityCoords(targetPed)
if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, 'Attempted exploit abuse') end
if #(playerCoords - targetCoords) > exploit_distance_check then return DropPlayer(src, 'Attempted exploit abuse') end

local SearchedPlayer = QBCore.Functions.GetPlayer(playerId)
if not QBCore.Functions.GetPlayer(src) or not SearchedPlayer then return end
Expand All @@ -932,7 +933,7 @@ RegisterNetEvent('police:server:RobPlayer', function(playerId)
local targetPed = GetPlayerPed(playerId)
local playerCoords = GetEntityCoords(playerPed)
local targetCoords = GetEntityCoords(targetPed)
if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, 'Attempted exploit abuse') end
if #(playerCoords - targetCoords) > exploit_distance_check then return DropPlayer(src, 'Attempted exploit abuse') end

local Player = QBCore.Functions.GetPlayer(src)
local SearchedPlayer = QBCore.Functions.GetPlayer(playerId)
Expand Down Expand Up @@ -1108,7 +1109,7 @@ RegisterNetEvent('police:server:SetTracker', function(targetId)
local targetPed = GetPlayerPed(targetId)
local playerCoords = GetEntityCoords(playerPed)
local targetCoords = GetEntityCoords(targetPed)
if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, 'Attempted exploit abuse') end
if #(playerCoords - targetCoords) > exploit_distance_check then return DropPlayer(src, 'Attempted exploit abuse') end

local Target = QBCore.Functions.GetPlayer(targetId)
if not QBCore.Functions.GetPlayer(src) or not Target then return end
Expand Down
Loading