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.
#DRAW EVENT
var PlayerName
PlayerName = gms_self_name();
draw_set_halign(fa_center);
draw_set_valign(fa_middle);
draw_set_font(EightBitOperatorJVE);
draw_text_ext_colour(objPlayer.x+9,objPlayer.y-10,PlayerName,10,200,c_white,c_white,c_white,c_white,1);
However, I'm not sure how to make it so other people's names float on top of their players.
Try gms_other_get_string(player_id, "name") instead.
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.
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-18, gms_other_get_string(player_id, "name"));
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?
If you are using Game Maker: Studio or Game Maker 8.1 then put this code before the above one.
draw_self();
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);
Thank you so much Amkgames for all of the help! You are a lifesaver.
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:
draw_self();
var PlayerName
PlayerName = gms_other_get_string(player_id, "name");
draw_set_halign(fa_center);
draw_set_valign(fa_middle);
draw_set_font(EightBitOperatorJVE);
draw_text_ext_colour(objPlayerOther.x+9,objPlayerOther.y-10,PlayerName,10,200,c_white,c_white,c_white,c_white,1);
R3styn
on
8 Jun 2019, 16:13:17
I want the server to select random at the beginning of the game
a player who gets a "hot potato" and that player explodes after 120 seconds
My project file:http://www.mediafire.com/file/5u99oxrqvhxhpx4/TNT_Tag.zip/file
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.
You saved me again! Thank you so much AMK! You rock!
M4RC0S
on
16 Feb 2022, 19:23:11
How do I convert a player's name to a string?
Because I want to remove the "Guest_" to turn it into "Player" and then put the name
Both gms_self_name() and gms_other_get_string(player_id, "name") are returns as strings, you don't need to convert it. Any function that requires a string to work, you can use these in. For example: draw_text(16, 16, gms_self_name());
say i wanted to make a text say a player name how would this work
var playername = gms_self_name();
draw_text(16, 16, playername);
Thank you but i should have said How Would I other player name like say Player challenge P2 im not reall good with the pvp script sorry :D
var playerothername = gms_other_get_string(player_id, "name");
draw_text(16, 16, playerothername);
NSXdev
on
28 Apr 2019, 14:02:06
Hey, so can i use this like this gms_self_name(playername,playername1)?
gms_self_name doesn't take any arguments. It just returns the name of the user currently playing your game. If you want the names of the other players on the server, you should use server_other_get_string(player_id, "name")