Initial commit

This commit is contained in:
pavetr
2026-03-15 14:54:49 +03:00
commit 64f8029c06
4027 changed files with 254888 additions and 0 deletions

View File

@@ -0,0 +1,215 @@
local plyMeta = FindMetaTable("Player")
--[[---------------------------------------------------------------------------
Interface functions
---------------------------------------------------------------------------]]
function plyMeta:isArrested()
return self:getDarkRPVar("Arrested")
end
function plyMeta:isWanted()
return self:getDarkRPVar("wanted")
end
function plyMeta:getWantedReason()
return self:getDarkRPVar("wantedReason")
end
function plyMeta:isCP()
return GAMEMODE.CivilProtection and GAMEMODE.CivilProtection[self:Team()] or false
end
plyMeta.isMayor = fn.Compose{fn.Curry(fn.GetValue, 2)("mayor"), plyMeta.getJobTable}
plyMeta.isChief = fn.Compose{fn.Curry(fn.GetValue, 2)("chief"), plyMeta.getJobTable}
--[[---------------------------------------------------------------------------
Hooks
---------------------------------------------------------------------------]]
function DarkRP.hooks:canRequestWarrant(target, actor, reason)
if not IsValid(target) then return false, DarkRP.getPhrase("suspect_doesnt_exist") end
if not reason or string.len(reason) == 0 then return false, DarkRP.getPhrase("vote_specify_reason") end
if string.len(reason) > 200 then return false, DarkRP.getPhrase("too_long") end
if not IsValid(actor) then return false, DarkRP.getPhrase("actor_doesnt_exist") end
if not actor:Alive() then return false, DarkRP.getPhrase("must_be_alive_to_do_x", DarkRP.getPhrase("get_a_warrant")) end
if target.warranted then return false, DarkRP.getPhrase("already_a_warrant") end
if not actor:isCP() then return false, DarkRP.getPhrase("incorrect_job", DarkRP.getPhrase("get_a_warrant")) end
return true
end
function DarkRP.hooks:canRemoveWarrant(target, actor)
if not IsValid(target) then return false, DarkRP.getPhrase("suspect_doesnt_exist") end
if not IsValid(actor) then return false, DarkRP.getPhrase("actor_doesnt_exist") end
if not actor:Alive() then return false, DarkRP.getPhrase("must_be_alive_to_do_x", DarkRP.getPhrase("remove_a_warrant")) end
if not target.warranted then return false, DarkRP.getPhrase("not_warranted") end
if not actor:isCP() then return false, DarkRP.getPhrase("incorrect_job", DarkRP.getPhrase("remove_a_warrant")) end
if actor:isArrested() then return false, DarkRP.getPhrase("unable", DarkRP.getPhrase("remove_a_warrant"), "") end
return true
end
function DarkRP.hooks:canWanted(target, actor, reason)
if not IsValid(target) then return false, DarkRP.getPhrase("suspect_doesnt_exist") end
if not reason or string.len(reason) == 0 then return false, DarkRP.getPhrase("vote_specify_reason") end
if string.len(reason) > 200 then return false, DarkRP.getPhrase("too_long") end
if not IsValid(actor) then return false, DarkRP.getPhrase("actor_doesnt_exist") end
if not actor:Alive() then return false, DarkRP.getPhrase("must_be_alive_to_do_x", DarkRP.getPhrase("make_someone_wanted")) end
if not actor:isCP() then return false, DarkRP.getPhrase("incorrect_job", DarkRP.getPhrase("make_someone_wanted")) end
if target:isWanted() then return false, DarkRP.getPhrase("already_wanted") end
if not target:Alive() then return false, DarkRP.getPhrase("suspect_must_be_alive_to_do_x", DarkRP.getPhrase("make_someone_wanted")) end
if target:isArrested() then return false, DarkRP.getPhrase("suspect_already_arrested") end
return true
end
function DarkRP.hooks:canUnwant(target, actor)
if not IsValid(target) then return false, DarkRP.getPhrase("suspect_doesnt_exist") end
if not IsValid(actor) then return false, DarkRP.getPhrase("actor_doesnt_exist") end
if not actor:Alive() then return false, DarkRP.getPhrase("must_be_alive_to_do_x", DarkRP.getPhrase("remove_wanted_status")) end
if not actor:isCP() then return false, DarkRP.getPhrase("incorrect_job", DarkRP.getPhrase("remove_wanted_status")) end
if not target:isWanted() then return false, DarkRP.getPhrase("not_wanted") end
if not target:Alive() then return false, DarkRP.getPhrase("suspect_must_be_alive_to_do_x", DarkRP.getPhrase("remove_wanted_status")) end
return true
end
--[[---------------------------------------------------------------------------
Chat commands
---------------------------------------------------------------------------]]
for _, cmd in ipairs{"cr", "911", "999", "112", "000"} do
DarkRP.declareChatCommand{
command = cmd,
description = "Cry for help, the police will come (hopefully)!",
delay = 1.5
}
end
DarkRP.declareChatCommand{
command = "warrant",
description = "Get a search warrant for a certain player. With this warrant you can search their house.",
delay = 1.5,
condition = fn.FAnd{plyMeta.Alive, plyMeta.isCP, fn.Compose{fn.Not, plyMeta.isArrested}},
tableArgs = true
}
DarkRP.declareChatCommand{
command = "unwarrant",
description = "Remove a search warrant for a certain player. With a warrant you can search their house.",
delay = 1.5,
condition = fn.FAnd{plyMeta.Alive, plyMeta.isCP, fn.Compose{fn.Not, plyMeta.isArrested}},
tableArgs = true
}
DarkRP.declareChatCommand{
command = "wanted",
description = "Make a player wanted. This is needed to get them arrested.",
delay = 1.5,
condition = fn.FAnd{plyMeta.Alive, plyMeta.isCP, fn.Compose{fn.Not, plyMeta.isArrested}},
tableArgs = true
}
DarkRP.declareChatCommand{
command = "unwanted",
description = "Remove a player's wanted status.",
delay = 1.5,
condition = fn.FAnd{plyMeta.Alive, plyMeta.isCP, fn.Compose{fn.Not, plyMeta.isArrested}}
}
DarkRP.declareChatCommand{
command = "agenda",
description = "Set the agenda.",
delay = 1.5,
condition = fn.Compose{fn.Not, fn.Curry(fn.Eq, 2)(nil), plyMeta.getAgenda}
}
DarkRP.declareChatCommand{
command = "addagenda",
description = "Add a line of text to the agenda.",
delay = 1.5,
condition = fn.Compose{fn.Not, fn.Curry(fn.Eq, 2)(nil), plyMeta.getAgenda}
}
DarkRP.declareChatCommand{
command = "lottery",
description = "Start a lottery.",
delay = 1.5,
condition = plyMeta.isMayor
}
DarkRP.declareChatCommand{
command = "lockdown",
description = "Start a lockdown. Everyone will have to stay inside.",
delay = 1.5,
condition = plyMeta.isMayor
}
DarkRP.declareChatCommand{
command = "unlockdown",
description = "Stop a lockdown.",
delay = 1.5,
condition = plyMeta.isMayor
}
DarkRP.declareChatCommand{
command = "arrest",
description = "Forcefully arrest a player.",
delay = 0.5,
tableArgs = true
}
DarkRP.declareChatCommand{
command = "unarrest",
description = "Forcefully unarrest a player.",
delay = 0.5,
tableArgs = true
}
local noMayorExists = fn.Compose{fn.Null, fn.Curry(fn.Filter, 2)(plyMeta.isMayor), player.GetAll}
local noChiefExists = fn.Compose{fn.Null, fn.Curry(fn.Filter, 2)(plyMeta.isChief), player.GetAll}
DarkRP.declareChatCommand{
command = "requestlicense",
description = "Request a gun license.",
delay = 1.5,
condition = fn.FAnd {
fn.FOr {
fn.Curry(fn.Not, 2)(noMayorExists),
fn.Curry(fn.Not, 2)(noChiefExists),
fn.Compose{fn.Not, fn.Null, fn.Curry(fn.Filter, 2)(plyMeta.isCP), player.GetAll}
},
fn.Compose{fn.Not, fn.Curry(fn.Flip(plyMeta.getDarkRPVar), 2)("HasGunlicense")},
fn.Compose{fn.Not, fn.Curry(fn.GetValue, 2)("LicenseRequested")}
}
}
DarkRP.declareChatCommand{
command = "givelicense",
description = "Give someone a gun license",
delay = 1.5,
condition = fn.FOr{
plyMeta.isMayor, -- Mayors can hand out licenses
fn.FAnd{plyMeta.isChief, noMayorExists}, -- Chiefs can if there is no mayor
fn.FAnd{plyMeta.isCP, noChiefExists, noMayorExists} -- CP's can if there are no chiefs nor mayors
}
}
DarkRP.declareChatCommand{
command = "demotelicense",
description = "Start a vote to get someone's license revoked.",
delay = 1.5,
tableArgs = true
}
DarkRP.declareChatCommand{
command = "setlicense",
description = "Forcefully give a player a license.",
delay = 1.5
}
DarkRP.declareChatCommand{
command = "unsetlicense",
description = "Forcefully revoke a player's license.",
delay = 1.5
}

