GameMakerHelpBlog

Saturday, November 25, 2006

Mplay - GM Function

This is a simple Server for GM Mplay This doesn't include the movement or messaging but the basics of setting up a server people join. Warning: Must have a little knowledge of GML

Remember: [code]&[/code] doesn't mean anything with GM and will muck up your code
[code]
str=get_string("ip address",'')
mplay_init_tcpip(str)
[/code]
^^this code is for init a tcpip connection
[code]
//create a server

{
if (mplay_session_create('',2,''))
{
global.master = true;
room_goto_next();
}
else
show_message('Failed to create a session.')
}
[/code]
^^Note this has a max of 2 players due to lag or slowness in the connection
[code]
//join a server

{
if (mplay_session_find() > 0)
{
if (mplay_session_join(0,''))
{
global.master = false;
room_goto_next();
}
else
show_message('Failed to join a session.')
}
else
show_message('No session available to join.')
}
[/code]
^^This will join the server you request

This is all for now... To find movement check up this later

Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home