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
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!
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");
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?
I can not test it riht now sadly because it says can not connect to gamemaker server
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?
no i am not but i will try and sorry for the late reply