ULX

Author Topic: all messages are in the chat  (Read 1077 times)

0 Members and 1 Guest are viewing this topic.

Offline Chrinis

  • Newbie
  • *
  • Posts: 1
  • Karma: -1
all messages are in the chat
« on: November 10, 2018, 08:16:26 AM »
how to disable that all messages are in the chat?

Player Majin left the game (Disconnect by user.)
Player Majin has joined the game

Offline Timmy

  • Respected Community Member
  • Full Member
  • *****
  • Posts: 200
  • Karma: 153
  • Code monkey
    • ULX Unofficial Documentation
Re: all messages are in the chat
« Reply #1 on: November 11, 2018, 12:05:29 PM »
Certain types of messages can be filtered using the ChatText hook. The example below suppresses the default join/leave messages.

Code: [Select]
-- client-side
hook.Add( "ChatText", "HideJoinLeave", function( index, name, text, type )
  if type == "joinleave" then
    return true
  end
end )
“When given the choice between being right or being kind, choose kind.”  —Dr. Wayne Dyer

Offline Timmy

  • Respected Community Member
  • Full Member
  • *****
  • Posts: 200
  • Karma: 153
  • Code monkey
    • ULX Unofficial Documentation
Re: all messages are in the chat
« Reply #2 on: November 17, 2018, 01:03:07 PM »
Any client-side Lua file will do.

For example: (garrysmod)/lua/autorun/client/hidejoinleave.lua

Servers will automatically send files inside (garrysmod)/lua/autorun/client to clients, and clients will automatically run them.
“When given the choice between being right or being kind, choose kind.”  —Dr. Wayne Dyer

Offline Timmy

  • Respected Community Member
  • Full Member
  • *****
  • Posts: 200
  • Karma: 153
  • Code monkey
    • ULX Unofficial Documentation
Re: all messages are in the chat
« Reply #3 on: November 26, 2018, 11:08:11 AM »
Seems like TTT does not provide this kind of feedback to other players.

It only takes a couple of lines to add this. I have added an example below.

Code: [Select]
-- server-side
hook.Add( "PlayerDisconnected", "KarmaBanNotification", function( ply )
    if ply.karma_kicked then
        PrintMessage( HUD_PRINTTALK, "[SERVER] Karma banned " .. ply:Nick() )
    end
end )
“When given the choice between being right or being kind, choose kind.”  —Dr. Wayne Dyer

Offline Timmy

  • Respected Community Member
  • Full Member
  • *****
  • Posts: 200
  • Karma: 153
  • Code monkey
    • ULX Unofficial Documentation
Re: all messages are in the chat
« Reply #4 on: December 22, 2018, 11:01:26 PM »
I test the code I post, but I don't have a crystal ball.

You need to be precise and informative about your problem if you want more help from me.
“When given the choice between being right or being kind, choose kind.”  —Dr. Wayne Dyer

Offline Timmy

  • Respected Community Member
  • Full Member
  • *****
  • Posts: 200
  • Karma: 153
  • Code monkey
    • ULX Unofficial Documentation
Re: all messages are in the chat
« Reply #5 on: December 29, 2018, 02:17:04 PM »
Can you help me narrow down the possibilities by answering these questions?

#1 - Where did you put the script?
Examples:
  • c:\srcds\garrysmod\lua\autorun\server\myfile.lua
  • c:\Program files\Steam\steamapps\common\GarrysMod\garrysmod\lua\autorun\server\myfile.lua
  • /home/garry/srcds/garrysmod/lua/autorun/server/myfile.lua

#2 - What is the output of the command below?
Open your console and run the following command:
Code: [Select]
ulx rcon sv_hibernate_think 1; ulx luarun =hook.GetTable().PlayerDisconnected
Example output:
xgui_ply_disconnect   =   function: 0xf1dcc6c8
ULXMaulDisconnectedCheck   =   function: 0xf210f988
ULXLogDisconnect   =   function: 0xf20f9fe8
ulxSlotsDisconnect   =   function: 0xf20e1b80
ULXVoteDisconnect   =   function: 0xf2199970
KarmaBanNotification   =   function: 0xf1fe2ef0
ULXJailDisconnectedCheck   =   function: 0xf209e810
ULXRagdollDisconnectedCheck   =   function: 0xf2155178
ULibUCLDisconnect   =   function: 0xf219ef18
“When given the choice between being right or being kind, choose kind.”  —Dr. Wayne Dyer

Offline Timmy

  • Respected Community Member
  • Full Member
  • *****
  • Posts: 200
  • Karma: 153
  • Code monkey
    • ULX Unofficial Documentation
Re: all messages are in the chat
« Reply #6 on: February 04, 2019, 02:56:24 PM »
Oh, I see you removed your posts. I'm sorry if I wasn't able to help you.

Hope you figured out what the problem was.
“When given the choice between being right or being kind, choose kind.”  —Dr. Wayne Dyer