str_for_id (STRING*, var client_id);
Sets the string to the player name of the client with the given client_id.
Parameters:
STRING* - String to be set to the player
name, or NULL for returning a temporary string.
client_id - client identification number as received by the on_server join event or stored in the struct of a client-created entity.
Returns:
STRING* that contains the player name, 7.82 or NULL when the client does not exist or is not connected anymore.
Speed:
Fast
Remarks:
Server only. For displaying player names on the clients, the server could send them through send_string or send_data.
Example (lite-C):
// displays the player client name above the player's head
function show_my_name()
{
VECTOR vTextpos;
if (my.client_id && (connection & CONNECT_SERVER)) {
vec_set(vTextpos,vector(my.x,my.y,my.z+70)); // 3d name position
vec_to_screen(vTextpos,camera);
draw_text(str_for_id(NULL,my.client_id),
vTextpos.x-40,vTextpos.y,vector(255,0,0)); // 2d name position and color
}
}
See also:
str_for_entfile, send_data_id, on_server ► latest
version online