Name of the entities in the head - HELP!

Posted By: Pr0gr4mm3r

Name of the entities in the head - HELP! - 10/13/06 20:14

Please I am making a game multiplayer, and do I want that it shows the names in the heads of the entities, but just in the servER of the for seeing the names, in the way customer I don't get to see, what should make? see the image;

the CLIENT doesn't get to see the names



//////////////////////////////////////////////////////////
//////CODE OF THE NAME IN THE ENTITY//////////////////////
//////////////////////////////////////////////////////////

font system_font = <system.pcx>, 10, 12;

/////////////////////////////////////////////////////////////////////////

text name1_txt
{
font = system_font;
string = player_name;
}

text name2_txt
{
font = system_font;
string = player_name;
}

/////////////////////////////////////////////////////////////////////////

function name_ent1()
{
while (1)
{
vec_set (temp, my.x);
temp.z += 40; // play with this value for every entity
trace_mode = ignore_me + ignore_models + ignore_passents;
if (trace (my.x, camera.x) == 0) // if the entity is visible on the screen
{
vec_to_screen (temp, camera);
name1_txt.pos_x = temp.x; // set the position of the text
name1_txt.pos_y = temp.y; // on x and y
name1_txt.visible = on; // and make it visible
}
else // the entity isn't visible on the screen?
{
name1_txt.visible = off; // hide the text
}
wait (1);
}
}

function name_ent2()
{
while (1)
{
vec_set (temp, my.x);
temp.z += 60; // play with this value for every entity
trace_mode = ignore_me + ignore_models + ignore_passents;
if (trace (my.x, camera.x) == 0) // if the entity is visible on the screen
{
vec_to_screen (temp, camera);
name2_txt.pos_x = temp.x; // set the position of the text
name2_txt.pos_y = temp.y; // on x and y
name2_txt.visible = on; // and make it visible
}
else // the entity isn't visible on the screen?
{
name2_txt.visible = off; // hide the text
}
wait (1);
}
}



see the code of the player;

function player_client()
{
my.skin = num_client;//O skin aqui é apenas para usar o contador cliente
if (my.skin ==1){player1 = my;
name_ent1();while (player1 == null){wait(1);}}//Aqui que eu verifico quem é o player 1 ou 2
if (my.skin ==2){ player2 = my;
name_ent2();while (player2 == null){wait(1);}}
num_client += 1;
if (num_client > 3){wait(1);remove (me);return;}
MY.ENABLE_DISCONNECT = ON;
MY.EVENT = _actor_connect;//Esta função é préfabricada e se encontra no arquivo actor.wdl
my.health = 100;
my.ammo = 9999;
player_walk();
//player_drive();
send_variable();
if (MY.shadow == OFF) { drop_shadow(); }
}


how do for what do all I see the names of the entities in the head of the payers? at once I thank.
Posted By: slacer

Re: Name of the entities in the head - HELP! - 10/13/06 20:27

The functions run at the server side, but if you want to show the names at client side, too - you have change some things.

Lookup proc_local in the manual, to understand how to call name_ent1 and name_ent2.
This is important, because you also whish to use the clients camera position to find the right coordinates for the text names.

But there still is some extra work to do: You need to send the name to each client, otherwise there is no text to copy into the TEXT string.
Maybe you didn't notice this till now, but both players use the same name, because there can only be one player_name per system.

-- slacer
Posted By: Pr0gr4mm3r

Re: Name of the entities in the head - HELP! - 10/13/06 21:19

Please, without asking a lot, but have some idea of as I do? I need to put a name in the head of all of the entities, a code please.

Thank you very much!
© 2024 lite-C Forums