try this item script ...
501,Red_Potion,Red Potion,0,50,,70,,,,,0xFFFFFFFF,7,2,,,,,,{ atcommand "@autoloot 1"; sleep2 1800000; atcommand "@autoloot off"; },{},{}
Thanks to Jeroen in IRC for providing easier solution than making an script function.
* topic should be in db request though.