Hi Sichlid, this should be close,

---------------------------------------

function open_door();
function playersneededfortasks();

var indicator = 0;
define _COUNTER skill28; // use a meaningful name for SKILL28
define _OPEN_ME, skill 29;


//var my_pos[5];

// ran on owner's computer, host or client
function scan_me
{

my_pos.X = CAMERA.X;
my_pos.Y = CAMERA.Y;
my_pos.Z = CAMERA.Z;
my_pos.PAN = CAMERA.PAN;
my_pos.TILT = CAMERA.TILT;
temp.PAN = 180;
temp.TILT = 180;
temp.Z = 1000; // Reichweite des Scan - 200 Quants
indicator = 1; // Scan zum Türöffnen
SCAN_ENTITY(my_pos,temp);
}


// ran on host/server
function open_door
{
if (my._COUNTER <= 0) // if door was closed, open it
{
//ent_playsound(MY,open_snd,66);
while (my._COUNTER < 90)
{
my.PAN -= 3*TIME; // rotate clockwise
my._COUNTER += 3*TIME;
//ent_sendnow(my);
//send_var(me);
//send_skill(my._COUNTER,SEND_ALL); // don't need to send this
wait(1);
}
my.PAN += my._COUNTER-90; // correct the overshoot
my._COUNTER = 90;
//ent_sendnow(my);
}
else // otherwise close it
{
//ent_playsound(MY,close_snd,66);
while (my._COUNTER > 0)
{
my.PAN += 3*TIME; // rotate counterclockwise
my._COUNTER -= 3*TIME;
// ent_sendnow(my);
//send_skill(my._COUNTER,SEND_ALL); // don't need to send this
wait(1);
}
my.PAN += my._COUNTER; // correct the overshoot
my._COUNTER = 0;
//ent_sendnow(my); //send the updated door to the server and all clients.
}
}

// event for scan to open door, set skill _open_me = 1, if called from client function send to server
function set_open_door()
{
if (indicator != 1) { return; } // must be right kind of scan
indicator = 0;
my._OPEN_ME = on;
// client?
if(my.connection == 2)
{
send_skill(my._OPEN_ME, 0); // send skill to server
}
}

// door function ran on clients, set enable_scan & event locally on all the client computers for this door
function door_local()
{
my.enable_scan = on;
my.event = set_open_door;
playersneededfortasks();
}

// door action ran on server/host
action door
{
proc_local(my, door_local); // start a function running locally on clients
my.enable_scan = on;
my.event = set_open_door;
playersneededfortasks();
while(my)
{
// if this door was scanned on host or a client open the door
if (my._OPEN_ME)
{
my._OPEN_ME = off; // turn off needs to open
open_door(); // open the door on server, which opens on all clients also
}
wait(1);
}
}


on_x = scan_me; // scan on the owner's computer

----------------------------------

Not sure what is happening in playersneededfortasks(); so that might need tweaked for the client in door_local().

Happy New Year,
Loco


Professional A8.30
Spoils of War - East Coast Games