Ulysses Stuff > Suggestions
Chat prefixes/tags/titles/names
sme4gle:
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
JamminR:
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.
sme4gle:
ive tried that one before, but i cant get it working :/
--- Code: ---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 )
--- End code ---
I'm not that good in lua but i thought this was kind of correct isnt it?
Megiddo:
Elaborate on "can't get it working". No change in behavior whatsoever? Are you sure you installed it correctly?
Dimstar:
I found one that works for my server... here:
--- Code: ---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 )
--- End code ---
Navigation
[0] Message Index
[#] Next page
Go to full version