General > Developers Corner
all messages are in the chat
Chrinis:
how to disable that all messages are in the chat?
Player Majin left the game (Disconnect by user.)
Player Majin has joined the game
Timmy:
Certain types of messages can be filtered using the ChatText hook. The example below suppresses the default join/leave messages.
--- Code: ----- client-side
hook.Add( "ChatText", "HideJoinLeave", function( index, name, text, type )
if type == "joinleave" then
return true
end
end )
--- End code ---
Timmy:
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.
Timmy:
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: ----- server-side
hook.Add( "PlayerDisconnected", "KarmaBanNotification", function( ply )
if ply.karma_kicked then
PrintMessage( HUD_PRINTTALK, "[SERVER] Karma banned " .. ply:Nick() )
end
end )
--- End code ---
Timmy:
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.
Navigation
[0] Message Index
[#] Next page
Go to full version