--script by smallg local state = {} local lift_time = {} local pickup_range = {} local height = {} local land_time = {} local carry_height = {} local pressed = 0 local carrying = 0 --key to use to pick up and drop items local input_key = "e" function carry_init(e) --how far above the ground the item is carried carry_height[e] = 26 --how far away the item can be before it's picked up - also effects carry range pickup_range[e] = 100 state[e] = "dropped" lift_time[e] = 10 height[e] = 0 land_time[e] = 100 end function carry_main(e) if state[e] == "dropped" then if GetPlayerDistance(e) <= pickup_range[e] and carrying == 0 then PromptLocal(e,"pickup? " .. input_key) if pressed == 0 and g_InKey == input_key then pressed = 1 state[e] = "lifting" carrying = 1 StartTimer(e) end end elseif state[e] == "lifting" then Prompt(state[e]) if GetTimer(e) < lift_time[e] or g_Entity[e]['y'] > g_PlayerPosY + carry_height[e] then MoveUp(e,100) CollisionOff(e) else state[e] = "carrying" end elseif state[e] == "carrying" then Prompt(state[e]) CollisionOff(e) RotateToPlayer(e) if GetPlayerDistance(e) > pickup_range[e] /1.5 then MoveForward(e,300) end SetRotation(e,0,g_PlayerAngY,0) if GetPlayerDistance(e) < pickup_range[e] /1.5 then MoveForward(e,300) end if g_Entity[e]['y'] < g_PlayerPosY - carry_height[e] then MoveUp(e,25) elseif g_Entity[e]['y'] > g_PlayerPosY - carry_height[e] then MoveUp(e,-25) end if pressed == 0 and g_InKey == input_key or GetPlayerDistance(e) > pickup_range[e] * 1.2 then pressed = 1 state[e] = "dropping" carrying = 0 height[e] = g_Entity[e]['y'] StartTimer(e) end elseif state[e] == "dropping" then Prompt(state[e]) if GetTimer(e) > land_time[e] then if g_Entity[e]['y'] >= height[e] - 0.5 then state[e] = "dropped" else land_time[e] = GetTimer(e) + 100 height[e] = g_Entity[e]['y'] end end end if pressed == 1 and g_InKey ~= input_key then pressed = 0 end CollisionOn(e) end --main