SA-MP Forums Archive
Array size - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Array size (/showthread.php?tid=514893)



Array size - kamiliuxliuxliux - 23.05.2014

Hello guys. I've a problem with 2 arrays: inputtext and vInfo[id-1][Name] (vInfo[id-1][Name] size is [30]).
So when I put this in my script:
pawn Код:
vInfo[id-1][Name] = inputtext;
I recieve an error, that array sizes do not match. What should I do?



Re: Array size - Jefff - 23.05.2014

https://sampwiki.blast.hk/wiki/Strcat


Re: Array size - kamiliuxliuxliux - 23.05.2014

And how should it help me?


Re: Array size - Konstantinos - 23.05.2014

You can copy a string to another using strcat, memcpy, format (not recommended).

pawn Код:
strcpy(vInfo[id-1][Name], inputtext, 30);
and:
pawn Код:
#define strcpy(%0,%1,%2) strcat((%0[0] = '\0', %0), %1, %2)



Re: Array size - kamiliuxliuxliux - 24.05.2014

Thanks Konstantinos. + rep