View File

@@ -0,0 +1,231 @@
DarkRP.PLAYER.isWanted = DarkRP.stub{
name = "isWanted",
description = "Whether this player is wanted",
parameters = {
},
returns = {
{
name = "answer",
description = "Whether this player is wanted",
type = "boolean"
}
},
metatable = DarkRP.PLAYER
}
DarkRP.PLAYER.getWantedReason = DarkRP.stub{
name = "getWantedReason",
description = "Get the reason why someone is wanted",
parameters = {
},
returns = {
{
name = "answer",
description = "The reason",
type = "string"
}
},
metatable = DarkRP.PLAYER
}
DarkRP.PLAYER.isArrested = DarkRP.stub{
name = "isArrested",
description = "Whether this player is arrested",
parameters = {
},
returns = {
{
name = "answer",
description = "Whether this player is arrested",
type = "boolean"
}
},
metatable = DarkRP.PLAYER
}
DarkRP.PLAYER.isCP = DarkRP.stub{
name = "isCP",
description = "Whether this player is part of the police force (mayor, cp, chief).",
parameters = {
},
returns = {
{
name = "answer",
description = "Whether this player is part of the police force.",
type = "boolean"
}
},
metatable = DarkRP.PLAYER
}
DarkRP.PLAYER.isMayor = DarkRP.stub{
name = "isMayor",
description = "Whether this player is a mayor.",
parameters = {
},
returns = {
{
name = "answer",
description = "Whether this player is a mayor.",
type = "boolean"
}
},
metatable = DarkRP.PLAYER
}
DarkRP.PLAYER.isChief = DarkRP.stub{
name = "isChief",
description = "Whether this player is a Chief.",
parameters = {
},
returns = {
{
name = "answer",
description = "Whether this player is a Chief.",
type = "boolean"
}
},
metatable = DarkRP.PLAYER
}
DarkRP.hookStub{
name = "canRequestWarrant",
description = "Whether someone can request a search warrant.",
parameters = {
{
name = "target",
description = "The player to get the search warrant for",
type = "Player"
},
{
name = "actor",
description = "The player requesting the warrant",
type = "Player"
},
{
name = "reason",
description = "The reason for the search warrant",
type = "Player"
}
},
returns = {
{
name = "canRequest",
description = "A yes or no as to whether the search warrant can be requested",
type = "boolean"
},
{
name = "message",
description = "The message that is shown when it can't",
type = "string"
}
}
}
DarkRP.hookStub{
name = "canWanted",
description = "Whether someone can make a player wanted",
parameters = {
{
name = "target",
description = "The player to make wanted by the police",
type = "Player"
},
{
name = "actor",
description = "The player requesting the wanted status",
type = "Player"
},
{
name = "reason",
description = "The reason",
type = "Player"
}
},
returns = {
{
name = "canRequest",
description = "A yes or no as to whether the wanted can be requested",
type = "boolean"
},
{
name = "message",
description = "The message that is shown when it can't",
type = "string"
}
}
}
DarkRP.hookStub{
name = "canUnwant",
description = "Whether someone can remove the wanted status from a player",
parameters = {
{
name = "target",
description = "The player to make wanted by the police",
type = "Player"
},
{
name = "actor",
description = "The player requesting the wanted status",
type = "Player"
}
},
returns = {
{
name = "canUnwant",
description = "A yes or no answer",
type = "boolean"
},
{
name = "message",
description = "The message that is shown when the answer is no",
type = "string"
}
}
}
DarkRP.hookStub{
name = "lockdownStarted",
description = "When a lockdown has started.",
parameters = {
{
name = "actor",
description = "The player who started the lockdown. Note: Can be the world entitity.",
type = "Player"
}
},
returns = {}
}
DarkRP.hookStub{
name = "lockdownEnded",
description = "When a lockdown has ended.",
parameters = {
{
name = "actor",
description = "The player who ended the lockdown. Note: Can be the world entitity.",
type = "Player"
}
},
returns = {}
}
DarkRP.hookStub{
name = "playerGotLicense",
description = "When a player got a gun license",
parameters = {
{
name = "target",
description = "The player who got the license",
type = "Player"
},
{
name = "actor",
description = "The player who gave the license",
type = "Player"
}
},
returns = {}
}

