• Help?
    6 replies, posted
So I'm currently trying to change the tag colors for the ooc chat for darkrp. I've managed to change the tag color to the color I want but the issue I'm having it's carrying over to the name so for example the tag is green and then it also carries over to the name. I'm trying to make the name stay as the darkrp job color anyways heres the code. I'm rather new to lua so if it's a obvious mistake please excuse my stupidity. [CODE]local function OOC(ply, args) if not GAMEMODE.Config.ooc then DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("disabled", DarkRP.getPhrase("ooc"), "")) return "" end local DoSay = function(text) if text == "" then DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", "")) return "" end local col = Color(0,102,0,255) local col2 = team.GetColor(ply:Team()) local col3 = Color(255,255,255,255) if not ply:Alive() then col2 = Color(255,200,200,255) col = col2 end for k,v in pairs(player.GetAll()) do DarkRP.talkToPerson(v, col, "[" .. DarkRP.getPhrase("ooc") .. "] " .. ply:col2, Name(), col3, text, ply) end end return args, DoSay end DarkRP.defineChatCommand("/", OOC, true, 1.5) DarkRP.defineChatCommand("a", OOC, true, 1.5) DarkRP.defineChatCommand("ooc", OOC, true, 1.5)[/CODE]
I'm not sure but maybe like this? [lua] DarkRP.talkToPerson(v, col, "[" .. DarkRP.getPhrase("ooc") .. "] " .. col2, Name(), col3, text, ply) [/lua]
[QUOTE=soliv;49074434]I'm not sure but maybe like this? [lua] DarkRP.talkToPerson(v, col, "[" .. DarkRP.getPhrase("ooc") .. "] " .. col2, Name(), col3, text, ply) [/lua][/QUOTE] Nope :/ heres the error [IMG]https://i.gyazo.com/a514d6ae37ad405e14688e10f80bb891.png[/IMG]
[QUOTE=CelaeonSan;49075462]Nope :/ heres the error [IMG]https://i.gyazo.com/a514d6ae37ad405e14688e10f80bb891.png[/IMG][/QUOTE] I'm not sure what you're trying to do here and the problem though.. Take a look at that error closely and the code. Notice this: [quote] DarkRP.talkToPerson(v, col, "[" .. DarkRP.getPhrase("ooc") .. "] " [b] .. col2 [/b], Name(), col3, text, ply) [/quote] and compare it to this [code] DarkRP.talkToPerson(v, col, "(" .. DarkRP.getPhrase("ooc") .. ") " .. ply:Name(), col2, text, ply) [/code]
Did not even notice the Name(), try what bluemist said.
[QUOTE=bluemist;49075956]I'm not sure what you're trying to do here and the problem though.. Take a look at that error closely and the code. Notice this: and compare it to this [code] DarkRP.talkToPerson(v, col, "(" .. DarkRP.getPhrase("ooc") .. ") " .. ply:Name(), col2, text, ply) [/code][/QUOTE] I'm just wanting to change the OOC tag color rather than it being the jobs color. Also I placed [] rather than () around the OOC tag as I feel it looks better. The issue I'm having is I've managed to change the tag color to the color I want being green but the color carries over to the players name and I don't want that I want it to keep the team / jobs color as their name which is team.GetColor(ply:Team())
If you want to change the OOC colour then look at your code again: [quote] local function OOC(ply, args) if not GAMEMODE.Config.ooc then DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("disabled", DarkRP.getPhrase("ooc"), "")) return "" end local DoSay = function(text) if text == "" then DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", "")) return "" end local col = Color(0,102,0,255) [b]local col2 = team.GetColor(ply:Team())[/b] local col3 = Color(255,255,255,255) if not ply:Alive() then col2 = Color(255,200,200,255) col = col2 end for k,v in pairs(player.GetAll()) do DarkRP.talkToPerson(v, col, "[" .. DarkRP.getPhrase("ooc") .. "] " .. ply:col2, Name(), col3, text, ply) end end return args, DoSay end DarkRP.defineChatCommand("/", OOC, true, 1.5) DarkRP.defineChatCommand("a", OOC, true, 1.5) DarkRP.defineChatCommand("ooc", OOC, true, 1.5) [/quote] The ooc tags can be changed [code] DarkRP.talkToPerson(v, col, "[" .. DarkRP.getPhrase("ooc") .. "]" .. ply:Name(), col2, text, ply) [/code] You mentioned you don't want the name to be carried over so: [code] DarkRP.talkToPerson(v, Color(255,0,0,255), "[" .. DarkRP.getPhrase("ooc") .. "] ", col, ply:Name(), col2, text, ply) [/code] See how the concatenation was seperated and how I added a space in "[" .. DarkRP.getPhrase("ooc") .. "[b]] "[/b], to fit the player name in. The colour of the ooc tag should be red from the Color(255,0,0,255) you can change it to whatever you want. Try it out, I didn't test it. If it didn't give the right result then play around with it. Clueless how it works? Then have a look at [url]http://wiki.darkrp.com/index.php/Functions/DarkRP/Server/talkToPerson[/url]
Sorry, you need to Log In to post a reply to this thread.