Hi,
Try something like this:
-- Opens door automatically and stay open
local open = {}
function doorauto3_init(e)
open[e] = 0
end
function doorauto3_main(e)
if GetPlayerDistance(e) < 150 then
if open[e] == 0 then
-- door is closed
StartTimer(e);
if g_Entity[e]['animating'] == 0 then
SetAnimation(0);
PlayAnimation(e);
open[e] = 1
g_Entity[e]['animating'] = 1;
PlaySound(e,0);
end
else
if open[e] == 1 then
-- door collision off after 1 second
if GetTimer(e)>2000 then
CollisionOff(e);
end
end
end
end
end
harry
Harry