if ( is_plugin_active( 'plugin-folder/plugin-file.php' ) ) { // check if plugin is installed and active
// do the code
}
or
if ( !is_plugin_active( 'plugin-folder/plugin-file.php' ) ) { // check if plugin is not active
// do the code
}
or
(!in_array('plugin-folder/plugin-file.php', apply_filters('active_plugins', get_option('active_plugins')))) { // check if plugin is not active
// do the code
}
or
(in_array('plugin-folder/plugin-file.php', apply_filters('active_plugins', get_option('active_plugins')))) { // check if plugin is installed and active
// do the code
}