ULX

Author Topic: Admin Chat  (Read 4980 times)

0 Members and 1 Guest are viewing this topic.

Offline sabo

  • Full Member
  • ***
  • Posts: 136
  • Karma: 2
  • Hello :)
    • The Elite Gaming
Admin Chat
« on: September 13, 2013, 01:33:54 PM »
Hello.

I have a TTT server on which I have alot of staff members.

Sometimes it is hard to overlook who is what rank or if the person is a staff rank...

Here is my suggestion:

If a staff member (can be stated in a config file maybe) writes in admin chat it will be something like this:

Admin sabo: Hello!

If a non Staff member types to admins:

To Admins sabo: Hello!

What do you guys think about this?

I am simply suggesting to make it visually differentiated if the person typing in admin chat is staff or not.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6213
  • Karma: 394
  • Project Lead
Re: Admin Chat
« Reply #1 on: September 13, 2013, 03:14:38 PM »
Our method of logging does not currently allow arbitrary color change like this, but it would be a relatively straight forward modification to add some text indicating the user's position. Do you really have the admin chat used that frequently?
Experiencing God's grace one day at a time.

Offline aaron

  • Newbie
  • *
  • Posts: 14
  • Karma: 1
Re: Admin Chat
« Reply #2 on: September 13, 2013, 03:34:14 PM »
Our method of logging does not currently allow arbitrary color change like this, but it would be a relatively straight forward modification to add some text indicating the user's position. Do you really have the admin chat used that frequently?

I'm staff on the server and the admin chat is a pretty big thing in there among all the staff. We use it quite a lot.

It would be nice to have something to distinguish between a user and a staff member, although it isnt that big of a deal in my opinion.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Admin Chat
« Reply #3 on: September 13, 2013, 04:32:06 PM »
Try this..

Replace inside of ULX/lua/ulx/modules/sh/chat.lua
(Make a backup first!)
Code: [Select]
function ulx.asay( calling_ply, message )

local players = player.GetAll()
for i=#players, 1, -1 do
local v = players[ i ]
if ULib.ucl.query( v, seeasayAccess ) and v ~= calling_ply then
if ULib.ucl.query( calling_ply, seeasayAccess ) then
ULib.tsayColor(v, 1, Color(255,0,0), "::Admin:: ", team.GetColor(calling_ply:Team()), calling_ply:Nick(), Color(255,255,255), ": ", message )
else
ULib.tsayColor(v, 1, Color(255,255,0), "::Non Admin:: ", team.GetColor(calling_ply:Team()), calling_ply:Nick(), Color(255,255,255), ": ", message )
end
end
if v == calling_ply then
ULib.tsayColor(v, 1, Color(0,255,0), "::To Admins:: ", team.GetColor(calling_ply:Team()), calling_ply:Nick(), Color(255,255,255), ": ", message )
end
end

local logFile = ulx.convar( "logFile", "1", "Log to file (Can still echo if off). This is a global setting, nothing will be logged to file with this off.", ULib.ACCESS_SUPERADMIN )
if logFile:GetBool() then
ulx.logString( calling_ply:Nick() .. " to admins: " .. message, true )
end
end
local asay = ulx.command( CATEGORY_NAME, "ulx asay", ulx.asay, "@", true, true )
asay:addParam{ type=ULib.cmds.StringArg, hint="message", ULib.cmds.takeRestOfLine }
asay:defaultAccess( ULib.ACCESS_ALL )
asay:help( "Send a message to currently connected admins." )


It should look like this:
An admin for the purposes of this script is anyone with 'ulx seeasay' access. (Anyone who can read admin chat)
It also uses the color of your team name like regular chat does.

You say something: ::To Admins:: MrPresident: Hello there! I'm just testing this.

Admin says something: ::Admin:: MrPresident: Hello there! I'm just testing this.

Non-Admin says something: ::Non Admin:: MrPresident: Hello there! I'm just testing this.

Offline sabo

  • Full Member
  • ***
  • Posts: 136
  • Karma: 2
  • Hello :)
    • The Elite Gaming
Re: Admin Chat
« Reply #4 on: September 15, 2013, 07:11:51 AM »
Thanks alot Mr President!!

So here is what I used:

Code: [Select]
function ulx.asay( calling_ply, message )

local players = player.GetAll()
for i=#players, 1, -1 do
local v = players[ i ]
if ULib.ucl.query( v, seeasayAccess ) and v ~= calling_ply then
if ULib.ucl.query( calling_ply, seeasayAccess ) then
ULib.tsayColor(v, 1, Color(65,105,225), "::Admin:: ", team.GetColor(calling_ply:Team()), calling_ply:Nick(), Color(112,138,144), ": ", message )
else
ULib.tsayColor(v, 1, Color(0,0,0), "::User:: ", team.GetColor(calling_ply:Team()), calling_ply:Nick(), Color(119,136,153), ": ", message )
end
end
if v == calling_ply then
ULib.tsayColor(v, 1, Color(49,79,79), "::To Admins:: ", team.GetColor(calling_ply:Team()), calling_ply:Nick(), Color(112,138,144), ": ", message )
end
end

ulx.fancyLog( players, format, calling_ply, message )
end
local asay = ulx.command( CATEGORY_NAME, "ulx asay", ulx.asay, "@", true, true )
asay:addParam{ type=ULib.cmds.StringArg, hint="message", ULib.cmds.takeRestOfLine }
asay:defaultAccess( ULib.ACCESS_ALL )
asay:help( "Send a message to currently connected admins." )


I am confused about this part from you:

Code: [Select]
local logFile = ulx.convar( "logFile", "1", "Log to file (Can still echo if off). This is a global setting, nothing will be logged to file with this off.", ULib.ACCESS_SUPERADMIN )
if logFile:GetBool() then
ulx.logString( calling_ply:Nick() .. " to admins: " .. message, true )
end
end
local asay = ulx.command( CATEGORY_NAME, "ulx asay", ulx.asay, "@", true, true )
asay:addParam{ type=ULib.cmds.StringArg, hint="message", ULib.cmds.takeRestOfLine }
asay:defaultAccess( ULib.ACCESS_ALL )
asay:help( "Send a message to currently connected admins." )

Not sure if I should replace it with my current one :O

Do you mind explaining why you have that? :I

Thanks again!

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Admin Chat
« Reply #5 on: September 15, 2013, 03:17:22 PM »
FancyLog prints to the chat. Essentially you'd have every message twice for admins.

I just extracted the part from the logging file that actually logged to the log file without printing to the chat since we already do that in the code.