DarkRP - Can't Arrest

So, lately you can’t arrest people in-game with arrest sticks so I tried doing it in console and I got this error.



[ERROR] gamemodes/darkrp/entities/entities/ent_unarrestbox/shared.lua:62: attempt to index global 'Lockpick' (a nil value)
1. fn - gamemodes/darkrp/entities/entities/ent_unarrestbox/shared.lua:62
2. Call - addons/ulib/lua/ulib/shared/hook.lua:183
3. arrest - gamemodes/darkrp/gamemode/modules/police/sv_init.lua:83
4. unknown - gamemodes/darkrp/gamemode/modules/police/sv_init.lua:237
5. unknown - lua/includes/modules/concommand.lua:69


Here are the scripts:

gamemodes/darkrp/entities/entities/ent_unarrestbox/shared.lua



AddCSLuaFile()
ENT.Type = "anim"  
ENT.Base = "base_gmodentity"     
ENT.PrintName		= "Unarrest Box" 
ENT.Author			= "shadowndacorner"
ENT.Contact			= ""  
ENT.Purpose			= ""  
ENT.Instructions	= "Unarrest people."

ENT.Spawnable			= false
ENT.AdminSpawnable		= true

function ENT:Initialize()     
	self:SetModel( "models/items/ammocrate_smg1.mdl" )  
	self:PhysicsInit( SOLID_VPHYSICS )
	self:SetSolid( SOLID_VPHYSICS )
	if SERVER then
		self:SetUseType(SIMPLE_USE)
	end
	local phys = self.Entity:GetPhysicsObject()  
	phys:Wake()  
	self:SetMoveType( MOVETYPE_NONE )
	phys:SetMass( 200 )
	if !DarkRP then self:Remove() end
end

function ENT:Unarrest(ply)
	local ang=ply:EyeAngles()
	local pos=ply:GetPos()
	local mdl=ply:GetModel()
	local paw=ply.PreArrestWeapons
	local paa=ply.PreArrestAmmo
	ply:unArrest()
	ply:wanted(NULL, "Escaping from jail!")
	timer.Simple(0.1+FrameTime(), function()
		ply:SetPos(pos)
		ply:SetEyeAngles(ang)
		ply:SetModel(mdl)
		ply:StripWeapons()
		for f, v in pairs(paw) do
			ply:Give(v)
		end
		for f, v in pairs(paa) do
			ply:SetAmmo(v, f)
		end
		ply.oWalkSpeed = ply.PreArrestWS
		ply.oRunSpeed = ply.PrearrestRS
		timer.Simple(0.5, function()
			ply:SetWalkSpeed(ply.PreArrestWS)
			ply:SetRunSpeed(ply.PreArrestRS or ply:GetWalkSpeed()*2)
			ply:SprintEnable(true)
			ply:SetLockpickCount(ply.PreArrestLockpicks + ply:GetLockpickCount())
			
			ply.PreArrestWS=nil
			ply.PreArrestRS=nil
			ply.PreArrestLockpicks=nil
		end)
	end)
end

hook.Add('playerArrested', 'GetAllWeapons', function(ply, time, enf)
	if Lockpick.Config.EnableBreakout then
		ply.PreArrestWS=ply:GetWalkSpeed()
		ply.PreArrestRS=ply:GetRunSpeed()
		ply.PreArrestWeapons={}
		ply.PreArrestAmmo={}
		local picksToKeep = math.min(ply:GetLockpickCount(), Lockpick.Config.JailPicks)
		ply.PreArrestLockpicks = ply:GetLockpickCount() - picksToKeep
		ply:SetLockpickCount(picksToKeep)
		for f, v in pairs(ply:GetWeapons()) do
			ply.PreArrestWeapons[f]=v:GetClass()
			ply.PreArrestAmmo[v:GetPrimaryAmmoType()]=ply:GetAmmoCount(v:GetPrimaryAmmoType())
			ply.PreArrestAmmo[v:GetSecondaryAmmoType()]=ply:GetAmmoCount(v:GetPrimaryAmmoType())
		end
	end
end)

