SA-MP Forums Archive
Save a string in a variable? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Save a string in a variable? (/showthread.php?tid=204665)



Save a string in a variable? - Whoop - 30.12.2010

I am sending a string from my gamemode to a public in my.
How to save that string in a variable so i can use it in another public?

like:
pawn Код:
public cowvshorse(text[])
{
text = variabletosavestringin;
{

//when this public gets called
public fishvscat()
{
printf("%s", variablethatsavedstring);
I hope you understand me and would be able to help!


Re: Save a string in a variable? - _rAped - 30.12.2010

Make it global, put it at the top of your script


Re: Save a string in a variable? - TouR - 30.12.2010

pawn Код:
new youtext;

public cowvshorse(text[])
{
   youtext=text;
{

//when this public gets called
public fishvscat()
{
printf("%s", youtext);



Re: Save a string in a variable? - JamesC - 30.12.2010

Jesus Christ...

pawn Код:
new Variable[ 32 ]; // Greater than number of characters + 1

public cowvshorse()
{
     format( Variable, sizeof( Variable ), "variabletosavestringin" );
}

public fishvscat()
{
     print( Variable );
}