mplay_message_count(player)

player = Should be either a player real ID or a string ID. Use 0 for all players.

 

This function return how many messages are in the queue, you can specify a player to only take into account the messages sent by that player. You can add this to our messages example to test if there’s any message before attempting to receive one, but this is not necessary:

 

Example

if (mplay_message_count(0)>0)

{

if (mplay_message_receive(0)) //observe the use of this function

{

switch (mplay_message_id()) //switch the id of the message

{

  case 1: //id = 1, is  a chat message

         array[chat+1]=mplay_message_name()+": "+mplay_message_value();

         chat+=1;

         break;

  case 2: //id = 2, is a hspeed update

         player1.hspeed = mplay_message_value();

         break;

}

}

}

 

The above example first checks if there’s any message before trying to receive any.

 

gml_josea Revision #1