Ulysses
Ulysses Stuff => Suggestions => Topic started by: sme4gle on March 21, 2012, 04:55:50 AM
-
Hello, ive been searching AGES for a plugin or code to make something like this for the chat:
[Admin] sme4gle: Hello you!
[Trusted] Shadow: Hi there Sme4gle :D
But none of em seem to be working how i want ... ive tried like 4-5 different codes half of em doesnt work or is for evolvemod
-
Sme4gle, due to the current ways chat hooks can be so easily broken if not done right, Team Ulysses will never support it within ULX.
Megiddo says as much in this thread, which also has, aptly stated, unsupported, untested, code by another community (and silent partner) Team Ulysses member.
Searching from the forum front page found me this.
http://forums.ulyssesmod.net/index.php/topic,5391.0.html
That's not to say Garry may not somehow change things in the future which make it not so easy to break, but, currently, no, not now.
-
ive tried that one before, but i cant get it working :/
local function lOnPlayerChat( ply, strText, bTeamOnly, bPlayerIsDead, bPlayerIsOwner, bPlayerIsCoowner, bPlayerIsSuperadmin, bPlayerIsAdmin, bPlayerIsOperator, bPlayerIsRespected, bPlayerIsGuest )
local tab = {}
local lTeam = 0
if( IsValid( ply ) ) then
lTeam = ply:Team()
end
table.insert( tab, Color( team.GetColor( lTeam ) ) )
table.insert( tab, "[" .. team.GetName( lTeam ) .. "] " )
if ( bPlayerIsOwner ) then
table.insert( tab, Color( 255, 255, 255 ) )
table.insert( tab, "[Owner] " )
end
if ( bPlayerIsCoowner ) then
table.insert( tab, Color( 255, 255, 255 ) )
table.insert( tab, "[Co-Owner] " )
end
if ( bPlayerIsSuperadmin ) then
table.insert( tab, Color( 255, 255, 255 ) )
table.insert( tab, "[Super-Admin] " )
end
if ( bPlayerIsAdmin ) then
table.insert( tab, Color( 255, 255, 255 ) )
table.insert( tab, "[Admin] " )
end
if ( bPlayerIsOperator ) then
table.insert( tab, Color( 255, 255, 255 ) )
table.insert( tab, "[Operator] " )
end
if ( bPlayerIsRespected ) then
table.insert( tab, Color( 255, 255, 255 ) )
table.insert( tab, "[Respected] " )
end
if (bPlayerIsGuest ) then
table.insert( tab, Color( 255, 255, 255 ) )
table.insert( tab, "[Guest] " )
if ( IsValid( ply ) ) then
table.insert( tab, ply:GetName() )
else
table.insert( tab, "Console" )
end
table.insert( tab, Color( 255, 255, 255 ) )
table.insert( tab, ": "..strText )
chat.AddText( unpack(tab) )
return true
end
hook.Add( "OnPlayerChat", "PlayerChatTeamPrefix", lOnPlayerChat )
I'm not that good in lua but i thought this was kind of correct isnt it?
-
Elaborate on "can't get it working". No change in behavior whatsoever? Are you sure you installed it correctly?
-
I found one that works for my server... here:
CreateClientConVar("chat_tags_color_r", 255, true, false)
CreateClientConVar("chat_tags_color_g", 255, true, false)
CreateClientConVar("chat_tags_color_b", 255, true, false)
CreateClientConVar("chat_tags_color_a", 255, true, false)
local Tags =
{
--Group --Tag --Color
{"user", "[User] ", Color(212, 67, 255, 255) },
{"admin", "[ADMIN] ", Color(0, 0, 255, 255) },
{"superadmin", "[SUPERADMIN] ", Color(255, 0, 0, 255) },
{"owner", "[OWNER] ", Color(0, 255, 0, 255) }
}
hook.Add("OnPlayerChat", "Tags", function(ply, strText, bTeamOnly)
if IsValid(ply) and ply:IsPlayer() then
for k,v in pairs(Tags) do
if ply:IsUserGroup(v[1]) then
local R = GetConVarNumber("chat_tags_color_r")
local G = GetConVarNumber("chat_tags_color_g")
local B = GetConVarNumber("chat_tags_color_b")
local A = GetConVarNumber("chat_tags_color_a")
local nickteam = team.GetColor(ply:Team())
if !bTeamOnly then
chat.AddText(v[3], v[2], nickteam, ply:Nick(), color_white, ": ", Color(R, G, B, A), strText)
return true
else
chat.AddText(v[3], v[2], nickteam, "(TEAM) ", ply:Nick(), color_white, ": ", Color(R, G, B, A), strText)
return true
end
end
end
end
if !IsValid(ply) and !ply:IsPlayer() then
local ConsoleColor = Color(0, 255, 0) --Change this to change Console name color
chat.AddText(ConsoleColor, "Console", color_white, ": ", strText)
return true
end
end )
-
Psst. Megiddo. Stop waking up posts from 2012.
:P
-
He didn't. :D As far as I can tell.
-
Oops.
Psst. Hey, Dimstar, no need to wake up posts from 2012.
(Though, admittedly, your post does answer a question...even if it was over a year ago asked)
-
The only thing I can think of is people find these posts using the search feature (Either through the website or through a search engine). Ergo: You should be quite thrilled Jam! :D
-
I have this script on my server, no idea where I got it, but it seems to work fine except some of the colours of the ranks come out white. I haven't really tried investigating it because it hasn't bothered me before.
(http://gyazo.com/29839758145e86de6dd6da202076d9d1.png)
prefix.lua in garrysmod/addons/ulx/lua/ulx/modules/cl
function insertChatTags(ply, msg)
if ply:IsValid() then
local ply_team = ply:Team()
local team_name = team.GetName( ply_team )
--local h,s,v = ColorToHSV( team.GetColor( ply_team ) )
--local comp_col = HSVToColor( 180-h, s, v )
--PHX-Server specifics
if ( team_name == "Leader Builder" ) then
comp_col = Color(55,126,206)
elseif ( team_name == "Admin Builder" ) then
comp_col = Color(79,115,158)
elseif ( team_name == "Wullys Builder" ) then
comp_col = Color(0,178,255)
elseif ( team_name == "Ultimate Builder" ) then
comp_col = Color(121,0,221)
elseif ( team_name == "Precision Builder" ) then
comp_col = Color(0,147,12)
elseif ( team_name == "Loyal Builder" ) then
comp_col = Color(173,0,23)
elseif ( team_name == "Creative Builder" ) then
comp_col = Color(0,13,132)
elseif ( team_name == "Novice Builder" ) then
comp_col = Color(255,242,0)
elseif ( team_name == "Bronze Builder" ) then
comp_col = Color(135,81,0)
elseif ( team_name == "Silver Builder" ) then
comp_col = Color(135,135,135)
elseif ( team_name == "Gold Builder" ) then
comp_col = Color(237,197,0)
elseif ( team_name == "Respected" ) then
comp_col = Color(169,186,198)
elseif ( team_name == "user" ) then
comp_col = Color(100,100,100)
team_name = "New Builder"
else
comp_col = Color(255, 255, 255)
end
chat.AddText( team.GetColor( ply_team ), "[",comp_col, team_name,team.GetColor( ply_team ), "] ", ply:GetName(), color_white, ": ", msg )
return true
end
end
hook.Add( "OnPlayerChat", "ulx_chattags", insertChatTags )