• ULX or EVOLVE chat Tags
    22 replies, posted
Hey does any one know of any working chat tags for evolve or ulx ? I searched garrysmod.org but no luck Thanks
Evolve has built in chat tags, can't be fucked to explain them. Not sure about ULX.
Throw this in autorun (Not server or client) [lua]if SERVER then hook.Add( "PlayerSay", "Tags", function(ply, text, team) local rank if ply:IsSuperAdmin() then rank = "Superadmin" elseif ply:IsAdmin() then rank = "Admin" else rank = "User" end umsg.Start("_Tagsay") umsg.String(text) umsg.String(rank) umsg.Entity(ply) umsg.End() return false end) end if CLIENT then usermessage.Hook("_Tagsay", function (um) local text = um:ReadString() local rank = um:ReadString() or "User" local ply = um:ReadEntity() if !rank or !text or !ply then return end ChatAdd(rank,text, ply) end) function ChatAdd(rank, text, ply) chat.AddText("",Color(255,125,0),"[",Color(125,0,0),rank,Color(255,125,0),"] ",Color(0,125,25),ply:Nick()..": ",Color(255,255,255),text) end end[/lua] [img]http://dl.dropbox.com/u/8718166/falws.jpg[/img] [img]http://dl.dropbox.com/u/8718166/falws1.png[/img] [img]http://dl.dropbox.com/u/8718166/falws2.png[/img]
[QUOTE=Science;30007295]Throw this in autorun (Not server or client) [lua]if SERVER then hook.Add( "PlayerSay", "Tags", function(ply, text, team) local rank if ply:IsSuperAdmin() then rank = "Superadmin" elseif ply:IsAdmin() then rank = "Admin" else rank = "User" end umsg.Start("_Tagsay") umsg.String(text) umsg.String(rank) umsg.Entity(ply) umsg.End() return false end) end if CLIENT then usermessage.Hook("_Tagsay", function (um) local text = um:ReadString() local rank = um:ReadString() or "User" local ply = um:ReadEntity() if !rank or !text or !ply then return end ChatAdd(rank,text, ply) end) function ChatAdd(rank, text, ply) chat.AddText("",Color(255,125,0),"[",Color(125,0,0),rank,Color(255,125,0),"] ",Color(0,125,25),ply:Nick()..": ",Color(255,255,255),text) end end[/lua] [img]http://dl.dropbox.com/u/8718166/falws.jpg[/img] [img]http://dl.dropbox.com/u/8718166/falws1.png[/img] [img]http://dl.dropbox.com/u/8718166/falws2.png[/img][/QUOTE] Thanks alot! :)
[QUOTE=ChubZz;30009244]Thanks alot! :)[/QUOTE] No problem. You gave me the idea, i may make a chat sort of menu with a few decent and easy to change features, wont exactly be the best eye candy but will be feature full and then move onto looks.
Im running a gmod server.. I tried naming the file autocexec and putting it in autorun.. the only autorun file I could find was in lua so I made it autocexec.lua and then no one could time, I then removed it (Fixed) and now I don't know where to put it to get it to work or does it not work anymore?
unhandled usermessage
[CODE]if SERVER then [U]AddCSLuaFile("nameoffile.lua")[/U] hook.Add( "PlayerSay", "Tags", function(ply, text, team) local rank if ply:IsSuperAdmin() then rank = "Superadmin" elseif ply:IsAdmin() then rank = "Admin" else rank = "User" end umsg.Start("_Tagsay") umsg.String(text) umsg.String(rank) umsg.Entity(ply) umsg.End() return false end) end if CLIENT then [U]include("nameoffile.lua")[/U] usermessage.Hook("_Tagsay", function (um) local text = um:ReadString() local rank = um:ReadString() or "User" local ply = um:ReadEntity() if !rank or !text or !ply then return end ChatAdd(rank,text, ply) end) function ChatAdd(rank, text, ply) chat.AddText("",Color(255,125,0),"[",Color(125,0,0),rank,Color(255,125,0),"] ",Color(0,125,25),ply:Nick()..": ",Color(255,255,255),text) end end[/CODE] That should fix it, though edit the lines with underlines to fit your needs :3
Include -> include.
well what am i including?
agreed what AM i supposed to be including
You need to include the shared file with the script inside of it so it can be sent to the clients and they won't receive a usermessage error.
Including the file from inside itself doesn't make sense. You're just making an infinite loop. If you place the file in the autorun folder, you only need to AddCSLuaFile it so that it gets sent to all clients.
[QUOTE=Divran;36827521]Including the file from inside itself doesn't make sense. You're just making an infinite loop. If you place the file in the autorun folder, you only need to AddCSLuaFile it so that it gets sent to all clients.[/QUOTE] Well it wouldnt matter if it works that way. I would be more worried about it if we were talking about CPP not LUA
Edit. nvm)
I tested this on a TTT server and people can see what people say in team chat. Any fixes?
[QUOTE=Sm63;39271320]I tested this on a TTT server and people can see what people say in team chat. Any fixes?[/QUOTE] This may be from 2011, for a different version of Garry's mod?
Nice necro Sm63. This probably doesn't work because it wasn't made for GM13.
if SERVER then hook.Add( "PlayerSay", "Tags", function(ply, text, team) local rank if ply:IsSuperAdmin() then rank = "Superadmin" elseif ply:IsAdmin() then rank = "Admin" else rank = "User" end umsg.Start("_Tagsay") umsg.String(text) umsg.String(rank) umsg.Entity(ply) umsg.End() return false end) end if CLIENT then usermessage.Hook("_Tagsay", function (um) local text = um:ReadString() local rank = um:ReadString() or "User" local ply = um:ReadEntity() if !rank or !text or !ply then return end ChatAdd(rank,text, ply) end) function ChatAdd(rank, text, ply) chat.AddText("",Color(255,125,0),"[",Color(125,0,0),rank,Color(255,125,0),"] ",Color(0,125,25),ply:Nick()..": ",Color(255,255,255),text) end end i am a bit new so wheres autorun exacly ;P
First off, try not to bump 7 month old threads. ALWAYS encase your code with code or lua tags [.code][./code] or [.lua][./lua] (no periods) autorun is in garrysmod/garrysmod/lua/autorun
[QUOTE=Science;30007295]Throw this in autorun (Not server or client) [lua]if SERVER then hook.Add( "PlayerSay", "Tags", function(ply, text, team) local rank if ply:IsSuperAdmin() then rank = "Superadmin" elseif ply:IsAdmin() then rank = "Admin" else rank = "User" end umsg.Start("_Tagsay") umsg.String(text) umsg.String(rank) umsg.Entity(ply) umsg.End() return false end) end if CLIENT then usermessage.Hook("_Tagsay", function (um) local text = um:ReadString() local rank = um:ReadString() or "User" local ply = um:ReadEntity() if !rank or !text or !ply then return end ChatAdd(rank,text, ply) end) function ChatAdd(rank, text, ply) chat.AddText("",Color(255,125,0),"[",Color(125,0,0),rank,Color(255,125,0),"] ",Color(0,125,25),ply:Nick()..": ",Color(255,255,255),text) end end[/lua] [img]http://dl.dropbox.com/u/8718166/falws.jpg[/img] [img]http://dl.dropbox.com/u/8718166/falws1.png[/img] [img]http://dl.dropbox.com/u/8718166/falws2.png[/img][/QUOTE] Wait i got the autorun folder what do i do now?
[QUOTE=beau99;45398792]Wait i got the autorun folder what do i do now?[/QUOTE] This thread is a bit old, though. Anyway, in your autorun folder, create a new file called "chattags.lua", note the extension, it should not be a txt, but a Lua file. Copy/Paste the entire code that Mr. Science posted earlier in the file and save it; then restart your server.
This is a more updated version that I whipped up fairly quickly: [LUA]-- this is the name of each usergroup that the tag will print local names = { ["superadmin"] = "SuperAdmin", ["admin"] = "Admin", ["user"] = "User", } --this is the color of each usergroups tag local colors = { ["superadmin"] = Color( 255, 0, 0 ), ["admin"] = Color( 125, 125, 0 ), ["user"] = Color( 255, 255, 255 ), } if SERVER then util.AddNetworkString( "ChatTags" ) hook.Add( "PlayerSay", "ChatTags", function( ply, text, team ) if names[ply:GetUserGroup()] then --if the group has a tag to display for _, v in ipairs( player.GetAll() ) do if team then if v:Team() == ply:Team() then net.Start( "ChatTags" ) net.WriteEntity( ply ) net.WriteString( text ) net.WriteBit( team ) net.Send( v ) end else net.Start( "ChatTags" ) net.WriteEntity( ply ) net.WriteString( text ) net.WriteBit( team ) net.Send( v ) end return false --cancel their chat in order to modify it clientside end end ) else -- CLIENT local def = Color( 255, 255, 255 ) --default chat color. net.Receive( "ChatTags", function() local ply = net.ReadEntity() local text = net.ReadString() local team = net.ReadBit() == 1 if IsValid( ply ) and ply:IsPlayer() then --will be null entity if player leaves before the net message arrives local name = names[ply:GetUserGroup()] local color = colors[ply:GetUserGroup()] chat.AddText( Color( 255, 255, 255 ), "[", color, name, Color( 255, 255, 255 ), "] ", Color( 0, 200, 0 ), team and "(TEAM) " or "", color, ply:Name(), def, ": ", text ) end end ) end [/LUA]
Sorry, you need to Log In to post a reply to this thread.