Question - 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: Question (
/showthread.php?tid=285828)
Question -
vivec45 - 25.09.2011
Hey,
I have a few questions and was hoping someone can help. I am trying to figure out how to pass a pointer to a variable and be able to modify it from within the function I passed it too. Basically like GetPlayerName does, but I want to do it with some other text.
Like this:
PHP код:
forward GetMyString(ptr);
stock GetMyString(ptr)
{
Text = "Added";
}
GetMyString(Text);
print(Text); //I want Text to read "Added" here.
And my other question is about mysql.. I tried to find information about this on ******, but didn't find what I wanted. Basically I want to know how to retrieve text from a mysql DB. I can retrieve integers fine with mysql_fetch_int(). But I haven't found a function like mysql_fetch_text(). The only thing I've found out how to check if the text is a specific string by using 'WHERE' and checking the rows. How can I fetch text?
Thanks.
AW: Question -
Nero_3D - 25.09.2011
arrays are always transfered to a function
by reference
normal variables are normally transfered
by value, add a & in front of it to make it
by reference
pawn Код:
stock GetMyString(array[]) array = "Added";
// /\ if that does give an error use that \/
stock GetMyString(array[], const size = sizeof array) strcat((array[0] = EOS, array), "Added", size);
pawn Код:
new Text[16];
GetMyString(Text);
print(Text); // prints Added
For your other problem use
mysql_get_field(const fieldname[], string[])
Re: AW: Question -
vivec45 - 25.09.2011
Quote:
Originally Posted by Nero_3D
..
|
Thank you sir, much appreciated.