i tried the above, well.. i tried this to be exact:
function move_player()
{
while(enet_ent_globpointer(my) == -1) {wait(1);} //wait until the entity gets a global pointer
if(enet_ent_creator(enet_ent_globpointer(my)) == enet_get_clientid())
{ //Every client controls his own player
while(1)
{
//store the keys as bits in a skill1
// if(my.skill1 != oldskill1) enet_send_skill(enet_ent_globpointer(my),1,1,SERVER);
wait(1);
}
}
if(enet_get_connection() == 2)
{
//set up the physic stuff
phent_settype(my, PH_RIGID, PH_BOX);//physik entity definieren & kollision = sphere
phent_setmass(my, 75, PH_SPHERE);//masse definieren & rotation = sphere
while(1)
{
//use skill1 for the controls of the entity
//enet_send_pos(enet_ent_globpointer(my),BROADCAST);
//enet_send_ang(enet_ent_globpointer(my),BROADCAST);
wait(1);
}
}
}
i'm working with the way you set up the chat program, so the entities are created when the client joins via:
function create_player()
{
VECTOR creating_pos; //position were the entity will be created
//generates the starting position:
if(enet_get_clientid() == 0) {creating_pos.x = 0;creating_pos.y = 0;}
if(enet_get_clientid() == 1) {creating_pos.x = -200;creating_pos.y = 0;}
if(enet_get_clientid() == 2) {creating_pos.x = 200;creating_pos.y = -200;}
if(enet_get_clientid() == 3) {creating_pos.x = 200;creating_pos.y = 200;}
creating_pos.z = 0;
//creates the coresponding character:
if(character == 1) {player =enet_ent_create(_str("char1.mdl"),creating_pos,_str("move_player"));}
if(character == 2) {player =enet_ent_create(_str("char1.mdl"),creating_pos,_str("move_player"));}
if(character == 3) {player =enet_ent_create(_str("char1.mdl"),creating_pos,_str("move_player"));}
}
what this does however is, when i run as server/client, it creates the entity but physics isnt applied, when i join as a client, the character i created has physics applied, now if am correct, somethings wrong here? i shouldnt be seeing any movement on the client unless i sent positions?
[edit] i think i may be overlooking something simple however, am looking into it, i made this post maybe a little early