Rajbhai
No one but him could have told them that the king was I.
(A) him could have told them that the king was I.
(B) he could have told them that the king was me.
(C) him could have told them the king was me.
(D) he could have told them that the king was I.
(E) him could have told them that the king was I.
Again, quoting the legend aka. here.
Formally, the first pronoun should be "he" because it is the subject of the sentence. Hence, use the subjective form "he", not "him." ("No one but" is simply an adjective phrase equivalent to "only").
The second pronoun is linked to the subject of the clause "the king" via the linking verb "was" and refers back to it. This is formally known as a "predicate nomitive". Since the pronoun is directly linked to the subject of the linking verbs, it too uses the subjective form. Examples: It is I. It is she that should be the nominee, not I. It was she who surprised the teacher. Note: since the verb simply links the subject and the pronoun (or two pronouns), they can often be exchanged.
Try rewriting the sentence and you will see it more clearly:
"Only he could have told them that I was the king."
Regards
Praetorian