Such a coding is impossible for $n>1$.
Let $a = (1,0,\dots,0)$ and let $b = (0,1,0,\dots,0)$.
When I write $m \cdot a$ for a natural number $m$ and a vector $a$, I mean $a + \dots + a$ (added $m$ times).
Now $a$ is coded by a natural number $m_a = f(a)$ and $b$ is coded by a natural number $m_b = f(b)$. But:
\begin{align}
f(f(b),0,\dots,0) &= f(m_b\cdot a)\\
&= m_b\times f(a)\\
&= m_a\times f(b)\\
&= f(m_a\cdot b)\\
&= f(0,f(a),0,\dots,0)
\end{align}
...which shows that the coding is not injective, since $(0,f(a),0,\dots,0)\neq (f(b),0,\dots,0)$, unless $f(a) = f(b) = 0$ but then again we have that the coding is not injective, since $a\neq b$.
Edited: Maybe an explicit example will help you see what's going on. Let's take $n = 2$ and say for example that $f(1,0) = 3$, $f(0,1) = 5$. Then:
\begin{align}
f(5,0) &= f(1 + 1 + 1 + 1 + 1, 0 + 0 + 0 + 0 + 0)\\
& = f(1,0) + f(1,0) + f(1,0) + f(1,0) + f(1,0)\\
& = 3 + 3 + 3 + 3 + 3\\
& = 15\\
& = 5 + 5 + 5 \\
&= f(0,1) + f(0,1) + f(0,1) \\
&= f(0+0+0,1+1+1) \\
&= f(0,3)
\end{align}
If you compare these steps with my argument above, you'll see that it's exactly the same, except $3$ is $m_a$ and $5$ is $m_b$.