mplay_session_join(numb,playname)

numb = this is the target session’s name, it can be a number or a string.

playname = this is the string containing the name of the player joining.

 

This function goes very near with mplay_session_create(), this tries to join the target session, returning if it was successful or not, an example can be:

 

mplay_session_join(0,me);

 

or:

 

mplay_session_join(0,"me");

 

But as you probably learned by reading the other functions you'll ever need to add some code to test if the functions was successful or not, because if you don’t control this the game will not do what it needs to do. A typical call is:

 

Example

if mplay_session_find() >0 then

{

if mplay_session_join(0,'') then

{

show_message("Joined to a session")

//do code

}

else

{

show_message("Unable to join") //there's session, but failed to join

}

}

else

{

show_message("No sessions available to join")//there's no sessions

}

 

Note that I called mplay_session_find(), you know why, if not go back and read again.

 

gml_josea Revision #1