hook.Add('playerUnArrested', 'DeleteWeapons', function(ply, time, enf)
	ply.PreArrestWeapons=nil
	ply.PreArrestAmmo=nil
end)

function ENT:Use(ply)
end

function ENT:UpdateTransmitState()
	return TRANSMIT_PVS
end

function ENT:Draw()
	self.Entity:DrawModel()
	cam.Start3D2D(self:GetPos()+self:GetAngles():Up()*self:OBBMaxs().z/2-self:GetAngles():Forward()*16-self:GetAngles():Right()*12, self:GetAngles()+Angle(180, 90, -90), 0.12)
		surface.SetDrawColor(80, 80, 80, 200)
		surface.DrawRect(11, 0, (23/0.12), 10/0.12)
		
		surface.SetTextColor(255, 255, 255, 255)
		surface.SetFont('Lockpick')
		local txt="Evidence"
		if LocalPlayer():isArrested() then
			txt=txt.." (Lockpick to Unarrest)"
		end
		local x, y=surface.GetTextSize(txt)
		surface.SetTextPos((25/0.12/2)-x/2, 12.5-y/2)
		surface.DrawText(txt)
	cam.End3D2D()
end 

if Lockpick and Lockpick.Config then
	function Lockpick:CreateUnarrestBox()
		if SERVER and !self.Config.DisableJailPicks and self.Config.EnableBreakout and Lockpick.Config.UnarrestBoxPositions[game.GetMap()] then
			local ent=ents.Create('ent_unarrestbox')
			local pt=Lockpick.Config.UnarrestBoxPositions[game.GetMap()]
			//ent:SetPos(pt.CratePos)
			//ent:SetAngles(pt.CrateAng)
			ent:Spawn()
			ent:Activate()
			
			ent:SetPos(pt.CratePos)
			ent:SetAngles(pt.CrateAng)
		end
	end
	
	game.lpoCleanUpMap=game.lpoCleanUpMap or game.CleanUpMap
	function game.CleanUpMap(...)
		game.lpoCleanUpMap(...)
		timer.Simple(0, function()
			Lockpick:CreateUnarrestBox()
		end)
	end
	
	hook.Add('InitPostEntity', 'CreateUnarrestBox', function()
		Lockpick:CreateUnarrestBox()
	end)
end


addons/ulib/lua/ulib/shared/hook.lua



--[[
	Title: Hook

	This overrides garry's default hook system. We need this better hook system for any serious development.
	We're implementing hook priorities. hook.Add() now takes an additional parameter of type number between -20 and 20.
	0 is default (so we remain backwards compatible). -20 and 20 are read only (ignores returned values).
	Hooks are called in order from -20 on up.
]]

-- This file is coded a little awkwardly because we're trying to implement a new behavior while remaining as true to the old behavior as possible.

-- Globals that we are going to use
local gmod          = gmod
local pairs         = pairs
local isfunction    = isfunction
local isstring      = isstring
local IsValid       = IsValid

-- Needed due to our modifications
local table         = table
local ipairs        = ipairs
local tostring      = tostring

--[[ Needed for tests, below
local CLIENT = CLIENT
local print = print
local assert = assert
local error = error --]]

-- Grab all previous hooks from the pre-existing hook module.
local OldHooks = hook.GetTable()

-----------------------------------------------------------
--   Name: hook
--   Desc: For scripts to hook onto Gamemode events
-----------------------------------------------------------
module( "hook" )


-- Local variables
local Hooks = {}
local BackwardsHooks = {} -- A table fully to garry's spec for aVoN

