[REP++] Returned arrays - 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: [REP++] Returned arrays (
/showthread.php?tid=636019)
[REP++] Returned arrays -
buburuzu19 - 18.06.2017
Can someone tell me how can i access a returned array from a function?
Thanks.
Re: [REP++] Returned arrays -
Hansrutger - 18.06.2017
From my understanding, arrays are passed by as reference always. Either way if you meant something like GetPlayerName function to return the the name instead of referencing it, then it's the same thing as returning any other array.
Code:
main()
{
new mainstring[128];
format(mainstring, sizeof(mainstring), "%s", funketup());
printf("%s is same as %s", mainstring, funketup());
}
funketup()
{
new str[128] = "'this is a returned string";
format(sizeof(str), "%s and we do something naw with it %i'", GetTickCount());
return str;
}
Meaningless example, hope that clears shit up.