hi,
I am trying to work in the multiplayer code starting from locoweeds tutorial ( the best tutorial
one can fine anywhere- thanks for the great job).
I have a door which is opened when player presses x.
It open fine when the player is from server and is seen updated
on all the clients , but when the player from the client presses
x , the door does not open.
the code is as follows :
function open_door();
function playersneededfortasks();
var indicator = 0;
define _COUNTER skill28; // use a meaningful name for SKILL28
//var my_pos[5];
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);
}
function open_door
{
if (indicator != 1) { return; } // must be right kind of scan
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);
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);
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.
}
}
action door
{
my.enable_scan = on;
my.event = open_door;
playersneededfortasks();
}
on_x = scan_me;
I have been trying t owork around this issue for a long time but in vain ..can anyone help me out
in this.
thanks ,
Sichlid
Last edited by Sichlid; 12/22/06 03:28.