Connect cable to an object (ingame)

Hello,

I am trying to make a cable actor as an object that can be picked up by right clicking on one end of the cable and then takeing that one point and dragging it to a another point (a object/socket) so that it connects.
If you don’t know what i am talking about, if anyone has played Half life 2 then you know there were several levels where you had to connect a cable to a socket to turn on a generator or a door etc…

Even a slight idea of how i could do this??