• Print

Author Topic: ULX Staff CHat help?  (Read 10631 times)

0 Members and 1 Guest are viewing this topic.

Offline admiralmirage

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
ULX Staff CHat help?
« on: March 14, 2018, 07:26:20 pm »
Hey Ulysses!
I went to Facepunch with this problem, but we seem to be having trouble!
I want to change the Staff Chat (@<message> for staff) and so far, we have
Code: [Select]
function ulx.asay(calling_ply,message)
local format = "[STAFF] #P: #s"
message = message:sub(calling_ply:Nick():len() + 1)

local players = player.GetAll()
for i=#players, 1, -1 do
local v = players[ i ]
if not ULib.ucl.query( v, seeasayAccess ) and v ~= calling_ply then -- Calling player always gets to see the echo
table.remove( players, i )
end
end

ulx.fancyLog( players, format, calling_ply, message )
end

The input was @Test, the output is
Code: [Select]
[STAFF] You:
The message just... doesnt show up. What I want it to say is
Code: [Select]
[STAFF] Admiral Mirage: Testbut replace Admiral Mirage with whatever user typed @test

What is the problem? How do I fix?

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: ULX Staff CHat help?
« Reply #1 on: March 14, 2018, 07:31:26 pm »
Code: Lua
  1. message = message:sub(calling_ply:Nick():len() + 1)

What is the purpose of this line? This is what's causing the issue.
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline admiralmirage

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: ULX Staff CHat help?
« Reply #2 on: March 14, 2018, 07:33:18 pm »
How do I get it to stop saying "You" and make it whoever sent the message?

Offline BlueNova

  • Full Member
  • ***
  • Posts: 113
  • Karma: 13
  • The most powerful force in the universe.
Re: ULX Staff CHat help?
« Reply #3 on: March 14, 2018, 07:39:08 pm »
How do I get it to stop saying "You" and make it whoever sent the message?

Go into log.lua and change the outputs of it. I'll provide an example

Here's the original...
Code: Lua
  1. if target == showing_ply then
  2.         if not use_self_suffix or calling_ply ~= showing_ply then
  3.                 table.insert( strs, "You" )
  4.         else
  5.                 table.insert( strs, "Yourself" )
  6.         end
  7. elseif not use_self_suffix or calling_ply ~= target_list[ i ] or anonymous then
  8.         table.insert( strs, target_list[ i ]:IsValid() and target_list[ i ]:Nick() or "(Console)" )
  9. else
  10.         table.insert( strs, "Themself" )
  11. end

And here's what I changed it to

Code: Lua
  1. if target == showing_ply then
  2.         if not use_self_suffix or calling_ply ~= showing_ply then
  3.                 table.insert( strs, showing_ply:Nick() )
  4.         else
  5.                 table.insert( strs, target:Nick() )
  6.         end
  7. elseif not use_self_suffix or calling_ply ~= target_list[ i ] or anonymous then
  8.         table.insert( strs, target_list[ i ]:IsValid() and target_list[ i ]:Nick() or "(Console)" )
  9. else
  10.         table.insert( strs, target:Nick() )
  11. end

I would recommend backing up the file or at least making a copy of what you're changing so if you mess something up you can easily repair it.
The files directory path would be /ulx/lua/ulx/log.lua

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: ULX Staff CHat help?
« Reply #4 on: March 14, 2018, 07:40:17 pm »
"You" is only sent to you. ulx.fancyLog replaces the name with proper logic. To everyone else, it will say your name. To you, it says "You". If someone else sends a message, it will show their name.
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline admiralmirage

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: ULX Staff CHat help?
« Reply #5 on: March 14, 2018, 07:44:22 pm »
"You" is only sent to you. ulx.fancyLog replaces the name with proper logic. To everyone else, it will say your name. To you, it says "You". If someone else sends a message, it will show their name.

I know that, but I think it looks nicer when it shows your name, so I will try what the post above yours said.

Offline admiralmirage

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: ULX Staff CHat help?
« Reply #6 on: March 14, 2018, 08:02:20 pm »
Go into log.lua and change the outputs of it. I'll provide an example

Here's the original...
Code: Lua
  1. if target == showing_ply then
  2.         if not use_self_suffix or calling_ply ~= showing_ply then
  3.                 table.insert( strs, "You" )
  4.         else
  5.                 table.insert( strs, "Yourself" )
  6.         end
  7. elseif not use_self_suffix or calling_ply ~= target_list[ i ] or anonymous then
  8.         table.insert( strs, target_list[ i ]:IsValid() and target_list[ i ]:Nick() or "(Console)" )
  9. else
  10.         table.insert( strs, "Themself" )
  11. end

And here's what I changed it to

Code: Lua
  1. if target == showing_ply then
  2.         if not use_self_suffix or calling_ply ~= showing_ply then
  3.                 table.insert( strs, showing_ply:Nick() )
  4.         else
  5.                 table.insert( strs, target:Nick() )
  6.         end
  7. elseif not use_self_suffix or calling_ply ~= target_list[ i ] or anonymous then
  8.         table.insert( strs, target_list[ i ]:IsValid() and target_list[ i ]:Nick() or "(Console)" )
  9. else
  10.         table.insert( strs, target:Nick() )
  11. end

