Ulysses
General => Developers Corner => Topic started by: frustratedgamers on April 21, 2014, 12:31:54 AM
-
Does the latest version of ulx have chat tags already built in some how? I am trying to find out why I am having some issues with this:
http://coderhire.com/browse/script/378/atlas-chat-20 (http://coderhire.com/browse/script/378/atlas-chat-20)
Says:
"IF YOU ARE USING AN ADDON THAT OVERRIDES THE "OnPlayerChat" HOOK SUCH AS A "ChatTags" ADDON - THE <avatar> EXPRESSION AND RANK ICONS WILL NOT WORK! CHANGE OR ASK THE DEVELOPER OF THE ADDON TO MAKE IT USE THE PLAYER ENTITY AS ARGUMENT FOR PLAYER NAME TO MAKE IT WORK!"
-
ULX is an administration mod and will probably never include chat tags.
-
If you want chat tags, drop this into your server's garrysmod/lua/autorun folder. Name it "tags.lua"
if (SERVER) then
AddCSLuaFile("autorun/tags.lua")
end
if (CLIENT) then
function Insert( pl, msg )
local tab = {}
if pl:IsUserGroup("owner") then
table.insert( tab, Color( 255, 0, 0, 255 ) )
table.insert( tab, "[Owner] " )
table.insert( tab, Color( 255, 255, 255, 255 ) )
table.insert( tab, pl:Nick() )
table.insert( tab, ": " )
table.insert( tab, msg )
elseif pl:IsUserGroup("coowner") then
table.insert( tab, Color( 255, 0, 0, 255 ) )
table.insert( tab, "[Co Owner] " )
table.insert( tab, Color( 255, 255, 255, 255 ) )
table.insert( tab, pl:Nick() )
table.insert( tab, ": " )
table.insert( tab, msg )
elseif pl:IsUserGroup("developer") then
table.insert( tab, Color( 255, 0, 0, 255 ) )
table.insert( tab, "[Dev] " )
table.insert( tab, Color( 255, 255, 255, 255 ) )
table.insert( tab, pl:Nick() )
table.insert( tab, ": " )
table.insert( tab, msg )
elseif pl:IsUserGroup("superadmin") then
table.insert( tab, Color( 33, 110, 252, 255 ) )
table.insert( tab, "[Super Admin] " )
table.insert( tab, Color( 255, 255, 255, 255 ) )
table.insert( tab, pl:Nick() )
table.insert( tab, ": " )
table.insert( tab, msg )
elseif pl:IsUserGroup("admin") then
table.insert( tab, Color( 33, 110, 252, 255 ) )
table.insert( tab, "[Admin] " )
table.insert( tab, Color( 255, 255, 255, 255 ) )
table.insert( tab, pl:Nick() )
table.insert( tab, ": " )
table.insert( tab, msg )
elseif pl:IsUserGroup("mod") then
table.insert( tab, Color( 245, 226, 20, 255 ) )
table.insert( tab, "[Mod] " )
table.insert( tab, Color( 255, 255, 255, 255 ) )
table.insert( tab, pl:Nick() )
table.insert( tab, ": " )
table.insert( tab, msg )
elseif pl:IsUserGroup("Member") then
table.insert( tab, Color( 194, 19, 153, 255 ) )
table.insert( tab, "[Member] " )
table.insert( tab, Color( 255, 255, 255, 255 ) )
table.insert( tab, pl:Nick() )
table.insert( tab, ": " )
table.insert( tab, msg )
elseif pl:IsUserGroup("vip") then
table.insert( tab, Color( 86, 185, 80, 255 ) )
table.insert( tab, "[Vip] " )
table.insert( tab, Color( 255, 255, 255, 255 ) )
table.insert( tab, pl:Nick() )
table.insert( tab, ": " )
table.insert( tab, msg )
else
table.insert( tab, Color( 86, 185, 80, 255 ) )
table.insert( tab, "[User] " )
table.insert( tab, Color( 255, 255, 255, 255 ) )
table.insert( tab, pl:Nick() )
table.insert( tab, ": " )
table.insert( tab, msg )
end
chat.AddText( unpack(tab) )
return true
end
hook.Add("OnPlayerChat", "InsertTags", Insert)
end
But, yea:
ULX is an administration mod and will probably never include chat tags.
-
He just said he doesn't want chat tags. lol
-
If you want chat tags, drop this into your server's garrysmod/lua/autorun folder. Name it "tags.lua"
if (SERVER) then
AddCSLuaFile("autorun/tags.lua")
end
if (CLIENT) then
function Insert( pl, msg )
local tab = {}
if pl:IsUserGroup("owner") then
table.insert( tab, Color( 255, 0, 0, 255 ) )
table.insert( tab, "[Owner] " )
table.insert( tab, Color( 255, 255, 255, 255 ) )
table.insert( tab, pl:Nick() )
table.insert( tab, ": " )
table.insert( tab, msg )
elseif pl:IsUserGroup("coowner") then
table.insert( tab, Color( 255, 0, 0, 255 ) )
table.insert( tab, "[Co Owner] " )
table.insert( tab, Color( 255, 255, 255, 255 ) )
table.insert( tab, pl:Nick() )
table.insert( tab, ": " )
table.insert( tab, msg )
elseif pl:IsUserGroup("developer") then
table.insert( tab, Color( 255, 0, 0, 255 ) )
table.insert( tab, "[Dev] " )
table.insert( tab, Color( 255, 255, 255, 255 ) )
table.insert( tab, pl:Nick() )
table.insert( tab, ": " )
table.insert( tab, msg )
elseif pl:IsUserGroup("superadmin") then
table.insert( tab, Color( 33, 110, 252, 255 ) )
table.insert( tab, "[Super Admin] " )
table.insert( tab, Color( 255, 255, 255, 255 ) )
table.insert( tab, pl:Nick() )
table.insert( tab, ": " )
table.insert( tab, msg )
elseif pl:IsUserGroup("admin") then
table.insert( tab, Color( 33, 110, 252, 255 ) )
table.insert( tab, "[Admin] " )
table.insert( tab, Color( 255, 255, 255, 255 ) )
table.insert( tab, pl:Nick() )
table.insert( tab, ": " )
table.insert( tab, msg )
elseif pl:IsUserGroup("mod") then
table.insert( tab, Color( 245, 226, 20, 255 ) )
table.insert( tab, "[Mod] " )
table.insert( tab, Color( 255, 255, 255, 255 ) )
table.insert( tab, pl:Nick() )
table.insert( tab, ": " )
table.insert( tab, msg )
elseif pl:IsUserGroup("Member") then
table.insert( tab, Color( 194, 19, 153, 255 ) )
table.insert( tab, "[Member] " )
table.insert( tab, Color( 255, 255, 255, 255 ) )
table.insert( tab, pl:Nick() )
table.insert( tab, ": " )
table.insert( tab, msg )
elseif pl:IsUserGroup("vip") then
table.insert( tab, Color( 86, 185, 80, 255 ) )
table.insert( tab, "[Vip] " )
table.insert( tab, Color( 255, 255, 255, 255 ) )
table.insert( tab, pl:Nick() )
table.insert( tab, ": " )
table.insert( tab, msg )
else
table.insert( tab, Color( 86, 185, 80, 255 ) )
table.insert( tab, "[User] " )
table.insert( tab, Color( 255, 255, 255, 255 ) )
table.insert( tab, pl:Nick() )
table.insert( tab, ": " )
table.insert( tab, msg )
end
chat.AddText( unpack(tab) )
return true
end
hook.Add("OnPlayerChat", "InsertTags", Insert)
end
But, yea:
That's a really inefficient way to make chat tags.
-
That's a really inefficient way to make chat tags.
Not really- automatic chat tags look ugly on some usergroups.
My opinion though.
(If you were talking about the usage of OnPlayerChat, yeah that I can agree with.)
-
Because we grow and are weary of the countless issues horrible lua programmers modify chat text, we never have or will modify outbound chat.
We only monitor inbound text for "!", and even then, at such an non-invasive level, most other horribly written chat monitoring functions that look for "!" almost always over-ride ours 99.9% of the time.
TL;DR
No, we don't have chat tags, unless you consider our psay and asay commands, which technically are not chat tags, but print messages to those players with seeasay and or targeted in the command.
-
I resolved my issue :P