Hi,
This one is from smallg, and is working.
Maybe you can see what he did.
--lift script by smallg
local low_height = {}
local high_height = {}
local use_range = {}
local lift_speed = {}
local pressed = 0
local state = {}
local up = {}
function lift2_init(e)
state[e] = "wait"
up[e] = 0
use_range[e] = 100
lift_speed[e] = 100
low_height[e] = 610
high_height[e] = 800
--high_height[6] = 1000
--lift_speed[6] = 200
--lift_speed[7] = 400
--high_height[7] = 2000
CollisionOff(e)
Scale(e,175)
end
function lift2_main(e)
if state[e] == "wait" then
if g_Entity[e]['y'] > low_height[e] and up[e] == 0 then
CollisionOff(e)
MoveUp(e,-10)
SetRotation(e,0,0,0)
elseif g_Entity[e]['y'] < high_height[e] and up[e] == 1 then
CollisionOff(e)
MoveUp(e,20)
SetRotation(e,0,0,0)
end
if GetPlayerDistance(e) <= use_range[e] then
if g_KeyPressE == 1 and pressed == 0 then
pressed = 1
if g_Entity[e]['y'] <= low_height[e] then
state[e] = "going up"
up[e] = 1
elseif g_Entity[e]['y'] >= high_height[e] - 10 then
state[e] = "going down"
MoveUp(e,-lift_speed[e]/2)
up[e] = 0
end
end
end
elseif state[e] == "going up" and g_Entity[e]['y'] < high_height[e] then
CollisionOff(e)
MoveUp(e,lift_speed[e])
SetRotation(e,0,0,0)
elseif state[e] == "going down" and g_Entity[e]['y'] > low_height[e] then
CollisionOff(e)
MoveUp(e,-lift_speed[e]/4)
SetRotation(e,0,0,0)
else
state[e] = "wait"
end
CollisionOn(e)
if GetPlayerDistance(e) <= use_range[e] then
Prompt(state[e])
end
if g_KeyPressE == 0 and pressed == 1 then
pressed = 0
end
end
Harry