I would recommend backing up the file or at least making a copy of what you're changing so if you mess something up you can easily repair it.
The files directory path would be /ulx/lua/ulx/log.lua

I changed this, and it is back to just not showing up. You type @ test, and no chat message shows up at all :P

Offline BlueNova

  • Full Member
  • ***
  • Posts: 113
  • Karma: 13
  • The most powerful force in the universe.
Re: ULX Staff CHat help?
« Reply #7 on: March 14, 2018, 08:03:36 pm »
I changed this, and it is back to just not showing up. You type @ test, and no chat message shows up at all :P

Must have a syntax error somewhere. I used this on several of my servers and it's worked fine ;)

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: ULX Staff CHat help?
« Reply #8 on: March 14, 2018, 08:04:29 pm »
I changed this, and it is back to just not showing up. You type @ test, and no chat message shows up at all [emoji14]
Did you remove the message = part?

Sent using Tapatalk. Owner of iViscosity Gaming.

I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline admiralmirage

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: ULX Staff CHat help?
« Reply #9 on: March 14, 2018, 08:09:04 pm »
This is the EXACT thing I put in there. A copy & paste.
Code: [Select]
for i=1, #target_list do
local target = target_list[ i ]
table.insert( strs, plyColor( target, showing_ply ) )
if target == showing_ply then
if not use_self_suffix or calling_ply ~= showing_ply then
                table.insert( strs, showing_ply:Nick() )
else
                table.insert( strs, target:Nick() )
end
elseif not use_self_suffix or calling_ply ~= target_list[ i ] or anonymous then
table.insert( strs, target_list[ i ]:IsValid() and target_list[ i ]:Nick() or "(Console)" )
else
table.insert( strs, target:Nick() )
end

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: ULX Staff CHat help?
« Reply #10 on: March 14, 2018, 08:10:13 pm »
This is the EXACT thing I put in there. A copy & paste.
Code: [Select]
for i=1, #target_list do
local target = target_list[ i ]
table.insert( strs, plyColor( target, showing_ply ) )
if target == showing_ply then
if not use_self_suffix or calling_ply ~= showing_ply then
                table.insert( strs, showing_ply:Nick() )
else
                table.insert( strs, target:Nick() )
end
elseif not use_self_suffix or calling_ply ~= target_list[ i ] or anonymous then
table.insert( strs, target_list[ i ]:IsValid() and target_list[ i ]:Nick() or "(Console)" )
else
table.insert( strs, target:Nick() )
end
I mean in the asay command.

Sent using Tapatalk. Owner of iViscosity Gaming.

I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline admiralmirage

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: ULX Staff CHat help?
« Reply #11 on: March 14, 2018, 08:11:34 pm »
Code: [Select]
function ulx.asay(calling_ply,message)
local format = "[STAFF] #P: #s"

local players = player.GetAll()
for i=#players, 1, -1 do
local v = players[ i ]
if not ULib.ucl.query( v, seeasayAccess ) and v ~= calling_ply then -- Calling player always gets to see the echo
table.remove( players, i )
end
end

ulx.fancyLog( players, format, calling_ply, message )
end

Offline BlueNova

  • Full Member
  • ***
  • Posts: 113
  • Karma: 13
  • The most powerful force in the universe.
Re: ULX Staff CHat help?
« Reply #12 on: March 14, 2018, 08:15:51 pm »
This is the EXACT thing I put in there. A copy & paste.
Code: [Select]
for i=1, #target_list do
local target = target_list[ i ]
table.insert( strs, plyColor( target, showing_ply ) )
if target == showing_ply then
if not use_self_suffix or calling_ply ~= showing_ply then
                table.insert( strs, showing_ply:Nick() )
else
                table.insert( strs, target:Nick() )
end
elseif not use_self_suffix or calling_ply ~= target_list[ i ] or anonymous then
table.insert( strs, target_list[ i ]:IsValid() and target_list[ i ]:Nick() or "(Console)" )
else
table.insert( strs, target:Nick() )
end

May be a silly question to ask. But where did you put this? If it's in the log.lua file did you replace what was originally there around line 370? Or did you just drop in in the file and save it?

Offline admiralmirage

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: ULX Staff CHat help?
« Reply #13 on: March 14, 2018, 08:20:58 pm »
I replaced the old one, why?

Offline BlueNova

  • Full Member
  • ***
  • Posts: 113
  • Karma: 13
  • The most powerful force in the universe.
Re: ULX Staff CHat help?
« Reply #14 on: March 14, 2018, 08:29:55 pm »
I replaced the old one, why?

Ok, well do you have any errors in your game, either through your console or the server side console?



Because the little snippet I gave you will work. Has worked for me before so must be something that tripped over it's own feet that you'd need to fix.
« Last Edit: March 14, 2018, 08:32:55 pm by BlueNova »

  • Print