AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Return vector from forward (https://forums.alliedmods.net/showthread.php?t=40932)

N1ghtmr1 07-06-2006 11:02

Return vector from forward
 
Hi all.

If i have 2 plugins, pla and plb, and I want to get a vector a[1..n] as a return value from plb calling the function from pla, how would I do?

Right now i've seen that you can pass both int and float as reference, but not string. I've tryed to pass the vector as argument and then edit the values in plb's function but it doesn't seem to work properly. Also return doesn't seem to work with forwards. In code what i wan't to do is:

pla...
{
new vec[n]
get_info_and_fill_vec[n]_from_plb
}

plb..

public getinfo(...)
{
return_vec(somehow)
}

The ugly method would be to pass each element in the vector as &int arguments, but I would like to avoid that since n can change later.

Hawk552 07-06-2006 11:18

Re: Return vector from forward
 
Pass it as an array, I'm not sure if it supports different data tags though.

If not you'll just have to pass each cell of the vector as one parameter.

N1ghtmr1 07-06-2006 11:37

Re: Return vector from forward
 
"If not you'll just have to pass each cell of the vector as one parameter."

Yeah that was my "bad" solution, but it would be ok if i could pass a non fixed number of arguments to the function. Is infinite arguments supported by pawn? Like

public name(id,a....., numofarg)

or something similiar.

Hawk552 07-06-2006 12:02

Re: Return vector from forward
 
Quote:

Originally Posted by N1ghtmr1
"If not you'll just have to pass each cell of the vector as one parameter."

Yeah that was my "bad" solution, but it would be ok if i could pass a non fixed number of arguments to the function. Is infinite arguments supported by pawn? Like

public name(id,a....., numofarg)

or something similiar.

yes:

Code:
whatever(id,some_string[],{Float,Sql,Result,_}:...)

N1ghtmr1 07-06-2006 12:05

Re: Return vector from forward
 
OK, thanks alot for your help :)

Another thing, I noticed that pawn always pass vectors as reference, is this correct?

Hawk552 07-06-2006 13:09

Re: Return vector from forward
 
Quote:

Originally Posted by N1ghtmr1
OK, thanks alot for your help :)

Another thing, I noticed that pawn always pass vectors as reference, is this correct?

I think it does for any array in general.


All times are GMT -4. The time now is 07:55.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.