Yes, you could. But I would be cautious with that.
In case of doubt, stick to the more straight away logical approach. A will happen IF B happens. Assuming that IF B happens, A will happen would be a logical fallacy: it may happen, but there is no certainty. Of course, when you say ONLY IF B happens, A will happen, that is not the case. But you see it's tricky. When you add negatives it gets even more complicated. Language is more open regarding conditionals than pure logic, but being a foreign language I would be cautious in the exam. Conditionals are sort of playing with fire at times.
I'll share some extracts from Logic Made Easy, by Deborah J. Bennett on failures in logic regarding conditionals:
- Conversion:
'According to Susanna Epp, there is extensive evidence that people
perceive "If p then q as equivalent to its converse, "If q then
p." This is the identical conversion mistake that individuals
make when they think "All A are B" is the same as "All B are v4."
Individuals make this mistake with conditionals hastily and all
too frequently, convinced that they are reasoning correctly.'
- Inversion
'The contrapositive of the converse is called the inverse. The
inverse of the conditional given above is "If you are not exceeding
the speed limit, then you are not breaking the law." Like the error of conversion, it is a mistake to believe that its inverse is
true just because a conditional is true'
- Biconditionals:
'Conditionals with
negative antecedents have a particular tendency to be interpreted
as biconditionals. "If you don't see a trash can, then you
put the litter in your pocket" is interpreted as meaning "If you
don't see a trash can, then you put the litter in your pocket and
if you put the litter in your pocket, then you didn't see a trash
can." The tendency to (mis)interpret the conditional as the
biconditional (the conditional and its converse) is universally
acknowledged in children and adults'
All this happens to all of us when using our own language. Take that into account when doing your test in a foreign language.
Regarding “if only”, its meaning is closer to "I wish" than to an actual conditional structure. It's an expression of empahasis Therefore, it could lead to confusion in meaning if badly used.
Examples of uses of "if only"; from Practical English Usage, by Michael Swan:
past to talk about the present
If only I knew more people! If only I was better-looking!
We can use were instead of was
If only your father were here!
would + infinitive (without to) to talk about the future
If only it would stop raining, we could go out.
If only somebody would smile!
Past perfect to talk about the past
If only she hadn't told the police, everything would have been all right.