• 222 Command [I need help]
    3 replies, posted
Hello everyone! First of all, sorry for the potential mistakes and sorry for posting this thread. I am a beginner at lua coding and I only know the very basics. I have decided to come here after a TON of research on the internet to find a solution to my problem. Sadly I didn't find one. What I am trying to do: I am trying to make a command that when a player types /222 (Message) it will contact everyone in a certain job. This job being the "Repair Man" job. I also want the command to be in a purple color. This is what I have done so far. [code]local function RepairCommand( ply, text, team ) if string.sub( text, 1, 4 ) == "/222" then DarkRP.addChatReceiver(string prefix, string text, function hearFunc) end hook.Add( "PlayerSay", "RepairCommand", RepairCommand ) [/code] Can you please tell me what is the script I have to make for this to happen. I really need your help on this, i've been searching for a while, thanks for your help!
[url]http://wiki.darkrp.com/index.php/Functions/DarkRP/Client/addChatReceiver[/url] According to that, you don't need to hook PlayerSay for yourself. [CODE] DarkRP.addChatReceiver("/222", "Some text displayed to typer", function(ply, splitText) if(ply:Team() == REPAIR_MAN) then return true end return false end) [/CODE] Obviously REPAIR_MAN is filler, I don't know the real job id.
[QUOTE=RealDope;48071352][url]http://wiki.darkrp.com/index.php/Functions/DarkRP/Client/addChatReceiver[/url] According to that, you don't need to hook PlayerSay for yourself. [CODE] DarkRP.addChatReceiver("/222", "Some text displayed to typer", function(ply, splitText) if(ply:Team() == REPAIR_MAN) then return true end return false end) [/CODE] Obviously REPAIR_MAN is filler, I don't know the real job id.[/QUOTE] For the REPAIR_MAN would that be TEAM_REPO or what? BTW forgot to say I am using DarkRP. And for "Some Text displayed to typer would should I put there?
Yeah, replace REPAIR_MAN with whatever the name of the enum for the team id is. TEAM_REPO maybe. I kinda figured you're using DarkRP lol. Put whatever you want there, I don't play DarkRP so I'm not sure what it's referring to. Go to the link and see for yourself.
Sorry, you need to Log In to post a reply to this thread.