Edit user account how to check before update if the role check box is selected?
Use hook_user_presave() for any logic that you need to happen before user data is really updated, but also have access to new values:

Parameters
$edit: The array of form values submitted by the user. Assign values to this array to save changes in the database.
$account: The user object on which the operation is performed. Values assigned in this object will not be saved in the database.
$category: The active category of user information being edited.

You need to test against $edit argument.

For Drupal 6, you need hook_user.

Act on user account actions.

Act when $op == 'submit', as:

submit: Modify the account before it gets saved.

Just as with Drupal 7, you must examine

$edit: The array of form values submitted by the user.