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

Add a hook for scanning #412

Merged
merged 2 commits into from
Jun 27, 2024
Merged
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
5 changes: 5 additions & 0 deletions lua/acf/scanner/scanner_sh.lua
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ if SERVER then
function scanning.BeginScanning(playerScanning, targetPlayer)
if not IsValid(playerScanning) then return end
if not IsValid(targetPlayer) then scanning.EndScanning() return end
if hook.Run("ACF_PreBeginScanning", playerScanning) == false then return end
if playerScanning:InVehicle() then return end

scanningPlayers[playerScanning] = {
Expand Down Expand Up @@ -862,6 +863,10 @@ if CLIENT then
if LocalPlayer():InVehicle() then
Derma_Message("You cannot scan a target while being in a vehicle. Exit the vehicle, then try again.", "Scanning Blocked", "OK")
return end
local canScan, whyNot = hook.Run("ACF_PreBeginScanning", LocalPlayer())
if not canScan then
Derma_Message("Scanning has been blocked by the server: " .. (whyNot or "<no reason provided>"), "Scanning Blocked", "OK")
return end

NetStart("UpdatePlayer")
net_WriteEntity(target)
Expand Down
Loading