Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | GeorgeLovesJesus |
Hey,
I have a network system.
I want to notify myself (the host) if my server wasn’t initialized due to not being connected to a network (it shouldn’t depend on an internet if based statement idea).
Here’s the code used for the server’s initialization:
func initialize_server():
var peer = NetworkedMultiplayerENet.new()
peer.create_server(RPC_PORT, max_players)
get_tree().network_peer = peer
I tried the following:
get_connection_status()
But it responds with “2”, even when I’m not connected to a network.
I want something like this:
if peer.get_connection_status() == 0:
print("Failed to initialize the server because you're not connected to a network, please turn on your wifi and connect to a network")