Author Topic: Chat Icons  (Read 2428 times)

0 Members and 1 Guest are viewing this topic.

Offline PaperMoney

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Chat Icons
« on: July 13, 2015, 05:30:13 PM »
I want to know how to add icons to chat, like icon16/shield.png next to a players name if they're super admin, admin, or owner (ULX of course)

I know this is part of the code

Code: [Select]
 
        if ply:IsSuperAdmin() then
             
            icon = "icon16/shield_add.png"
             
        elseif ply:IsAdmin() then
             
            icon = "icon16/shield.png"
             
        elseif ply:IsUserGroup("owner") then
             
            icon = "icon16/shield_rainbow.png"
       
   elseif ply:IsUserGroup("moderator") then
             
            icon = "icon16/shield_silver.png"

    elseif ply:IsUserGroup("vip") then
             
            icon = "icon16/rosette_blue.png"
       
   end
end

But what else do i got to add to tell the server that I want certain ulx groups to get icons I select, please help!

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: Chat Icons
« Reply #1 on: July 13, 2015, 07:43:45 PM »
You need a custom chatbox.  Are you at least that far?

Offline PaperMoney

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Re: Chat Icons
« Reply #2 on: July 14, 2015, 12:12:40 AM »
You need a custom chatbox.  Are you at least that far?

Okay, well I am using a custom chat box that works indeed. Now I found this code,

Code: [Select]
local UserManagement = {
["owner"] = {Icon = "icon16/shield_rainbow.png"},
["superadmin"] = {Icon = "icon16/shield.png"},
["admin"] = {Icon = "icon16/shield_silver.png"},
["vip"] = {Icon = "icon16/rosette_blue.png"}
}

function util.GetUserIcon(ply)
if !ply then return end
local group =  ply:GetNWString( "UserGroup" )
local icon = UserManagement[group]
if icon then
return icon.Icon
end
return ""
end

Of course trying this, I got no errors but it did not show the icons next to my name in the chat box. I am very stuck and need help, anyone?

EDIT: Figured it out, just need to make my own chatbox or edit someones to add it all in, gonna have to search around and all. Forget it now, hehe :P
« Last Edit: July 14, 2015, 09:05:11 PM by PaperMoney »