function Remove_Peer(id)
local peer = managers.network._session:peer(id)
if peer then
managers.network._session:on_peer_kicked(peer, id, 2)
managers.network._session:send_to_peers("kick_peer", id, 2)
end
end
if managers.network._session and #managers.network:session():peers() > 0 and Network:is_server() then
local menu_options = {}
for _, peer in pairs(managers.network:session():peers()) do
if peer:rank() and peer:level() then
menu_options[#menu_options+1] ={text = "(" .. peer:rank() .. "-" .. peer:level() .. ") " .. peer:name(), data = peer:id(), callback = Remove_Peer}
else
menu_options[#menu_options+1] ={text = peer:name(), data = peer:id(), callback = Remove_Peer}
end
end
menu_options[#menu_options+1] = {text = "Return", is_cancel_button = true}
local menu = QuickMenu:new("Disconnect", "Select who to disconnect", menu_options)
menu:Show()
end