Hi, this code is very simple , use this:
function scan_me()
{
temp.pan = 180;
temp.tilt = 180;
temp.z = 100;
scan_entity(player.x, temp);
}
on_space = scan_me;
//////////////////////
function operater()
{
if(my.skill1 <= 0)
{
snd_play(door_open_snd, 200, 0);//your sound
while(my.skill1 < 90)//opening the door
{
my.pan -= 6*time;
my.skill1 += 6*time;
wait(1);
}
my.skill1 = 90;
}
else
{
while(my.skill1 > 0)//closeing the door
{
my.skill1 -= 6*time;
my.pan += 6*time;
wait(1);
}
wait(4);
snd_play(door_close_snd, 200, 0);
my.skill1 = 0;
}
}
///////////////////////////
action door_rotate//attach to the door
{
my.enable_scan = on;
my.event = operater;
}
//////////////////////////
Another door(sliding):
//////////////////////////
function func_door()
{
if(my.skill1 <= 0)
{
while(my.skill1 < 90)
{
my.skill1 += 6*time;
my.y -= 6*time;
wait(1);
}
my.skill1 = 90;
}
else
{
while(my.skill1 > 0)
{
my.skill1 -= 6*time;
my.y += 6*time;
wait(1);
}
my.skill1 = 0;
}
wait(3);
}