local function sortHooks( event_name )
	for i=#Hooks[ event_name ], 1, -1 do
		local name = Hooks[ event_name ][ i ].name
		if not isstring( name ) and not IsValid( name ) then
			Remove( event_name, name )
		end
	end
	
	table.sort( Hooks[ event_name ], function( a, b ) -- Sort by priority, then name
		if a == nil then return false -- Move nil to end
		elseif b == nil then return true -- Keep nil at end
		elseif a.priority < b.priority then return true
		elseif a.priority == b.priority and tostring(a.name) < tostring(b.name) then return true
		else return false end
	end )
end


-- Exposed Functions

--[[
	Function: hook.GetTable

	Returns:

		The table filled with all the hooks in a format that is backwards compatible with garry's.
]]
function GetTable()
	return BackwardsHooks
end

--[[
	Function: hook.Add

	Our new and improved hook.Add function.
	Read the file description for more information on how the hook priorities work.

	Parameters:

		event_name - The name of the event (IE "PlayerInitialSpawn").
		name - The unique name of your hook.
			This is only so that if the file is reloaded, it can be unhooked (or you can unhook it yourself).
		func - The function callback to call
		priority - *(Optional, defaults to 0)* Priority from -20 to 20. Remember that -20 and 20 are read-only.
]]
function Add( event_name, name, func, priority )
	if not isfunction( func ) then return end
	if not isstring( event_name ) then return end
	
	if not Hooks[ event_name ] then
		BackwardsHooks[ event_name ] = {}
		Hooks[ event_name ] = {}
	end

	priority = priority or 0

	-- Make sure the name is unique
	Remove( event_name, name )

	table.insert( Hooks[ event_name ], { name=name, fn=func, priority=priority } )
	BackwardsHooks[ event_name ][ name ] = func -- Keep the classic style too so we won't break anything
	sortHooks( event_name )
end

--[[
	Function: hook.Remove

	Parameters:

		event_name - The name of the event (IE "PlayerInitialSpawn").
		name - The unique name of your hook. Use the same name you used in hook.Add()
]]
function Remove( event_name, name )
	if not isstring( event_name ) then return end
	
	if not Hooks[ event_name ] then return end
	
	for index, value in ipairs( Hooks[ event_name ] ) do
		if value.name == name then
			table.remove( Hooks[ event_name ], index )
			break
		end
	end

	BackwardsHooks[ event_name ][ name ] = nil
end

--[[
	Function: hook.Run
	
	A convienence function created by Garry so you don't have to pass the gamemode in by hand.
	
	Parameters:
	
		name - The name of the event
		... - Any other params to pass
		
	Revisions:
	
		2.50 - Created to match GM13 API
]]
function Run( name, ... )
	return Call( name, nil, ... )
end

local resort = {}
--[[
	Function: hook.Call

	Normally, you don't want to call this directly. Use gamemode.Call() instead.

	Parameters:

		name - The name of the event
		gm - The gamemode table
		... - Any other params to pass
]]
function Call( name, gm, ... )
	for i = 1, #resort do
		sortHooks( resort[ i ] )
	end
	resort = {}
	
	-- If called from hook.Run then gm will be nil.
	if gm == nil and gmod ~= nil then
		gm = gmod.GetGamemode()
	end

	local HookTable = Hooks[ name ]

	if HookTable then
		local a, b, c, d, e, f
		for k=1, #HookTable do
			v = HookTable[ k ]
			if not v then
				-- Nothing
			else
				-- Call hook function
				if isstring( v.name ) then
					a, b, c, d, e, f = v.fn( ... )
				else
					-- Assume it is an entity
					if IsValid( v.name ) then
						a, b, c, d, e, f = v.fn( v.name, ... )
					else
						table.insert( resort, name )
					end
				end

				if a ~= nil then
					-- Allow hooks to override return values if it's within the limits (-20 and 20 are read only)
					if v.priority > -20 and v.priority < 20 then
						return a, b, c, d, e, f
					end
				end
			end
		end
	end

	if not gm then return end
	
	local GamemodeFunction = gm[ name ]
	if not GamemodeFunction then
		return
	end

	-- This calls the actual gamemode function - after all the hooks have had chance to override
	return GamemodeFunction( gm, ... )
