12 lines
365 B
GDScript

extends PacketHandler
func handle_packet(data: PackedByteArray, _peer: PacketPeer):
var player_id := data.get_string_from_ascii()
print("[%s] Remove player: %s" % [Global.username, player_id])
var player := %Players.get_node(player_id)
if is_instance_valid(player):
player.queue_free()
else:
push_warning("PlayerRemove: Player with ID %s doesn't exist")