Use meta_query in args for relationship

I finally managed to solve it myself, this is the code I used:

if($tema == '' && $software == '' && $volatilita == '') {

    $args=array(
        'post_type' => 'post',
        'post_status' => 'publish',
        'posts_per_page' => -1,
        'orderby'           => 'meta_value meta_value_num',
        'order' => 'DESC',
        'paged' => $paged,
        'cat' => $categoria_slot_machine,
    );

} elseif($tema != '' || $software != '' || $volatilita != '') {

    $args=array(
        'post_type' => 'post',
        'post_status' => 'publish',
        'posts_per_page' => -1,
        'orderby'           => 'meta_value meta_value_num',
        'order' => 'DESC',
        'paged' => $paged,
        'cat' => $categoria_slot_machine,
        'meta_query' => array(
            'relation' => 'AND',
            array(
                'relation' => 'OR',
            ),
            array(
                'relation' => 'OR',
            ),
            array(
                'relation' => 'OR',
            ),
        )
    );

    $i = 0;
    if ($tema != '') {
        foreach ($tema_array as $tema_array_key) {
            $args['meta_query'][0][$i] = array('key' => 'tema_slot_machine', 'value' => '"' . $tema_array_key . '"', 'compare' => 'LIKE');
            $i++;
        }
    }
    if ($software != '') {
        foreach ($software_array as $software_array_key) {
            $software_array_key_id = get_post_id_by_slug(slugify($software_array_key));
            $args['meta_query'][1][$i] = array('key' => 'software_relazione_slot_machine', 'value' => '"' . $software_array_key_id . '"', 'compare' => 'LIKE');
            $i++;
        }
    }

    if ($volatilita != '') {
        foreach ($volatilita_array as $volatilita_array_key) {
            echo $volatilita_array_key;
            $args['meta_query'][2][$i] = array('key' => 'volatilita_slot_machine', 'value' => $volatilita_array_key, 'compare' => '=');
            $i++;
        }
    }
}

if($filtro_applicato == 'RTP più alto') {

    $args['meta_key'] = 'rtp_slot_machine';

} elseif($filtro_applicato == 'Più votate') {

    $args['meta_key'] = '_kksr_ratings';

} elseif($filtro_applicato == 'Nuove slot') {

    $args['order'] = 'date';

}

I post because I hope it helps someone 🙂

error code: 523