What's the problem in this code? Can anyone please explain me...?

on server, cube is moving and client can see it but client cannot move its cube...


here's the code::

Code:
#include <acknex.h>
#include <default.c>

STRING* messages_str = "#50";

FONT* arial_font = "Arial#20";

TEXT* messages_txt =
{
	pos_x = 10;
	pos_y = 10;
   layer = 10;
   font(arial_font);
   string (messages_str);
   flags = visible;
}

ENTITY* cam;
VECTOR camVel;

void cameraAct();


void main()
{
	if (!connection)   
	{
	   str_cpy(messages_str, "Can't find any server. Please try again later.");
      wait (-4);
      sys_exit(NULL);
   }        

   if (connection == 2)
	{
	   str_cpy(messages_str, "Running as a client");
	   
	   level_load("test.wmb");
	   //cameraAct();
	   
   } 
   else 
	{
		str_cpy(messages_str, "Running as a server");
   	
   	level_load("test.wmb");
   	//cameraAct();
   }
   cam = ent_create("aim.mdl", vector(0,0,100), cameraAct);

}


void cameraAct()
{
	wait(4);
	while(1){
		camVel.x = (key_w - key_s) * time_step * 15;
		camVel.y = (key_a - key_d) * time_step * 15;
		cam.pan -= mouse_force.x * time_step * 15;
		cam.tilt += mouse_force.y * time_step * 15;
	
		c_move(cam, camVel, nullvector, GLIDE);
		
		if(connection == 2){
			send_var_to (cam,camVel.x);
		}
		wait(1);
	}
}


Last edited by cerberi_croman; 06/09/08 13:57.


Ubi bene, ibi Patria.