let players know when and why someone leaves the server
This commit is contained in:
parent
b4bd8be9d8
commit
0bebffd389
@ -0,0 +1,10 @@
|
||||
|
||||
net.Receive("edshot_player_disconnect_message_broadcast", function()
|
||||
local name = net.ReadString()
|
||||
local reason = net.ReadString()
|
||||
|
||||
if name and reason then
|
||||
local message = "Player " .. name .. " has left the game (" .. reason .. ")"
|
||||
chat.AddText(Color(255, 110, 110), message)
|
||||
end
|
||||
end)
|
@ -0,0 +1,11 @@
|
||||
|
||||
util.AddNetworkString("edshot_player_disconnect_message_broadcast")
|
||||
gameevent.Listen("player_disconnect")
|
||||
hook.Add("player_disconnect", "edshot_player_disconnect_message", function(data)
|
||||
if not data.bot then
|
||||
net.Start("edshot_player_disconnect_message_broadcast")
|
||||
net.WriteString(data.name)
|
||||
net.WriteString(data.reason)
|
||||
net.Broadcast()
|
||||
end
|
||||
end)
|
Loading…
Reference in New Issue
Block a user