Question
#1

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.
Reply
#2

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[])
Reply
#3

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
..
Thank you sir, much appreciated.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)