end

-- Bring in all the old hooks
for event_name, t in pairs( OldHooks ) do
	for name, func in pairs( t ) do
		Add( event_name, name, func, 0 )
	end
end


--[[
local failed = false
local shouldFail = false
local i, t

-- Since the correctness of this file is so important, we've made a little test suite
local function appendGenerator( n )
	return function( t )
		table.insert( t, n )
	end
end

local function returnRange()
	return 1, 2, 3, 4, 5, 6, 7, 8
end

local function noop()
end

local function err()
	if shouldFail then
		error( "this error is normal!" )
	else
		error( "this error is bad!" )
		failed = true
	end
end

local function doTests( ply, cmd, argv )
	print( "Being run on client: " .. tostring( CLIENT ) )

	-- First make sure there's no return value leakage...
	Add( "LeakageA", "a", returnRange )
	t = { Call( "LeakageA", _ ) }
	assert( #t == 8 )
	for k, v in pairs( t ) do
		assert( k == v )
	end

	Add( "LeakageB", "a", noop )
	t = { Call( "LeakageB", _ ) }
	assert( #t == 0 )

	-- Now let's make sure errors are handled correctly...
	shouldFail = true
	Add( "ErrCheck", "a", noop )
	Add( "ErrCheck", "b", err )
	Add( "ErrCheck", "c", noop )
	Add( "ErrCheck", "d", returnRange )
	t = { Call( "ErrCheck", _ ) }
	assert( #t == 8 )
	assert( #Hooks.ErrCheck == 3 and Hooks.ErrCheck[4] == nil ) -- Should have been reduced so that the 'b' got removed

	shouldFail = false
	t = { Call( "ErrCheck", _ ) }
	assert( #t == 8 )

	-- Check for override
	Add( "ErrCheck", "d", noop, 19 ) -- Different priority, same name should still override
	t = { Call( "ErrCheck", _ ) }
	assert( #t == 0 )

	-- Check for order and readonly'ness...
	Add( "Order", "n20a", returnRange, -20 )
	Add( "Order", "a", appendGenerator( 5 ) )
	Add( "Order", "n20c", appendGenerator( 3 ), -20 ) -- Should be alphabetized
	Add( "Order", "n20a", appendGenerator( 1 ), -20 )
	Add( "Order", "n20b", appendGenerator( 2 ), -20 )
	Add( "Order", "n10a", appendGenerator( 4 ), -10 )
	Add( "Order", "10a", appendGenerator( 6 ), 10 )
	Add( "Order", "20a", returnRange, 20 )
	Add( "Order", "20aa", appendGenerator( 7 ), 20 )

	t = {}
	Call( "Order", _, t )
	assert( #t == 7 )
	for k, v in pairs( t ) do
		assert( k == v )
	end

	if failed then
		print( "Tests failed!" )
	else
		print( "All tests passed!" )
	end
end

concommand.Add( "run_hook_tests", doTests )
--]]


gamemodes/darkrp/gamemode/modules/police/sv_init.lua



local plyMeta = FindMetaTable("Player")
local finishWarrantRequest
local arrestedPlayers = {}

/*---------------------------------------------------------------------------
Interface functions
---------------------------------------------------------------------------*/
function plyMeta:warrant(warranter, reason)
	if self.warranted then return end
	hook.Call("playerWarranted", GAMEMODE, self, warranter, reason)

	self.warranted = true
	timer.Simple(GAMEMODE.Config.searchtime, function()
		if not IsValid(self) then return end
		self:unWarrant(warranter)
	end)

	local warranterNick = IsValid(warranter) and warranter:Nick() or DarkRP.getPhrase("disconnected_player")
	local centerMessage = DarkRP.getPhrase("warrant_approved", self:Nick(), reason, warranterNick)
	local printMessage = DarkRP.getPhrase("warrant_ordered", warranterNick, self:Nick(), reason)

	for a, b in pairs(player.GetAll()) do
		b:PrintMessage(HUD_PRINTCENTER, centerMessage)
		b:PrintMessage(HUD_PRINTCONSOLE, printMessage)
	end

	DarkRP.notify(warranter, 0, 4, DarkRP.getPhrase("warrant_approved2"))
end

function plyMeta:unWarrant(unwarranter)
	if not self.warranted then return end

	hook.Call("playerUnWarranted", GAMEMODE, self, unwarranter)

	self.warranted = false
	DarkRP.notify(unwarranter, 2, 4, DarkRP.getPhrase("warrant_expired", self:Nick()))
end

function plyMeta:requestWarrant(suspect, actor, reason)
	local question = DarkRP.getPhrase("warrant_request", actor:Nick(), suspect:Nick(), reason)
	DarkRP.createQuestion(question, suspect:EntIndex() .. "warrant", self, 40, finishWarrantRequest, actor, suspect, reason)
end

function plyMeta:wanted(actor, reason)
	hook.Call("playerWanted", DarkRP.hooks, self, actor, reason)

	self:setDarkRPVar("wanted", true)
	self:setDarkRPVar("wantedReason", reason)

	local actorNick = IsValid(actor) and actor:Nick() or DarkRP.getPhrase("disconnected_player")
	local centerMessage = DarkRP.getPhrase("wanted_by_police", self:Nick(), reason, actorNick)
	local printMessage = DarkRP.getPhrase("wanted_by_police_print", actorNick, self:Nick(), reason)

	for _, ply in pairs(player.GetAll()) do
		ply:PrintMessage(HUD_PRINTCENTER, centerMessage)
		ply:PrintMessage(HUD_PRINTCONSOLE, printMessage)
	end

	timer.Create(self:UniqueID() .. " wantedtimer", GAMEMODE.Config.wantedtime, 1, function()
		if not IsValid(self) then return end
		self:unWanted()
	end)
end

function plyMeta:unWanted(actor)
	hook.Call("playerUnWanted", GAMEMODE, self, actor)
	self:setDarkRPVar("wanted", nil)
	self:setDarkRPVar("wantedReason", nil)

	local expiredMessage = IsValid(actor) and DarkRP.getPhrase("wanted_revoked", self:Nick(), actor:Nick() or "") or
		DarkRP.getPhrase("wanted_expired", self:Nick())

	for _, ply in pairs(player.GetAll()) do
		ply:PrintMessage(HUD_PRINTCENTER, expiredMessage)
		ply:PrintMessage(HUD_PRINTCONSOLE, expiredMessage)
	end
	timer.Destroy(self:UniqueID() .. " wantedtimer")
end

function plyMeta:arrest(time, arrester)
	time = time or GAMEMODE.Config.jailtimer or 120

	hook.Call("playerArrested", DarkRP.hooks, self, time, arrester)
	if self:InVehicle() then self:ExitVehicle() end
	self:setDarkRPVar("Arrested", true)
	arrestedPlayers[self:SteamID()] = true

	-- Always get sent to jail when Arrest() is called, even when already under arrest
	if GAMEMODE.Config.teletojail and DarkRP.jailPosCount() ~= 0 then
		self:Spawn()
	end
end

function plyMeta:unArrest(unarrester)
	if not self:isArrested() then return end

	self:setDarkRPVar("Arrested", nil)
	arrestedPlayers[self:SteamID()] = nil
	hook.Call("playerUnArrested", DarkRP.hooks, self, unarrester)
end

/*---------------------------------------------------------------------------
Chat commands
---------------------------------------------------------------------------*/
local function CombineRequest(ply, args)
	if args == "" then
		DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
		return ""
	end
	local t = ply:Team()

	local DoSay = function(text)
		if text == "" then
			DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
			return
		end
		for k, v in pairs(player.GetAll()) do
			if v:isCP() or v == ply then
				DarkRP.talkToPerson(v, team.GetColor(ply:Team()), DarkRP.getPhrase("request") ..ply:Nick(), Color(255,0,0,255), text, ply)
			end
		end
	end
	return args, DoSay
end
DarkRP.defineChatCommand("cr", CombineRequest, 1.5)

local function warrantCommand(ply, args)
	local expl = string.Explode(" ", args or "")
	local target = DarkRP.findPlayer(expl[1])
	local reason = table.concat(expl, " ", 2)

	local canRequest, message = hook.Call("canRequestWarrant", DarkRP.hooks, target, ply, reason)
	if not canRequest then
		DarkRP.notify(ply, 1, 4, message)
		return ""
	end

	if not RPExtraTeams[ply:Team()] or not RPExtraTeams[ply:Team()].mayor then -- No need to search through all the teams if the player is a mayor
		local mayors = {}

		for k,v in pairs(RPExtraTeams) do
			if v.mayor then
				table.Add(mayors, team.GetPlayers(k))
			end
		end

		if #mayors > 0 then -- Request a warrant if there's a mayor
			local mayor = table.Random(mayors)
			mayor:requestWarrant(target, ply, reason)
			DarkRP.notify(ply, 0, 4, DarkRP.getPhrase("warrant_request2", mayor:Nick()))
			return ""
		end
	end

	target:warrant(ply, reason)

	return ""
end
DarkRP.defineChatCommand("warrant", warrantCommand)

local function wantedCommand(ply, args)
	local expl = string.Explode(" ", args or "")
	local target = DarkRP.findPlayer(expl[1])
	local reason = table.concat(expl, " ", 2)

	local canWanted, message = hook.Call("canWanted", DarkRP.hooks, target, ply, reason)
	if not canWanted then
		DarkRP.notify(ply, 1, 4, message)
		return ""
	end

	target:wanted(ply, reason)

	return ""
end
DarkRP.defineChatCommand("wanted", wantedCommand)

local function unwantedCommand(ply, args)
	local target = DarkRP.findPlayer(args)

	local canUnwant, message = hook.Call("canUnwant", DarkRP.hooks, target, ply)
	if not canUnwant then
		DarkRP.notify(ply, 1, 4, message)
		return ""
	end

	target:unWanted(ply)

	return ""
end
DarkRP.defineChatCommand("unwanted", unwantedCommand)

/*---------------------------------------------------------------------------
Admin commands
---------------------------------------------------------------------------*/
local function ccArrest(ply, cmd, args)
	if ply:EntIndex() ~= 0 and not ply:hasDarkRPPrivilege("rp_commands") then
		ply:PrintMessage(2, DarkRP.getPhrase("need_admin", "rp_arrest"))
		return
	end

	if not args or not args[1] then
		if ply:EntIndex() == 0 then
			print(DarkRP.getPhrase("invalid_x", DarkRP.getPhrase("arguments"), ""))
		else
			ply:PrintMessage(2, DarkRP.getPhrase("invalid_x", DarkRP.getPhrase("arguments"), ""))
		end
		return
	end

	if DarkRP.jailPosCount() == 0 then
		if ply:EntIndex() == 0 then
			print(DarkRP.getPhrase("no_jail_pos"))
		else
			ply:PrintMessage(2, DarkRP.getPhrase("no_jail_pos"))
		end
		return
	end

	local targets = DarkRP.findPlayers(args[1])

	if not targets then
		if ply:EntIndex() == 0 then
			print(DarkRP.getPhrase("could_not_find", tostring(args[1])))
		else
			ply:PrintMessage(2, DarkRP.getPhrase("could_not_find", tostring(args[1])))
		end

		return
	end

	for k, target in pairs(targets) do
		local length = tonumber(args[2])
		if length then
			target:arrest(length, ply)
		else
			target:arrest(nil, ply)
		end

		if ply:EntIndex() == 0 then
			DarkRP.log("Console force-arrested "..target:SteamName(), Color(0, 255, 255))
		else
			DarkRP.log(ply:Nick().." ("..ply:SteamID()..") force-arrested "..target:SteamName(), Color(0, 255, 255))
		end
	end
end
concommand.Add("rp_arrest", ccArrest)

local function ccUnarrest(ply, cmd, args)
	if ply:EntIndex() ~= 0 and not ply:hasDarkRPPrivilege("rp_commands") then
		ply:PrintMessage(2, DarkRP.getPhrase("need_admin", "rp_unarrest"))
		return
	end

	if not args or not args[1] then
		if ply:EntIndex() == 0 then
			print(DarkRP.getPhrase("invalid_x", DarkRP.getPhrase("arguments"), ""))
		else
			ply:PrintMessage(2, DarkRP.getPhrase("invalid_x", DarkRP.getPhrase("arguments"), ""))
		end
		return
	end

	local targets = DarkRP.findPlayers(args[1])

	if not targets then
		if ply:EntIndex() == 0 then
			print(DarkRP.getPhrase("could_not_find", tostring(args[1])))
		else
			ply:PrintMessage(2, DarkRP.getPhrase("could_not_find", tostring(args[1])))
		end

		return
	end

	for _, target in pairs(targets) do
		target:unArrest(ply)
		if not target:Alive() then target:Spawn() end

		if ply:EntIndex() == 0 then
			DarkRP.log("Console force-unarrested "..target:SteamName(), Color(0, 255, 255))
		else
			DarkRP.log(ply:Nick().." ("..ply:SteamID()..") force-unarrested "..target:SteamName(), Color(0, 255, 255))
		end
	end
end
concommand.Add("rp_unarrest", ccUnarrest)

/*---------------------------------------------------------------------------
Callback functions
---------------------------------------------------------------------------*/
function finishWarrantRequest(choice, mayor, initiator, suspect, reason)
	if not tobool(choice) then
		DarkRP.notify(initiator, 1, 4, DarkRP.getPhrase("warrant_denied", mayor:Nick()))
		return
	end

	suspect:warrant(initiator, reason)
end

/*---------------------------------------------------------------------------
Hooks
---------------------------------------------------------------------------*/
function DarkRP.hooks:playerArrested(ply, time, arrester)
	if ply:isWanted() then ply:unWanted(arrester) end
	ply:unWarrant(arrester)
	ply:setDarkRPVar("HasGunlicense", nil)

	-- UpdatePlayerSpeed won't work here as the "Arrested" DarkRPVar is set AFTER this hook
	GAMEMODE:SetPlayerSpeed(ply, GAMEMODE.Config.arrestspeed, GAMEMODE.Config.arrestspeed)
	ply:StripWeapons()

	if ply:isArrested() then return end -- hasn't been arrested before

	ply:PrintMessage(HUD_PRINTCENTER, DarkRP.getPhrase("youre_arrested", time))
	for k, v in pairs(player.GetAll()) do
		if v == ply then continue end
		v:PrintMessage(HUD_PRINTCENTER, DarkRP.getPhrase("hes_arrested", ply:Name(), time))
	end

	local steamID = ply:SteamID()
	timer.Create(ply:UniqueID() .. "jailtimer", time, 1, function()
		if IsValid(ply) then ply:unArrest() end
		arrestedPlayers[steamID] = nil
	end)
	umsg.Start("GotArrested", ply)
		umsg.Float(time)
	umsg.End()
end

function DarkRP.hooks:playerUnArrested(ply, actor)
	if ply.Sleeping and GAMEMODE.KnockoutToggle then
		DarkRP.toggleSleep(ply, "force")
	end

	-- "Arrested" DarkRPVar is set to false BEFORE this hook however, so it is safe here.
	hook.Call("UpdatePlayerSpeed", GAMEMODE, ply)
	gamemode.Call("PlayerLoadout", ply)
	if GAMEMODE.Config.telefromjail then
		local ent, pos = GAMEMODE:PlayerSelectSpawn(ply)
		timer.Simple(0, function() if IsValid(ply) then ply:SetPos(pos or ent:GetPos()) end end) -- workaround for SetPos in weapon event bug
	end

	timer.Destroy(ply:UniqueID() .. "jailtimer")
	DarkRP.notifyAll(0, 4, DarkRP.getPhrase("hes_unarrested", ply:Name()))
end

hook.Add("PlayerInitialSpawn", "Arrested", function(ply)
	if not arrestedPlayers[ply:SteamID()] then return end
	local time = GAMEMODE.Config.jailtimer
	ply:arrest(time)
	DarkRP.notify(ply, 0, 5, DarkRP.getPhrase("jail_punishment", time))
end)


lua/includes/modules/concommand.lua




-- Please don't edit this file!

-- Redirect call from the engine to the module (todo: change engine)
function InjectConsoleCommand( player, command, arguments, args )
	return concommand.Run( player, command, arguments, args )
end


function InjectCommandAutocomplete( command, arguments )
	return concommand.AutoComplete( command, arguments )
end



local AddConsoleCommand = AddConsoleCommand
local string = string


--[[---------------------------------------------------------
   Name: concommand
   Desc: A module to take care of the registration and calling
         of Lua console commands.
-----------------------------------------------------------]]
module("concommand")

local CommandList 	= {}
local CompleteList 	= {}

--[[---------------------------------------------------------
   Name: concommand.GetTable( )
   Desc: Returns the table of console commands and auto complete
-----------------------------------------------------------]]
function GetTable()
	return CommandList, CompleteList
end

--[[---------------------------------------------------------
   Name: concommand.Add( name, func, completefunc )
   Desc: Register a new console command
-----------------------------------------------------------]]
function Add( name, func, completefunc, help, flags )
	local LowerName = string.lower( name )
	CommandList[ LowerName ] = func
	CompleteList[ LowerName ] = completefunc
	AddConsoleCommand( name, help, flags )
end

--[[---------------------------------------------------------
   Name: concommand.Remove( name )
   Desc: Removes a console command
-----------------------------------------------------------]]
function Remove( name )
	local LowerName = string.lower( name )
	CommandList[ LowerName ] = nil
	CompleteList[ LowerName ] = nil
end


--[[---------------------------------------------------------
   Name: concommand.Run( )
   Desc: Called by the engine when an unknown console command is run
-----------------------------------------------------------]]
function Run( player, command, arguments, args )

	local LowerCommand = string.lower( command )

	if ( CommandList[ LowerCommand ] != nil ) then
		CommandList[ LowerCommand ]( player, command, arguments, args )
		return true
	end

	if ( player:IsValid() ) then
		player:ChatPrint( "Unknown Command: '" .. command .. "'
" )
	end
	
	return false;
end

--[[---------------------------------------------------------
   Name: concommand.AutoComplete( )
   Desc: Returns a table for the autocompletion
-----------------------------------------------------------]]
function AutoComplete( command, arguments )

	local LowerCommand = string.lower( command )

	if ( CompleteList[ LowerCommand ] != nil ) then
		return CompleteList[ LowerCommand ]( command, arguments )
	end
	
end


I really don’t know what is wrong and I never even touched these files. I know it’s a lot but I would appreciate the help,

Can i ask, why are you using core DarkRP files & not using the DarkRPmodification addon?

I’m not, I always use DarkRPmodification.

So why is this file in the darkrp gamemode folder?
gamemodes/darkrp/entities/entities/ent_unarrestbox/shared.lua