Usage: gms_other_find_by_name ( name )


Returns the player_id of the player with the given name. Returns -1 when the player wasn't found.


var player_id, size43_health;
player_id = gms_other_find_by_name("Size43")
size43_health = gms_other_get_real(player_id, "health");
show_message("Size43: "+string(size43_health)+" health left");

Replies (7)

Last message on 26 Mar 2020

AouabAdYT on 21 Mar 2018, 22:12:32
size43_health = gms_other_get_real("health");

Should normally be :

size43_health = gms_other_get_real(player_id,"health");

You forgot an argument :)
Size43 (Administrator) on 24 Mar 2018, 15:21:06
Thanks, fixed!
BabyGolden12 on 23 Mar 2020, 18:43:09
When i need try to find player name i get a 0? is that suppose to happen

var player_id, other_health, name;
name = obj_textbox.txt;
player_id = gms_other_find_by_name(name)
size43_health = gms_other_get_real(player_id, "health");
show_message("Player"+string(size43_health)+" health left");
BabyGolden12 on 23 Mar 2020, 18:45:58
Im trying to get the player name to so i can make player logs
Size43 (Administrator) on 24 Mar 2020, 12:07:32
It might not be able to find the player. Are you sure the player you're specifying is logged in when the code runs?
BabyGolden12 on 26 Mar 2020, 06:02:44
I can not test it riht now sadly because it says can not connect to gamemaker server
BabyGolden12 on 26 Mar 2020, 06:13:08
it is not working and yes i checked