Next up is going to be making sure 2 servers can not be generated with the same code, as this would make it impossible to join the right server if 2 servers had the same code.
Place a ‘Make Literal Session Property String’ node down and set the Key input to ‘Code’ and make the value equal to the ‘Code’ variable we created earlier. (MAKE SURE YOU ALSO ADD THIS TO YOUR EXTRA SETTINGS WHEN CREATING THE SESSION)
Connect the Return Value to a ‘Make Literal Session Search Property’ node, with the Comparison Operator as Equals.
Connect that Return Value to a ‘Make Array’ node and then plug that into the ‘Filter’ input of a ‘Find Sessions Advanced’ node.
If this node returns “On Failure”, this means that there most likely is not a server with that current code. You can connect that to your ‘Create Advanced Sessions’ node.
If the ‘Find Sessions Advanced’ node returns “On Success”, then just call your “On Host Server” event again. this will loop back through the function until it gets an open code.