• How to change /wanted to /want? [DarkRP]
    3 replies, posted
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: [CODE] --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, "\n", " "), 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 [/CODE] Both of those did nothing but add a space to the chat so it would be [CODE] BabyBear: Msg -- Without code BabyBear: Msg -- With code [/CODE] Any help would be appreciated please and thank you.
1st, screw the declareChatCommand stuff. You do not need that. Also, you're copying meta functions when you do not even have the local plyMeta. You only need to copy the /wanted from the regular /wanted command, paste it over somewhere (SERVER) and just rename the wanted in the DarkRP.defineChatCommand to /wanted.
Use [url]http://wiki.darkrp.com/index.php/Functions/DarkRP/Shared/chatCommandAlias[/url]
[QUOTE=mib999;52516784]Use [url]http://wiki.darkrp.com/index.php/Functions/DarkRP/Shared/chatCommandAlias[/url][/QUOTE] Thank you so much.
Sorry, you need to Log In to post a reply to this thread.