General > Developers Corner

Latest ulx have built in chat tags?

(1/2) > >>

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

Neku:
ULX is an administration mod and will probably never include chat tags.

Zmaster:
If you want chat tags, drop this into your server's garrysmod/lua/autorun folder. Name it "tags.lua"


--- Code: ---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
--- End code ---

But, yea:

--- Quote from: Neku on April 21, 2014, 12:36:12 AM ---ULX is an administration mod and will probably never include chat tags.

--- End quote ---

Neku:
He just said he doesn't want chat tags. lol

Cobalt:

--- Quote from: Zmaster 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: ---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
--- End code ---

But, yea:

--- End quote ---
That's a really inefficient way to make chat tags.

Navigation

[0] Message Index

[#] Next page

Go to full version