Author Topic: Chat Tags  (Read 3119 times)

0 Members and 1 Guest are viewing this topic.

Offline strategos

  • Jr. Member
  • **
  • Posts: 66
  • Karma: 2
  • I wanna be the guy
    • Community
Chat Tags
« on: September 03, 2011, 02:22:42 PM »
Do you know of a release or plugin that works with the SVN and adds a tag to a player's chat? example: [chat-tag-here] Strategos: Talk text here.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Chat Tags
« Reply #1 on: September 04, 2011, 03:06:37 PM »
Similar discussion.
http://forums.ulyssesmod.net/index.php/topic,5365.0.html
Links to a download that is not ULX group related, no idea if it works with ULX.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline strategos

  • Jr. Member
  • **
  • Posts: 66
  • Karma: 2
  • I wanna be the guy
    • Community
Re: Chat Tags
« Reply #2 on: September 05, 2011, 09:52:31 PM »
It doesn't. I managed to find some code though that is better. It's easy to convert the (IsAdmin) to ply:IsUserGroup()
However, since i'm running an RP server, the chat functions differently and it ends up duplicating the text like it was sandbox but with the tag only appears on the second 1.

Example:

               (OOC) Strategos: test
               [Owner] Strategos: test

Below, is the raw, unedited code (thanks to "science" for releasing it!)

Quote
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

Maybe you guys would know how to make it affective in /ooc chat (and all) and stop it from duplicating.


Offline strategos

  • Jr. Member
  • **
  • Posts: 66
  • Karma: 2
  • I wanna be the guy
    • Community
Re: Chat Tags
« Reply #3 on: September 11, 2011, 02:45:47 AM »
EDITED BECAUSE PEOPLE KEEP STEALING IT!
« Last Edit: December 21, 2011, 09:53:36 AM by strategos »