ULX

Author Topic: Latest ulx have built in chat tags?  (Read 4742 times)

0 Members and 1 Guest are viewing this topic.

Offline frustratedgamers

  • Newbie
  • *
  • Posts: 36
  • Karma: -1
Latest ulx have built in chat tags?
« 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

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!"

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: Latest ulx have built in chat tags?
« Reply #1 on: April 21, 2014, 12:36:12 AM »
ULX is an administration mod and will probably never include chat tags.
Out of the Garry's Mod business.

Offline Zmaster

  • Full Member
  • ***
  • Posts: 235
  • Karma: 25
Re: Latest ulx have built in chat tags?
« Reply #2 on: April 21, 2014, 10:22:46 AM »
If you want chat tags, drop this into your server's garrysmod/lua/autorun folder. Name it "tags.lua"

Code: [Select]
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.

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: Latest ulx have built in chat tags?
« Reply #3 on: April 21, 2014, 11:30:35 AM »
He just said he doesn't want chat tags. lol
Out of the Garry's Mod business.

Offline Cobalt

  • Full Member
  • ***
  • Posts: 216
  • Karma: 44
  • http://steamcommunity.com/id/__yvl/
Re: Latest ulx have built in chat tags?
« Reply #4 on: April 21, 2014, 01:48:36 PM »
If you want chat tags, drop this into your server's garrysmod/lua/autorun folder. Name it "tags.lua"

Code: [Select]
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.

Offline Bytewave

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 718
  • Karma: 116
  • :)
    • My Homepage
Re: Latest ulx have built in chat tags?
« Reply #5 on: April 21, 2014, 01:50:26 PM »
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.)
bw81@ulysses-forums ~ % whoami
Homepage

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Latest ulx have built in chat tags?
« Reply #6 on: April 21, 2014, 09:41:58 PM »
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.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline frustratedgamers

  • Newbie
  • *
  • Posts: 36
  • Karma: -1
Re: Latest ulx have built in chat tags?
« Reply #7 on: April 21, 2014, 10:08:03 PM »
I resolved my issue :P