gms_other_find_by_name

Usage: gms_other_find_by_name ( name )

Description

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

Example

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 (9)

Last message on 5 Apr 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
Size43 (Administrator) on 4 Apr 2020, 15:51:50
Are you using gms_self_set anywhere to set the "health" variable? If yes, could you post code of how you're doing that?
BabyGolden12 on 5 Apr 2020, 04:26:16
no i am not but i will try and sorry for the late reply