So I want to change the chat command /wanted and /unwanted to /want and /unwanted. I seem to have figured out how to remove the commands and declare them and ect. I just dont know how to want the play. Heres what I have tried:
--First Attempt
DarkRP.removeChatCommand("wanted")
local function wanted(ply, args)
for k,v in pairs(player.GetAll()) do
if v:Nick() == args then
v:wanted(ply, args 120)
end
end
DarkRP.declareChatCommand{
command = "want",
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
}
if SERVER then
DarkRP.defineChatCommand("want", wanted)
end
--Second Attempt
DarkRP.removeChatCommand("wanted")
local function wanted(ply, args)
function plyMeta:wanted(actor, reason, time)
local suppressMsg = hook.Call("playerWanted", DarkRP.hooks, self, actor, reason)
self:setDarkRPVar("wanted", true)
self:setDarkRPVar("wantedReason", reason)
timer.Create(self:SteamID64() .. " wantedtimer", time or GAMEMODE.Config.wantedtime, 1, function()
if not IsValid(self) then return end
self:unWanted()
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 pairs(player.GetAll()) do
ply:PrintMessage(HUD_PRINTCENTER, centerMessage)
ply:PrintMessage(HUD_PRINTCONSOLE, printMessage)
end
DarkRP.log(string.Replace(printMessage, "
", " "), Color(0, 150, 255))
end
end
DarkRP.declareChatCommand{
command = "want",
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
}
if SERVER then
DarkRP.defineChatCommand("want", wanted)
end
Both of those did nothing but add a space to the chat so it would be
BabyBear: Msg -- Without code
BabyBear: Msg -- With code
Any help would be appreciated please and thank you.