Ulysses

Ulysses Stuff => Releases => Topic started by: Adult on December 08, 2012, 07:31:15 AM

Title: Custom Chat Colors
Post by: Adult on December 08, 2012, 07:31:15 AM
Just something I made when I was bored. Allows you to have custom chat colors.

ulx chatcolor # # #           - sets your chat color.
ulx setcolor <ply> # # #   - sets target's chat color, admin only
ulx removecolor <ply>      - removes target's chat color, admin only

Enjoy!
Title: Re: Custom Chat Colors
Post by: Nightmare2244 on February 09, 2013, 06:35:53 PM
Every time I type !chatcolor 255. It never sets it.
Title: Re: Custom Chat Colors
Post by: Bite That Apple on February 09, 2013, 07:24:55 PM
Every time I type !chatcolor 255. It never sets it.

I don't think you can do that. It looks like you can only do it through console or xgui maybe. Not sure, didn't download it or anything.
Title: Re: Custom Chat Colors
Post by: JamminR on February 09, 2013, 08:03:58 PM
I don't think you can do that.
Adult has the chat command fine. (at least, from my QUICK check.
The command requires 3 numbers. # # #, just like the instructions in the original post say.
Nightmare would have to have !chatcolor 255 255 255 for it to work.
It should have come back with an error telling him he was missing parameters.

Adult, your addons.txt isn't named right.
It has two .txt on it addons.txt.txt
May want to fix that.

Title: Re: Custom Chat Colors
Post by: Bite That Apple on February 10, 2013, 06:27:04 AM
Adult has the chat command fine. (at least, from my QUICK check.
The command requires 3 numbers. # # #, just like the instructions in the original post say.
Nightmare would have to have !chatcolor 255 255 255 for it to work.
It should have come back with an error telling him he was missing parameters.


I see that now
local setcolor = ulx.command( "Chat", "ulx setcolor", ulx.setcolor, "!setcolor" )
and also
local removecolor = ulx.command( "Chat", "ulx removecolor", ulx.removecolor, "!removecolor" )

pretty cool man, when I get back from vacation this weekend I'll check it out and see if I'm getting the same problem as Nightmare. From what I'm assuming Jammin is most likely correct, and you have to do !setcolour # # #, because leaving the parameters blank causing nil values I believe.

My suggest for this addon is this. If someone for some strange reason forgets to fill the rest of it aka just doing !setcolour 100, then it should send some sort of AddChat to local player saying they changed it... actually wait before I even say that... When someone does !setcolour does it change everyone's chat colour, or just person who typed it? (reminder I didn't really even check the code that much, just briefly looked at it)
Title: Re: Custom Chat Colors
Post by: Deathtitan77 on February 10, 2013, 08:34:13 AM
The colors don't work for TTT. It says your chat color has been set to [#,#,#] but it doesn't work.
Title: Re: Custom Chat Colors
Post by: Nightmare2244 on February 10, 2013, 03:29:37 PM
yes I do that. I type !chatcolor nightmare 255 255 255. And type hi after that command and it never works
Title: Re: Custom Chat Colors
Post by: Adult on March 01, 2013, 01:09:10 PM
<Censor> I didn't even notice this, haven't checked here in a while. I'll start looking into it now. Sorry :L

EDIT by JamminR - Keep it clean here please Adult. We like to keep a family oriented environment for all ages.
Title: Re: Custom Chat Colors
Post by: krooks on March 20, 2013, 12:44:15 AM
Funny, I just had a similar idea! I'll have to check this out soon.
Title: Re: Custom Chat Colors
Post by: Bite That Apple on April 11, 2013, 09:23:59 PM
This addon was not working correctly, and I was asked to fix it so in doing so I have fixed it and made the following changes to it:

Changed This:
ulx chatcolor # # #           - sets your chat color.
ulx setcolor <ply> # # #   - sets target's chat color, admin only
ulx removecolor <ply>      - removes target's chat color, admin only

to this

ulx chatcolor # # #           - sets your chat color.
ulx setchatcolor <ply> # # #   - sets target's chat color, admin only
ulx removechatcolor <ply>      - removes target's chat color, admin only
Title: Re: Custom Chat Colors
Post by: Deathtitan77 on April 12, 2013, 09:06:18 AM
[ERROR] addons/ulx chatcolors/lua/ulx/modules/sh/chatcolors.lua:68: attempt to call method 'SteamID' (a nil value)
  1. fn - addons/ulx chatcolors/lua/ulx/modules/sh/chatcolors.lua:68
   2. unknown - addons/ulib/lua/ulib/shared/hook.lua:183

@ chaos13125's version
Title: Re: Custom Chat Colors
Post by: Bite That Apple on April 12, 2013, 03:42:08 PM
[ERROR] addons/ulx chatcolors/lua/ulx/modules/sh/chatcolors.lua:68: attempt to call method 'SteamID' (a nil value)
  1. fn - addons/ulx chatcolors/lua/ulx/modules/sh/chatcolors.lua:68
   2. unknown - addons/ulib/lua/ulib/shared/hook.lua:183

@ chaos13125's version

Are you running this on a Server or just your single player client?
Title: Re: Custom Chat Colors
Post by: Bite That Apple on April 12, 2013, 04:12:20 PM
This one has my Chat Tags addon in it too, because someone asked or w/e. Thing is that this WILL NOT KEEP YOUR CHAT COLORS, so when you relog, or switch maps it won't stay. I don't know why, but it's not my addon, so I'm not willing to really fix it

you will have to delete my current chat tags addon, and the current color chat addon
Title: Re: Custom Chat Colors
Post by: Deathtitan77 on April 13, 2013, 04:48:04 AM
Server @ lua error.

Also, what does your second version fix exactly?

Where do I edit the chat tags in your second version?
Title: Re: Custom Chat Colors
Post by: Bite That Apple on April 13, 2013, 04:38:56 PM
You gotta look at it yourself, I'm on vacation and won't be able to fix it
Title: Re: Custom Chat Colors
Post by: Exile on June 05, 2014, 07:47:24 PM
Does this work or?
Title: Re: Custom Chat Colors
Post by: Valgoid on June 07, 2014, 09:25:32 PM
Someone should really remake this so it works!
Title: Re: Custom Chat Colors
Post by: Cobalt on June 07, 2014, 09:43:42 PM
I have something similar in some chat tags I made for my gamemode, if anyone wants it I will post the code here.
Title: Re: Custom Chat Colors
Post by: Valgoid on June 07, 2014, 09:50:15 PM
I have something similar in some chat tags I made for my gamemode, if anyone wants it I will post the code here.

You mean chat tags, that you can color?
Title: Re: Custom Chat Colors
Post by: Cobalt on June 07, 2014, 09:52:24 PM
You mean chat tags, that you can color?
No a thing where you can set the color of your text by doing `color` text, the chat tags part wasn't relevent
Title: Re: Custom Chat Colors
Post by: Valgoid on June 07, 2014, 10:13:12 PM
No a thing where you can set the color of your text by doing `color` text, the chat tags part wasn't relevent

Oh, so if I wanted to change me color to yellow, i would just type color, something like that? If it is like that, It would be great if you would share it with us.
Title: Re: Custom Chat Colors
Post by: Cobalt on June 07, 2014, 10:15:13 PM
Code: [Select]
local groups = {
{ "vip", Color( 0, 200, 0 ), "VIP" },
{ "betatester", Color( 180, 180, 180 ), "Beta Tester" },
{ "vip+", Color( 0, 255, 0 ), "VIP+" },
{ "owner", Color( 255, 0, 0 ), "Owner" },
{ "creator", Color( 200, 0, 0 ), "Creator" },
{ "coowner", Color( 255, 0, 0 ), "Co-Owner" },
{ "superadmin", Color( 255, 0, 0 ), "Superadmin" },
{ "admin", Color( 220, 180, 0 ), "Admin" }
}

local ccolors = {
{ "red", Color( 255, 0, 0 ) },
{ "blue", Color( 0, 0, 255 ) },
{ "yellow", Color( 255, 255, 0 ) },
{ "black", Color( 0, 0, 0 ) },
{ "white", Color( 255, 255, 255 ) },
{ "green", Color( 0, 255, 0 ) },
{ "orange", Color( 255, 120, 0 ) },
{ "pink", Color( 255, 0, 255 ) },
{ "purple", Color( 270, 0, 255 ) }
}

local ti = table.insert
local IsValid = IsValid
local Color = Color
local unpack = unpack
local white = color_white

function GM:OnPlayerChat( ply, text, teamonly, dead )
local tab = {}
if IsValid( ply ) then
if dead then
ti( tab, Color( 255, 30, 40 ) )
ti( tab, "*DEAD* " )
end
if teamonly then
ti( tab, Color( 30, 160, 40 ) )
ti( tab, "(TEAM) " )
end

local strcol = white
local customfound = false
for k, v in next, ccolors do
if string.StartWith( text, "`" .. v[ 1 ] .. "`" ) then
local pos = string.find( text, "`" .. v[ 1 ] .. "`" ) + v[ 1 ]:len()
text = string.sub( text, pos + 3 )
strcol = v[ 2 ]
customfound = true
end
end

if customfound == false and string.StartWith( text, "`" ) then
local exp = string.Explode( "`", text:sub( 2 ) )
local str = exp[ 1 ]
local str2 = string.Explode( " ", str )
if #str2 == 3 then
str2[ 4 ] = "255"
end
local col = string.ToColor( table.concat( str2, " " ) )
strcol = col or color_white
local pos = string.find( string.sub( text, 2 ), "`" )
text = string.sub( text, pos + 3 )
end

if ply:GetNWString( "usergroup" ) == "user" then
ti( tab, ply )
ti( tab, white )
ti( tab, ": " )
ti( tab, strcol )
ti( tab, text )
else
for k, v in next, groups do
if ply:GetNWString( "usergroup" ) == v[ 1 ] then
ti( tab, v[ 2 ] )
ti( tab, "[" .. v[ 3 ] .. "] " )
ti( tab, ply )
ti( tab, white )
ti( tab, ": " )
ti( tab, strcol )
ti( tab, text )
end
end
end
chat.AddText( unpack( tab ) )
return true
end
end
Title: Re: Custom Chat Colors
Post by: Valgoid on June 07, 2014, 10:21:01 PM
So basically the player types for example "color red" and it changes their chat color to red?
Title: Re: Custom Chat Colors
Post by: Cobalt on June 07, 2014, 10:34:08 PM
So basically the player types for example "color red" and it changes their chat color to red?
`red` text -> text
`255 0 0` text -> text
Title: Re: Custom Chat Colors
Post by: Valgoid on June 07, 2014, 11:03:45 PM
For my server I use hat chat, and it has a built in tag system, do you think the script would work if I removed the local groups area in the script?
Title: Re: Custom Chat Colors
Post by: Cobalt on June 07, 2014, 11:18:23 PM
For my server I use hat chat, and it has a built in tag system, do you think the script would work if I removed the local groups area in the script?
Probably not but you can try it.
Title: Re: Custom Chat Colors
Post by: [U] Arcane Hero on June 26, 2015, 05:07:15 PM
Chat Color resets after a map change. Is there a way to make it a player's permanent color until they or someone else changes it?