Help?

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.


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)

I’m not sure but maybe like this?

[lua]
DarkRP.talkToPerson(v, col, “[” … DarkRP.getPhrase(“ooc”) … "] " … col2, Name(), col3, text, ply)
[/lua]

Nope :confused: heres the error

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



DarkRP.talkToPerson(v, col, "(" .. DarkRP.getPhrase("ooc") .. ") " .. ply:Name(), col2, text, ply)


Did not even notice the Name(), try what bluemist said.

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:

The ooc tags can be changed



DarkRP.talkToPerson(v, col, "[" .. DarkRP.getPhrase("ooc") .. "]" .. ply:Name(), col2, text, ply)


You mentioned you don’t want the name to be carried over so:



DarkRP.talkToPerson(v, Color(255,0,0,255), "[" .. DarkRP.getPhrase("ooc") .. "] ", col, ply:Name(), col2, text, ply)


See how the concatenation was seperated and how I added a space in “[” … DarkRP.getPhrase(“ooc”) … "] ", 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 http://wiki.darkrp.com/index.php/Functions/DarkRP/Server/talkToPerson