Conditional script for whether a user is currently logged in

Conditional script for whether a user is currently logged in

I have a table in my app that holds records my organization's users.  I want to write a function that will set an Available field to false if they are logged out, and to true if they are logged in.  Is there some way for me to do this in deluge?