Ulysses

General => Off-Topic => Topic started by: strategos on September 03, 2011, 02:22:42 PM

Title: Chat Tags
Post by: strategos 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.
Title: Re: Chat Tags
Post by: JamminR 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.
Title: Re: Chat Tags
Post by: strategos 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.

Title: Re: Chat Tags
Post by: strategos on September 11, 2011, 02:45:47 AM
EDITED BECAUSE PEOPLE KEEP STEALING IT!