there's already a built in function called GetPlayerDistance(e) so you dont need that entire function at the bottom.
and you never referenced it in the script which is likely the issue, you also need to check the state for going up or down better, right now it'll go up but pretty much never come down (except a tiny bit when max height is reached)
try this instead
Quote: "- LUA Script - open door
local moveSpeedUp = 5 --Speed for move on y-axis
local door_alt=nil
local maxOpening =0
local Opening = 0
CollisionOff(e)
GravityOff(e)
function Open_door(e)
if door_alt == nil then
door_alt = g_Entity[e]['y']
maxOpening = 100 + door_alt
Opening = door_alt
end
if GetPlayerDistance(e) < 100 then
if Opening =< maxOpening then
MoveUp(e,moveSpeedUp)
Opening =Opening+moveSpeedUp
end
else
if Opening > door_alt
MoveUp(e,-moveSpeedUp)
Opening =Opening-moveSpeedUp
end
end
end "
life\'s one big game
windows vista ultimate
i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11