View File

@@ -0,0 +1,430 @@
local function updateAgenda(ply, agenda, text)
local txt = hook.Run("agendaUpdated", ply, agenda, text)
agenda.text = txt or text
local phrase = DarkRP.getPhrase("agenda_updated")
for _, v in ipairs(player.GetAll()) do
if v:getAgendaTable() ~= agenda then continue end
v:setSelfDarkRPVar("agenda", agenda.text)
DarkRP.notify(v, 2, 4, phrase)
end
end
local function CreateAgenda(ply, args)
local agenda = ply:getAgendaTable()
if not agenda or not agenda.ManagersByKey[ply:Team()] then
DarkRP.notify(ply, 1, 6, DarkRP.getPhrase("incorrect_job", DarkRP.getPhrase("agenda")))
return ""
end
updateAgenda(ply, agenda, args)
return ""
end
DarkRP.defineChatCommand("agenda", CreateAgenda, 0.1)
local function addAgenda(ply, args)
local agenda = ply:getAgendaTable()
if not agenda or not agenda.ManagersByKey[ply:Team()] then
DarkRP.notify(ply, 1, 6, DarkRP.getPhrase("incorrect_job", DarkRP.getPhrase("agenda")))
return ""
end
agenda.text = agenda.text or ""
args = args or ""
updateAgenda(ply, agenda, agenda.text .. '\n' .. args)
return ""
end
DarkRP.defineChatCommand("addagenda", addAgenda, 0.1)
--[[---------------------------------------------------------
Mayor stuff
---------------------------------------------------------]]
local LotteryPeople = {}
local LotteryON = false
local LotteryAmount = 0
local CanLottery = CurTime()
local function EnterLottery(answer, ent, initiator, target, TimeIsUp)
local hasEntered = table.HasValue(LotteryPeople, target)
if tobool(answer) and not hasEntered then
if not target:canAfford(LotteryAmount) then
DarkRP.notify(target, 1, 4, DarkRP.getPhrase("cant_afford", DarkRP.getPhrase("lottery")))
return
end
table.insert(LotteryPeople, target)
target:addMoney(-LotteryAmount)
DarkRP.notify(target, 0,4, DarkRP.getPhrase("lottery_entered", DarkRP.formatMoney(LotteryAmount)))
hook.Run("playerEnteredLottery", target)
elseif IsValid(target) and answer ~= nil and not hasEntered then
DarkRP.notify(target, 1,4, DarkRP.getPhrase("lottery_not_entered", target:Nick()))
end
if TimeIsUp then
LotteryON = false
CanLottery = CurTime() + 60
for i = #LotteryPeople, 1, -1 do
if not IsValid(LotteryPeople[i]) then table.remove(LotteryPeople, i) end
end
if table.IsEmpty(LotteryPeople) then
DarkRP.notifyAll(1, 4, DarkRP.getPhrase("lottery_noone_entered"))
hook.Run("lotteryEnded", LotteryPeople)
return
end
local chosen = LotteryPeople[math.random(1, #LotteryPeople)]
local amt = #LotteryPeople * LotteryAmount
hook.Run("lotteryEnded", LotteryPeople, chosen, amt)
chosen:addMoney(amt)
DarkRP.notifyAll(0, 10, DarkRP.getPhrase("lottery_won", chosen:Nick(), DarkRP.formatMoney(amt)))
end
end
local function DoLottery(ply, amount)
if not ply:isMayor() then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("incorrect_job", "/lottery"))
return ""
end
if not GAMEMODE.Config.lottery then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("disabled", "/lottery", ""))
return ""
end
if player.GetCount() <= 2 then
DarkRP.notify(ply, 1, 6, DarkRP.getPhrase("too_few_players_for_lottery", 2))
return ""
end
if LotteryON then
DarkRP.notify(ply, 1, 6, DarkRP.getPhrase("lottery_ongoing"))
return ""
end
if CanLottery > CurTime() then
DarkRP.notify(ply, 1, 5, DarkRP.getPhrase("have_to_wait", tostring(CanLottery - CurTime()), "/lottery"))
return ""
end
amount = DarkRP.toInt(amount)
if not amount then
DarkRP.notify(ply, 1, 5, DarkRP.getPhrase("lottery_please_specify_an_entry_cost", DarkRP.formatMoney(GAMEMODE.Config.minlotterycost), DarkRP.formatMoney(GAMEMODE.Config.maxlotterycost)))
return ""
end
LotteryAmount = math.Clamp(amount, GAMEMODE.Config.minlotterycost, GAMEMODE.Config.maxlotterycost)
hook.Run("lotteryStarted", ply, LotteryAmount)
LotteryON = true
LotteryPeople = {}
local phrase = DarkRP.getPhrase("lottery_has_started", DarkRP.formatMoney(LotteryAmount))
for k, v in ipairs(player.GetAll()) do
if v ~= ply then
DarkRP.createQuestion(phrase, "lottery_" .. tostring(k), v, 30, EnterLottery, ply, v)
end
end
timer.Create("Lottery", 30, 1, function() EnterLottery(nil, nil, nil, nil, true) end)
return ""
end
DarkRP.defineChatCommand("lottery", DoLottery, 1)
local lastLockdown = -math.huge
function DarkRP.lockdown(ply)
local show = ply:EntIndex() == 0 and print or fp{DarkRP.notify, ply, 1, 4}
if GetGlobalBool("DarkRP_LockDown") then
show(DarkRP.getPhrase("unable", "/lockdown", DarkRP.getPhrase("stop_lockdown")))
return ""
end
if ply:EntIndex() ~= 0 and not ply:isMayor() then
show(DarkRP.getPhrase("incorrect_job", "/lockdown", ""))
return ""
end
if not GAMEMODE.Config.lockdown then
show(ply, 1, 4, DarkRP.getPhrase("disabled", "lockdown", ""))
return ""
end
if lastLockdown > CurTime() - GAMEMODE.Config.lockdowndelay then
show(DarkRP.getPhrase("wait_with_that"))
return ""
end
for _, v in ipairs(player.GetAll()) do
v:ConCommand("play " .. GAMEMODE.Config.lockdownsound .. "\n")
end
DarkRP.printMessageAll(HUD_PRINTTALK, DarkRP.getPhrase("lockdown_started"))
SetGlobalBool("DarkRP_LockDown", true)
DarkRP.notifyAll(0, 3, DarkRP.getPhrase("lockdown_started"))
hook.Run("lockdownStarted", ply)
return ""
end
DarkRP.defineChatCommand("lockdown", DarkRP.lockdown)
function DarkRP.unLockdown(ply)
local show = ply:EntIndex() == 0 and print or fp{DarkRP.notify, ply, 1, 4}
if not GetGlobalBool("DarkRP_LockDown") then
show(DarkRP.getPhrase("unable", "/unlockdown", DarkRP.getPhrase("lockdown_ended")))
return ""
end
if ply:EntIndex() ~= 0 and not ply:isMayor() then
show(DarkRP.getPhrase("incorrect_job", "/unlockdown", ""))
return ""
end
DarkRP.printMessageAll(HUD_PRINTTALK, DarkRP.getPhrase("lockdown_ended"))
DarkRP.notifyAll(0, 3, DarkRP.getPhrase("lockdown_ended"))
SetGlobalBool("DarkRP_LockDown", false)
lastLockdown = CurTime()
hook.Run("lockdownEnded", ply)
return ""
end
DarkRP.defineChatCommand("unlockdown", DarkRP.unLockdown)
--[[---------------------------------------------------------
License
---------------------------------------------------------]]
local function GrantLicense(answer, Ent, Initiator, Target)
Initiator.LicenseRequested = nil
if tobool(answer) then
DarkRP.notify(Initiator, 0, 4, DarkRP.getPhrase("gunlicense_granted", Target:Nick(), Initiator:Nick()))
DarkRP.notify(Target, 0, 4, DarkRP.getPhrase("gunlicense_granted", Target:Nick(), Initiator:Nick()))
Initiator:setDarkRPVar("HasGunlicense", true)
else
DarkRP.notify(Initiator, 1, 4, DarkRP.getPhrase("gunlicense_denied", Target:Nick(), Initiator:Nick()))
end
end
local function RequestLicense(ply)
if ply:getDarkRPVar("HasGunlicense") or ply.LicenseRequested then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("unable", "/requestlicense", ""))
return ""
end
local LookingAt = ply:GetEyeTrace().Entity
local ismayor--first look if there's a mayor
local ischief-- then if there's a chief
local iscop-- and then if there's a cop to ask
for _, v in ipairs(player.GetAll()) do
if v:isMayor() and not v:getDarkRPVar("AFK") then
ismayor = true
break
end
end
if not ismayor then
for _, v in ipairs(player.GetAll()) do
if v:isChief() and not v:getDarkRPVar("AFK") then
ischief = true
break
end
end
end
if not ischief and not ismayor then
for _, v in ipairs(player.GetAll()) do
if v:isCP() then
iscop = true
break
end
end
end
if not ismayor and not ischief and not iscop then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("unable", "/requestlicense", ""))
return ""
end
local mayors, chiefs, cops = {}, {}, {}
for teamNr, jobTable in pairs(RPExtraTeams) do
if jobTable.mayor then
table.insert(mayors, jobTable.name)
end
if jobTable.chief then
table.insert(chiefs, jobTable.name)
end
if GAMEMODE.CivilProtection[teamNr] then
table.insert(cops, jobTable.name)
end
end
mayors = table.concat(mayors, ", ")
chiefs = table.concat(chiefs, ", ")
cops = table.concat(cops, ", ")
if not IsValid(LookingAt) or not LookingAt:IsPlayer() or LookingAt:GetPos():DistToSqr(ply:GetPos()) > 10000 then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("must_be_looking_at", cops))
return ""
end
if ismayor and not LookingAt:isMayor() then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("must_be_looking_at", mayors))
return ""
elseif ischief and not LookingAt:isChief() then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("must_be_looking_at", chiefs))
return ""
elseif iscop and not LookingAt:isCP() then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("must_be_looking_at", cops))
return ""
end
ply.LicenseRequested = true
DarkRP.notify(ply, 3, 4, DarkRP.getPhrase("gunlicense_requested", ply:Nick(), LookingAt:Nick()))
DarkRP.createQuestion(DarkRP.getPhrase("gunlicense_question_text", ply:Nick()), "Gunlicense" .. ply:EntIndex(), LookingAt, 20, GrantLicense, ply, LookingAt)
return ""
end
DarkRP.defineChatCommand("requestlicense", RequestLicense)
local function GiveLicense(ply)
local LookingAt = ply:GetEyeTrace().Entity
if not IsValid(LookingAt) or not LookingAt:IsPlayer() or LookingAt:GetPos():DistToSqr(ply:GetPos()) > 10000 then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("must_be_looking_at", DarkRP.getPhrase("player")))
return ""
end
local canGive, cantGiveReason = hook.Call("canGiveLicense", DarkRP.hooks, ply, LookingAt)
if canGive == false then
cantGiveReason = isstring(cantGiveReason) and cantGiveReason or DarkRP.getPhrase("unable", "/givelicense", "")
DarkRP.notify(ply, 1, 4, cantGiveReason)
return ""
end
DarkRP.notify(LookingAt, 0, 4, DarkRP.getPhrase("gunlicense_granted", ply:Nick(), LookingAt:Nick()))
DarkRP.notify(ply, 0, 4, DarkRP.getPhrase("gunlicense_granted", ply:Nick(), LookingAt:Nick()))
LookingAt:setDarkRPVar("HasGunlicense", true)
hook.Run("playerGotLicense", LookingAt, ply)
return ""
end
DarkRP.defineChatCommand("givelicense", GiveLicense)
local function rp_GiveLicense(ply, arg)
local target = DarkRP.findPlayer(arg)
if not target then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("could_not_find", tostring(arg)))
return
end
target:setDarkRPVar("HasGunlicense", true)
local nick, steamID
if ply:EntIndex() ~= 0 then
nick = ply:Nick()
steamID = ply:SteamID()
else
nick = "Console"
steamID = "Console"
end
DarkRP.notify(target, 0, 4, DarkRP.getPhrase("gunlicense_granted", nick, target:Nick()))
if ply ~= target then
DarkRP.notify(ply, 0, 4, DarkRP.getPhrase("gunlicense_granted", nick, target:Nick()))
end
DarkRP.log(nick .. " (" .. steamID .. ") force-gave " .. target:Nick() .. " a gun license", Color(30, 30, 30))
end
DarkRP.definePrivilegedChatCommand("setlicense", "DarkRP_SetLicense", rp_GiveLicense)
local function rp_RevokeLicense(ply, arg)
local target = DarkRP.findPlayer(arg)
if not target then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("could_not_find", tostring(arg)))
return
end
target:setDarkRPVar("HasGunlicense", nil)
local nick, steamID
if ply:EntIndex() ~= 0 then
nick = ply:Nick()
steamID = ply:SteamID()
else
nick = "Console"
steamID = "Console"
end
DarkRP.notify(target, 1, 4, DarkRP.getPhrase("gunlicense_denied", nick, target:Nick()))
if ply ~= target then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("gunlicense_denied", nick, target:Nick()))
end
DarkRP.log(nick .. " (" .. steamID .. ") force-removed " .. target:Nick() .. "'s gun license", Color(30, 30, 30))
end
DarkRP.definePrivilegedChatCommand("unsetlicense", "DarkRP_SetLicense", rp_RevokeLicense)
local function FinishRevokeLicense(vote, win)
if win == 1 then
vote.target:setDarkRPVar("HasGunlicense", nil)
vote.target:StripWeapons()
gamemode.Call("PlayerLoadout", vote.target)
DarkRP.notifyAll(0, 4, DarkRP.getPhrase("gunlicense_removed", vote.target:Nick()))
else
DarkRP.notifyAll(0, 4, DarkRP.getPhrase("gunlicense_not_removed", vote.target:Nick()))
end
end
local function VoteRemoveLicense(ply, args)
if #args == 1 then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("vote_specify_reason"))
return ""
end
local reason = ""
for i = 2, #args, 1 do
reason = reason .. " " .. args[i]
end
reason = string.sub(reason, 2)
if string.len(reason) > 22 then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("unable", "/demotelicense", "<23"))
return ""
end
local p = DarkRP.findPlayer(args[1])
if p then
if CurTime() - ply.LastVoteCop < 80 then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("have_to_wait", math.ceil(80 - (CurTime() - ply:GetTable().LastVoteCop)), "/demotelicense"))
return ""
end
if ply:getDarkRPVar("HasGunlicense") then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("unable", "/demotelicense", ""))
else
local voteInfo = DarkRP.createVote(p:Nick() .. ":\n" .. DarkRP.getPhrase("gunlicense_remove_vote_text2", reason), "removegunlicense", p, 20, FinishRevokeLicense, {
[p] = true,
[ply] = true
}, nil, nil, {
source = ply
})
if voteInfo then
-- Vote has started
DarkRP.notifyAll(0, 4, DarkRP.getPhrase("gunlicense_remove_vote_text", ply:Nick(), p:Nick()))
end
ply.LastVoteCop = CurTime()
end
return ""
else
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("could_not_find", tostring(args[1])))
return ""
end
end
DarkRP.defineChatCommand("demotelicense", VoteRemoveLicense)

