Returning 2 strings
#6

Quote:
Originally Posted by dowster
View Post
when you use this one
pawn Code:
stock asd(string[],&string1[],&string2[])
are you having a return 1; at the end?
Yes I did. It give error on that line.

Quote:
Originally Posted by RealCop228
View Post
What is with the & sign before the string names?

pawn Code:
&string1[],&string2[]
Couldn't you just do "string1[]," string[2]?"
https://sampwiki.blast.hk/wiki/Stocks#Re...ultiple_values

Quote:
Originally Posted by cessil
View Post
not really returning 2 string however you can pass strings through stocks and have them change, here's a quick example

pawn Code:
stock StockPasses2String(&string1[],len1,&string2[],len2)
{
    new TempStringOrSomthing[32] = "I equal nothing important";
        for(new i=0;i<len1;i++)
    {
        string1[i] = TempStringOrSomthing[i];
    }
    TempStringOrSomthing = "I Have Changed To Something Else";
    for(new i=0;i<len2;i++)
    {
        string2[i] = TempStringOrSomthing[i];
    }
}
Quote:
Originally Posted by Blacklite
View Post
You can't "return" 2 strings. The only way to achieve anything like this is with cessil's example.
variable cannot be both a reference and an array (variable "string1")
Reply


Messages In This Thread
Returning 2 strings - by letters - 16.08.2011, 01:54
Re: Returning 2 strings - by dowster - 16.08.2011, 02:16
Re: Returning 2 strings - by Scenario - 16.08.2011, 02:24
Re: Returning 2 strings - by cessil - 16.08.2011, 02:26
Re: Returning 2 strings - by Blacklite - 16.08.2011, 02:29
Re: Returning 2 strings - by letters - 16.08.2011, 02:49
Re: Returning 2 strings - by Blacklite - 16.08.2011, 02:58
Re: Returning 2 strings - by letters - 16.08.2011, 03:02
Re: Returning 2 strings - by Blacklite - 16.08.2011, 10:24

Forum Jump:


Users browsing this thread: 2 Guest(s)