You might want to check $pzone or similar, or it will just attempt to logout in the middle of a spawn for example.
I made a hotkey/action for this a while back, if you use it in a waypoint-action you need to remove auto()
http://forums.tibiawindbot.com/showt...9-Safe-Stamina