View File

@@ -0,0 +1,463 @@
local plyMeta = FindMetaTable("Player")
local finishWarrantRequest
local arrestedPlayers = {}
--[[---------------------------------------------------------------------------
Interface functions
---------------------------------------------------------------------------]]
function plyMeta:warrant(warranter, reason)
if self.warranted then return end
local suppressMsg = 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)
if suppressMsg then return 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 _, b in ipairs(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
local suppressMsg = hook.Call("playerUnWarranted", GAMEMODE, self, unwarranter)
self.warranted = false
if suppressMsg then return end
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, time)
local suppressMsg = hook.Call("playerWanted", DarkRP.hooks, self, actor, reason)
self:setDarkRPVar("wanted", true)
self:setDarkRPVar("wantedReason", reason)
if time and time > 0 or GAMEMODE.Config.wantedtime > 0 then
timer.Create(self:SteamID64() .. " wantedtimer", time or GAMEMODE.Config.wantedtime, 1, function()
if not IsValid(self) then return end
self:unWanted()
end)
end
if suppressMsg then return end
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 ipairs(player.GetAll()) do
ply:PrintMessage(HUD_PRINTCENTER, centerMessage)
ply:PrintMessage(HUD_PRINTCONSOLE, printMessage)
end
DarkRP.log(string.Replace(printMessage, "\n", " "), Color(0, 150, 255))
end
function plyMeta:unWanted(actor)
local suppressMsg = hook.Call("playerUnWanted", GAMEMODE, self, actor)
self:setDarkRPVar("wanted", nil)
self:setDarkRPVar("wantedReason", nil)
timer.Remove(self:SteamID64() .. " wantedtimer")
if suppressMsg then return end
local expiredMessage = IsValid(actor) and DarkRP.getPhrase("wanted_revoked", self:Nick(), actor:Nick() or "") or
DarkRP.getPhrase("wanted_expired", self:Nick())
DarkRP.log(string.Replace(expiredMessage, "\n", " "), Color(0, 150, 255))
for _, ply in ipairs(player.GetAll()) do
ply:PrintMessage(HUD_PRINTCENTER, expiredMessage)
ply:PrintMessage(HUD_PRINTCONSOLE, expiredMessage)
end
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, teleportOverride)
if not self:isArrested() then return end
self:setDarkRPVar("Arrested", nil)
arrestedPlayers[self:SteamID()] = nil
hook.Call("playerUnArrested", DarkRP.hooks, self, unarrester, teleportOverride)
end
function DarkRP.iterateArrestedPlayers()
local index = nil
local function iterator()
local found_player = nil
index = next(arrestedPlayers, index)
if index == nil then return end
found_player = player.GetBySteamID(index)
-- player.GetBySteamID returns false when the player is not in the
-- server. In that case, skip the player.
if not found_player then return iterator() end
return found_player
end
return iterator
end
function DarkRP.arrestedPlayers()
local result = {}
for ply in DarkRP.iterateArrestedPlayers() do
table.insert(result, ply)
end
return result
end
function DarkRP.arrestedPlayerCount()
local count = 0
for _ in DarkRP.iterateArrestedPlayers() do count = count + 1 end
return count
end
--[[---------------------------------------------------------------------------
Chat commands
---------------------------------------------------------------------------]]
local function CombineRequest(ply, args)
if args == "" then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", DarkRP.getPhrase("arguments"), ""))
return ""
end
local DoSay = function(text)
if text == "" then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", DarkRP.getPhrase("arguments"), ""))
return
end
local col = team.GetColor(ply:Team())
local col2 = Color(255, 0, 0, 255)
local phrase = DarkRP.getPhrase("request")
local name = ply:Nick()
for _, v in ipairs(player.GetAll()) do
if v:isCP() or v == ply then
DarkRP.talkToPerson(v, col, phrase .. " " .. name, col2, text, ply)
end
end
end
return args, DoSay
end
for _, cmd in ipairs{"cr", "911", "999", "112", "000"} do
DarkRP.defineChatCommand(cmd, CombineRequest, 1.5)
end
local function warrantCommand(ply, args)
local target = DarkRP.findPlayer(args[1])
local reason = table.concat(args, " ", 2)
local canRequest, message = hook.Call("canRequestWarrant", DarkRP.hooks, target, ply, reason)
if not canRequest then
if message then DarkRP.notify(ply, 1, 4, message) end
return ""
end
local Team = ply:Team()
if not RPExtraTeams[Team] or not RPExtraTeams[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 not table.IsEmpty(mayors) 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 unwarrantCommand(ply, args)
local target = DarkRP.findPlayer(args[1])
local reason = table.concat(args, " ", 2)
local canRemove, message = hook.Call("canRemoveWarrant", DarkRP.hooks, target, ply, reason)
if not canRemove then
if message then DarkRP.notify(ply, 1, 4, message) end
return ""
end
target:unWarrant(ply, reason)
return ""
end
DarkRP.defineChatCommand("unwarrant", unwarrantCommand)
local function wantedCommand(ply, args)
local target = DarkRP.findPlayer(args[1])
local reason = table.concat(args, " ", 2)
local canWanted, message = hook.Call("canWanted", DarkRP.hooks, target, ply, reason)
if not canWanted then
if message then DarkRP.notify(ply, 1, 4, message) end
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
if message then DarkRP.notify(ply, 1, 4, message) end
return ""
end
target:unWanted(ply)
return ""
end
DarkRP.defineChatCommand("unwanted", unwantedCommand)
--[[---------------------------------------------------------------------------
Admin commands
---------------------------------------------------------------------------]]
local function ccArrest(ply, args)
if DarkRP.jailPosCount() == 0 then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("no_jail_pos"))
return
end
local targets = DarkRP.findPlayers(args[1])
if not targets then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("could_not_find", args[1]))
return
end
for _, target in ipairs(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
DarkRP.definePrivilegedChatCommand("arrest", "DarkRP_AdminCommands", ccArrest)
local function ccUnarrest(ply, args)
local targets = DarkRP.findPlayers(args[1])
if not targets then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("could_not_find", args[1]))
return
end
for _, target in ipairs(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
DarkRP.definePrivilegedChatCommand("unarrest", "DarkRP_AdminCommands", 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
if IsValid(suspect) then
suspect:warrant(initiator, reason)
end
end
--[[---------------------------------------------------------------------------
Hooks
---------------------------------------------------------------------------]]
function DarkRP.hooks:canArrest(arrester, arrestee)
if IsValid(arrestee) and arrestee:IsPlayer() and arrestee:isCP() and not GAMEMODE.Config.cpcanarrestcp then
return false, DarkRP.getPhrase("cant_arrest_other_cp")
end
if not GAMEMODE.Config.npcarrest and arrestee:IsNPC() then
return false, DarkRP.getPhrase("unable", "arrest", "NPC")
end
if GAMEMODE.Config.needwantedforarrest and not arrestee:IsNPC() and not arrestee:getDarkRPVar("wanted") then
return false, DarkRP.getPhrase("must_be_wanted_for_arrest")
end
if arrestee:IsPlayer() and arrestee.FAdmin_GetGlobal and arrestee:FAdmin_GetGlobal("fadmin_jailed") then
return false, DarkRP.getPhrase("cant_arrest_fadmin_jailed")
end
local jpc = DarkRP.jailPosCount()
if not jpc or jpc == 0 then
return false, DarkRP.getPhrase("cant_arrest_no_jail_pos")
end
if arrestee.Babygod then
return false, DarkRP.getPhrase("cant_arrest_spawning_players")
end
return true
end
function DarkRP.hooks:playerArrested(ply, time, arrester)
if ply:isWanted() then ply:unWanted(arrester) end
local job = RPExtraTeams[ply:Team()]
if not job or not job.hasLicense then
ply:setDarkRPVar("HasGunlicense", nil)
end
ply:StripWeapons()
ply:StripAmmo()
if ply:isArrested() then return end -- hasn't been arrested before
ply:PrintMessage(HUD_PRINTCENTER, DarkRP.getPhrase("youre_arrested", time))
local phrase = DarkRP.getPhrase("hes_arrested", ply:Nick(), time)
for _, v in ipairs(player.GetAll()) do
if v == ply then continue end
v:PrintMessage(HUD_PRINTCENTER, phrase)
end
local steamID = ply:SteamID()
timer.Create(ply:SteamID64() .. "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, teleportOverride)
if ply:InVehicle() then ply:ExitVehicle() end
if ply.Sleeping then
DarkRP.toggleSleep(ply, "force")
end
if not ply:Alive() and not GAMEMODE.Config.respawninjail then
ply.NextSpawnTime = CurTime()
end
gamemode.Call("PlayerLoadout", ply)
-- teleportOverride can either be nil, false, or a vector. Nil means "do not
-- modify behavior", false means "do not teleport", and a vector means
-- "teleport to this place instead"
if (GAMEMODE.Config.telefromjail or teleportOverride ~= nil) and teleportOverride ~= false then
local pos
if isvector(teleportOverride) then
pos = teleportOverride
else
local ent
ent, pos = hook.Call("PlayerSelectSpawn", GAMEMODE, ply)
pos = pos or ent:GetPos()
end
-- workaround for SetPos in weapon event bug
timer.Simple(0, function() if IsValid(ply) then ply:SetPos(pos) end end)
end
timer.Remove(ply:SteamID64() .. "jailtimer")
DarkRP.notifyAll(0, 4, DarkRP.getPhrase("hes_unarrested", ply:Nick()))
end
hook.Add("PlayerInitialSpawn", "Arrested", function(ply)
if not arrestedPlayers[ply:SteamID()] then return end
local time = GAMEMODE.Config.jailtimer
-- Delay the actual arrest by a single frame to allow
-- the player to initialise
timer.Simple(0, function()
-- In case the timer ended right this tick
if not IsValid(ply) or not arrestedPlayers[ply:SteamID()] then return end
ply:arrest(time)
end)
DarkRP.notify(ply, 0, 5, DarkRP.getPhrase("jail_punishment", time))
end)
function DarkRP.hooks:canGiveLicense(ply, target)
-- Mayors can hand out licenses
if ply:isMayor() then return true end
local reason = DarkRP.getPhrase("incorrect_job", "/givelicense")
local players = player.GetAll()
-- Chiefs can if there is no mayor
local mayorExists = #fn.Filter(plyMeta.isMayor, players) > 0
if mayorExists then return false, reason end
if ply:isChief() then return true end
-- CPs can if there are no chiefs nor mayors
local chiefExists = #fn.Filter(plyMeta.isChief, players) > 0
if chiefExists then return false, reason end
if ply:isCP() then return true end
return false, reason
end

View File

@@ -0,0 +1,503 @@
DarkRP.lockdown = DarkRP.stub{
name = "lockdown",
description = "Start a lockdown.",
parameters = {
{
name = "ply",
description = "The player who initiated the lockdown.",
type = "Player",
optional = false
}
},
returns = {
{
name = "str",
description = "Empty string (since it's a called in a chat command)",
type = "string"
}
},
metatable = DarkRP
}
DarkRP.unLockdown = DarkRP.stub{
name = "unLockdown",
description = "Stop the lockdown.",
parameters = {
{
name = "ply",
description = "The player who stopped the lockdown.",
type = "Player",
optional = false
}
},
returns = {
{
name = "str",
description = "Empty string (since it's a called in a chat command)",
type = "string"
}
},
metatable = DarkRP
}
DarkRP.PLAYER.requestWarrant = DarkRP.stub{
name = "requestWarrant",
description = "File a request for a search warrant.",
parameters = {
{
name = "suspect",
description = "The player who is suspected.",
type = "Player",
optional = false
},
{
name = "actor",
description = "The player who wants the warrant.",
type = "Player",
optional = false
},
{
name = "reason",
description = "The reason for the warrant.",
type = "string",
optional = false
}
},
returns = {
},
metatable = DarkRP.PLAYER
}
DarkRP.PLAYER.warrant = DarkRP.stub{
name = "warrant",
description = "Get a search warrant for this person.",
parameters = {
{
name = "warranter",
description = "The player who set the warrant.",
type = "Player",
optional = false
},
{
name = "reason",
description = "The reason for the warrant.",
type = "string",
optional = false
}
},
returns = {
},
metatable = DarkRP.PLAYER
}
DarkRP.PLAYER.unWarrant = DarkRP.stub{
name = "unWarrant",
description = "Remove the search warrant for this person.",
parameters = {
{
name = "unwarranter",
description = "The player who removed the warrant.",
type = "Player",
optional = true
}
},
returns = {
},
metatable = DarkRP.PLAYER
}
DarkRP.PLAYER.wanted = DarkRP.stub{
name = "wanted",
description = "Make this person wanted by the police.",
parameters = {
{
name = "actor",
description = "The player who made the other person wanted.",
type = "Player",
optional = false
},
{
name = "reason",
description = "The reason for the wanted status.",
type = "string",
optional = false
},
{
name = "time",
description = "The time in seconds for which the player should be wanted.",
type = "number",
optional = true
}
},
returns = {
},
metatable = DarkRP.PLAYER
}
DarkRP.PLAYER.unWanted = DarkRP.stub{
name = "unWanted",
description = "Clear the wanted status for this person.",
parameters = {
{
name = "actor",
description = "The player who cleared the wanted status.",
type = "Player",
optional = true
}
},
returns = {
},
metatable = DarkRP.PLAYER
}
DarkRP.PLAYER.arrest = DarkRP.stub{
name = "arrest",
description = "Arrest a player.",
parameters = {
{
name = "time",
description = "For how long the player is arrested.",
type = "number",
optional = true
},
{
name = "Arrester",
description = "The player who arrested the target.",
type = "Player",
optional = true
}
},
returns = {
},
metatable = DarkRP.PLAYER
}
DarkRP.PLAYER.unArrest = DarkRP.stub{
name = "unArrest",
description = "Unarrest a player.",
parameters = {
{
name = "Unarrester",
description = "The player who unarrested the target.",
type = "Player",
optional = true
}
},
returns = {
},
metatable = DarkRP.PLAYER
}
DarkRP.iterateArrestedPlayers = DarkRP.stub{
name = "iterateArrestedPlayers",
description = "An iterator that walks over the arrested players. Use as follows: for arrestedPlayer in DarkRP.iterateArrestedPlayers() do print(arrestedPlayer) end",
parameters = {
},
returns = {
{
name = "arrestedPlayer",
description = "Much like the next function, this returns the next arrested player until the table is fully iterated.",
type = "Player"
}
},
metatable = DarkRP,
realm = "Server"
}
DarkRP.arrestedPlayers = DarkRP.stub{
name = "arrestedPlayers",
description = "Returns a table that contains all arrested players. NOTE: This function is defined using DarkRP.iterateArrestedPlayers. It might be more efficient to use that function instead, because this function builds the table anew.",
parameters = {
},
returns = {
{
name = "arrestedPlayers",
description = "An array of arrested players, in no particular order.",
type = "table"
}
},
metatable = DarkRP,
realm = "Server"
}
DarkRP.arrestedPlayerCount = DarkRP.stub{
name = "arrestedPlayerCount",
description = "Returns the amount of players that are currently arrested.",
parameters = {
},
returns = {
{
name = "arrestedPlayerCount",
description = "The amount of arrested players.",
type = "number"
}
},
metatable = DarkRP,
realm = "Server"
}
DarkRP.hookStub{
name = "playerArrested",
description = "When a player is arrested.",
parameters = {
{
name = "criminal",
description = "The arrested criminal.",
type = "Player"
},
{
name = "time",
description = "The jail time.",
type = "number"
},
{
name = "actor",
description = "The person who arrested the criminal.",
type = "Player"
}
},
returns = {
}
}
DarkRP.hookStub{
name = "playerUnArrested",
description = "When a player is unarrested.",
parameters = {
{
name = "criminal",
description = "The unarrested criminal.",
type = "Player"
},
{
name = "actor",
description = "The person who unarrested the criminal.",
type = "Player"
}
},
returns = {
}
}
DarkRP.hookStub{
name = "playerWarranted",
description = "When a player is warranted.",
parameters = {
{
name = "criminal",
description = "The potential criminal.",
type = "Player"
},
{
name = "actor",
description = "The person who wanted the potential criminal.",
type = "Player"
},
{
name = "reason",
description = "The reason for wanting this person.",
type = "string"
}
},
returns = {
{
name = "suppressMsg",
description = "Return true to make the warrant silent.",
type = "boolean"
}
}
}
DarkRP.hookStub{
name = "playerUnWarranted",
description = "When a player is unwarranted.",
parameters = {
{
name = "excriminal",
description = "The potential criminal.",
type = "Player"
},
{
name = "actor",
description = "The person who unwarranted the potential criminal",
type = "Player"
}
},
returns = {
{
name = "suppressMsg",
description = "Return true to make the unwarrant silent.",
type = "boolean"
}
}
}
DarkRP.hookStub{
name = "playerWanted",
description = "When a player is wanted.",
parameters = {
{
name = "criminal",
description = "The criminal.",
type = "Player"
},
{
name = "actor",
description = "The person who wanted the criminal.",
type = "Player"
},
{
name = "reason",
description = "The reason for wanting this person.",
type = "string"
}
},
returns = {
{
name = "suppressMsg",
description = "Return true to make the wanted silent.",
type = "boolean"
}
}
}
DarkRP.hookStub{
name = "playerUnWanted",
description = "When a player is unwanted.",
parameters = {
{
name = "excriminal",
description = "The ex criminal.",
type = "Player"
},
{
name = "actor",
description = "The person who unwanted the ex criminal.",
type = "Player"
}
},
returns = {
{
name = "suppressMsg",
description = "Return true to make the unwanted silent.",
type = "boolean"
}
}
}
DarkRP.hookStub{
name = "agendaUpdated",
description = "When the agenda is updated.",
parameters = {
{
name = "ply",
description = "The player who changed the agenda. Warning: can be nil!",
type = "Player"
},
{
name = "agenda",
description = "Agenda table (also holds the previous text).",
type = "table"
},
{
name = "text",
description = "The text the player wants to set the agenda to.",
type = "string"
}
},
returns = {
{
name = "text",
description = "An override for the text.",
type = "string"
}
}
}
DarkRP.hookStub{
name = "playerEnteredLottery",
description = "When a player has entered the lottery.",
parameters = {
{
name = "ply",
description = "The player.",
type = "Player"
}
},
returns = {
}
}
DarkRP.hookStub{
name = "lotteryEnded",
description = "When a lottery has ended.",
parameters = {
{
name = "participants",
description = "The participants of the lottery. An empty table when no one entered the lottery.",
type = "table"
},
{
name = "chosen",
description = "The winner of the lottery.",
type = "Player"
},
{
name = "amount",
description = "The amount won by the winner.",
type = "number"
}
},
returns = {
}
}
DarkRP.hookStub{
name = "lotteryStarted",
description = "When a lottery has started.",
parameters = {
{
name = "ply",
description = "The player who started the lottery.",
type = "Player"
},
{
name = "price",
description = "The amount of money people have to pay to enter.",
type = "number"
}
},
returns = {
}
}
DarkRP.hookStub{
name = "canGiveLicense",
description = "Whether a player is allowed to give another player a license.",
parameters = {
{
name = "ply",
description = "The player who tries to give the license.",
type = "Player"
},
{
name = "target",
description = "The player who should receive the license.",
type = "Player"
}
},
returns = {
{
name = "canGiveLicense",
description = "Whether the player is allowed to give the target a license.",
type = "boolean"
},
{
name = "cantGiveReason",
description = "Why the target is not allowed to receive a license from the player.",
type = "string"
},
}
}