even MORE about multiplayer (players & messages!)
//i hope you guys liked my previous scripts,for we shall be coding in GML. if you experince errors in the compiler
//like, “PROGRAM ENDS BEFORE END OF CODE” it means you have one too many programs. other than that lets get
//started shall we? this script is about players and handling with them. because its soo short we will
//throw in some more commands on messages.
//to see how many players are on a session,along with a certian name, you would do the following:
{
mplay_player_find();
mplay_player_name(a_number);
}
//note that in order to do this you MUST use mplay_player_find(),else it will not work.
//to find the ID of that certian player,use the following code
{
mplay_player_find();
mplay_player_id(a_number);
}
//now onto messages.messages are pre-programmed strings the will be sent to a player instance.
//but enough of that! lets get programming! lets start on a personal message sent to a player.
//it would look like this: (use 0 to send it to all players)
{
mplay_message_send(player,id,message);
}
//to make sure its sent to it,you would use the following code:
{
mplay_message_send_guaranteed(player,id,message);
}
//this next code will have you “recive” messages from other players: (use 0 for any message)
{
mplay_message_receive(player);
}
//now we can tinker with this abit.the next following code can be used to do diffrent things with the message:
{
mplay_message_receive(player);
mplay_message_id(); Returns the identifier of the last received message.
mplay_message_value(); Returns the value of the last received message.
mplay_message_player(); Returns the player who sent the last received message.
mplay_message_name(); Returns the name of the player who sent the last received message.
mplay_message_count(player); Returns the number of messages left in the queue from the player (use 0 to count all message).
mplay_message_clear(player); Removes all messages left in the queue from the player (use 0 to remove all message).
}
//there you have it! if your eager to see more code ill be happy to show you just simply post a comment
//down below and ill see how it goes!
Why so many posts?
Just thought I would let you know, but Mplay is very insecure, which can often cause viruses.
I suggest posting this in the game maker community forums instead of here.
Use the code tags.