Passing back strings - 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: Passing back strings (
/showthread.php?tid=413804)
Passing back strings -
Grimrandomer - 06.02.2013
I have a function, and I want in the parameters a reference to a string.
So just like:
pawn Код:
new name[MAX_PLAYER_NAME+1];
GetPlayerName(playerid,name,sizeof(name));
I have:
pawn Код:
stock getFreePlateID(&plateID,&plate[]) {
..... some code
format(plate,8,"%s",plateFromDatabase);
..... some more code
return 1;
}
new plateID, plateText[8];
getFreePlateID(playeID,plateText);
But I get the error: "variable cannot be both a reference and an array (variable 'plate')"
Any ideas?
Thanks, Grim.
Re: Passing back strings -
Vince - 06.02.2013
Strings are always passed by reference. So there is no need to use an ampersand (&) there as well.
Re: Passing back strings -
Grimrandomer - 06.02.2013
I did, it was causing me errors for some reason I though the errors was because I was not passing the string as a reference, but after looking my code over I missed a line.
Thanks anyway, its working now