For your first request.
function logoutHandler()--We define a function name
local accountname = getAccountName (getPlayerAccount(source))--we get an account
if (isGuestAccount(getPlayerAccount(source)) == true) then --if that accounts is guest ( in everyone's group(in ACL))
cancelEvent()--then cancelEvent
outputChatBox("*Logout is not allowed!", source, 255,0,0)--output him to chatbox that logout is not allowed
end
end
addEventHandler("onPlayerLogout",getRootElement(),logoutHandler)--we add a event handler which will handle the funciton
For second, check Solid's post.