Good day to all of you wonderful people!
I've recently been messing around with some DarkRP lua, especially the chat and commands. I've came across a command called Comms, (it's basically an advert/radio command but renamed), which can be used with a chat command of "/c" or "/comms" and i've been wondering, is there a way to recolour the command itself? What i mean by that, as of the current state it's in, the [COMMS] tag which comes in front of the players name when typed in chat (just like Advert), takes the job colour of which the player typing it is in, instead of it being a colour for itself. This is the code for it:
function Radio(ply, args)
if args == "" then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
return ""
end
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
local col = team.GetColor(ply:Team())
DarkRP.talkToPerson(v, col, "[COMMS] " .. ply:Nick(), Color(255, 255, 255, 205), text, ply)
end
end
return args, DoSay
end
DarkRP.defineChatCommand("c", Radio, 1.5)
DarkRP.defineChatCommand("comms", Radio, 1.5)
I've tried playing around with this line in particular: "DarkRP.talkToPerson(v, col, "[COMMS] " .. ply:Nick(), Color(195, 0, 0, 205), text, ply)", but couldn't get it to wrok, it's either both the comms tag and the players name being the same colour (that being the colour of the job the person is in), or it breaking and not working correctly.
Here's a screenshot of what it looks like currently:
https://files.facepunch.com/forum/upload/247581/f8de6d89-c294-4199-baef-285167cc168e/Screenshot_6.png
And this is basically what i want to make it look like (so the red colour remains as it is, only the persons name changes colour according to their jobs colour):
https://files.facepunch.com/forum/upload/247581/9ac06da6-6523-40fc-b334-d0b70e2e226f/Screenshot_5.png
I would higly appreciate any kind of help, as you can see i'm kind of a begginer myself, trying my best though.
Sorry for the long post, hopefully someone can lend a helping hand.
Thank you for reading and have a wonderful day!
Thank you very much for the reply, @MediCat
Sadly i've already tried that out and it doesn't work. It totally breaks the Comms, to the point the message doesn't even show, because it thinks that your name is the message for some reason. As you can see in the picture below, in both of those cases i typed Test, but the text never showed up, only the tag and my name as being the test i wrote.
https://files.facepunch.com/forum/upload/247581/472d392f-9a03-476d-a1ac-f77d1ec4731e/Screenshot_7.png
talkToPerson support only 2 colors, so you have to use another function or create one by yourself.
Thank you very much for the reply, @LoweChaser
I've been looking through other forums and on google on how i would go around making a chat function like this, but didn't have much luck, sadly, plus me being a noob doesn't really help the problem much haha. Is there a direction you can forward me to, where i could find this kind of help in particular or if anyone else reading this knows anything more about it, i would higly appreciate it. No idea why darkrp.talktoperson only supports 2 colours though, very strange.Would also like to do it with Advert and other chat commands such as OOC, LOOC, Yell, Whisper etc. Not much has come up.
Sorry, you need to Log In to post a reply to this thread.