Hallo,
Ich habe folgendes Problem (C-Skript):

Wenn man auf dem Server oder auf dem Client (per G drücken) die Entity mit der action "place_me" erstellt, können beide (Client/Server) sie auch per Maus bewegen. Allerdings wird die Position der Entity nur bei allen Teilnehmern geändert, wenn der Server sie bewegt. Wenn die anderen Clients sie bewegen, wird die Position nur lokal verändert. Wie kann ich das lösen?

Unten ist der Code:

// English

Hello,
I have the following problem (C-Script):

If you create as a server or as a client (by pressing G) the entity with the "place_me" action, both (Server/Client) can move it using the mouse. But the position of the entity will be only changed at all members, when the server moves it. If the other clients move it, the position is only changed local. How can I fix that?

Here's the code:


Code:
function drag()
{
	if(event_type == event_release)
	{
		my.material = null;   // original skin
		my.ambient = 0;
		my.is_used = 0;
	}
	if (event_type == event_touch)
	{
		my.ambient = 75; // hilight skin
	}
	if (event_type == event_click)
	{
		mouse_mode = 0;		
		
		while(mouse_left)
		{
			my.material = mat_clicked; // normal skin
			my.ambient = 0;
	
			my.skill10 = mouse_pos.x;  // follow mouse x-pos
			my.skill11 = mouse_pos.y;  // follow mouse y-pos
			my.skill12 = camera.z;     // same as camera z-pos 
			
			vec_for_screen(my.skill10,camera);
			
			if(connection == 2)
			{
			send_skill(my.skill10, SEND_VEC); // send skill10...13 to the server
			}
			
			// update position			
			my.x = my.skill10;
			my.y = my.skill11;
			my.z = my.skill12;
			
			ent_sendnow(my);
			
			wait(1);
		}
		mouse_mode = 1;
		my.material = null; // normal skin
		my.ambient = 0;			
  	}
}

action place_me()
{
	sleep(0.5);
	proc_local(my, place_me);
	my.material = null;
	my.is_used = 0;
	c_setminmax(my);
	my.passable = on;
	my.enable_touch = on;
	my.enable_release = on;
	my.enable_click = on;
        my.event = drag;
}

function make_ding() // create a warlock.mdl
{
	my = ent_create(warlock_str, nullvector, place_me);
	wait(1);
}

on_g = make_ding;