Usage: gms_self_name ( )


Returns the player's name. To obtain other player's names, you should use server_other_get_string(player_id, "name")

Replies (12)

Last message on 12 Aug 2016

Bluecore on 29 Jul 2016, 22:16:38
server_other_get_string(player_id, "name") is no longer a function. Someone help me out by telling me how I can display other people's names. This is how I am displaying the user's name.

var PlayerName
PlayerName = gms_self_name();

However, I'm not sure how to make it so other people's names float on top of their players.
amkgames on 31 Jul 2016, 08:30:23
Try gms_other_get_string(player_id, "name") instead.
Bluecore on 31 Jul 2016, 18:06:34
I'm not actually sure how to use that piece of code. Where do I find the player_id? How do I know which player goes with which objectOtherPlayer? Can you write out the code for me because I do not understand how it works.
amkgames on 1 Aug 2016, 10:25:02
gms_other_get_string(player_id, "name") is to get name of other player, I use it to draw other players' name on their head.
I use it something like this:
//Draw Event of obj_other_player
draw_text(x, y-18gms_other_get_string(player_id, "name"));
Bluecore on 7 Aug 2016, 08:45:14
Sorry for the late reply, wasn't able to try this out until now.

Okay this code does work, however, using the draw event on obj_other_player makes the sprites for the other player invisible even though their name does show up. What can I do about this?
amkgames on 7 Aug 2016, 09:16:10
If you are using Game Maker: Studio or Game Maker 8.1 then put this code before the above one.

If you are using Game Maker 8 then put this code:
draw_sprite_ext(sprite_index, image_index, x, y, image_xscale, image_yscale, image_angle, image_blend, image_alpha);
Bluecore on 7 Aug 2016, 09:28:55
Thank you so much Amkgames for all of the help! You are a lifesaver.
amkgames on 7 Aug 2016, 09:31:01
It was nothing. :)
Bluecore on 12 Aug 2016, 00:31:56
Sorry to bringing this thread up again, but I've just notice that when there are three people in the same room. One player gets two names layed on top of each other. While the other player has no name. Any fix for this?

Draw Event Of objPlayerOther:
var PlayerName
PlayerName = gms_other_get_string(player_id, "name");
amkgames on 12 Aug 2016, 06:04:24
You don't need to use objPlayerOther.x+9 and objPlayerOther.y-10, since it's same object.
Just use x+9 and y-10.
Bluecore on 12 Aug 2016, 06:19:37
You saved me again! Thank you so much AMK! You rock!
amkgames on 12 Aug 2016, 06:20:36
No problem! :)