How to make an array argument in stock optional... -
pasha97 - 08.02.2013
I'm not sure how to express what I want correctly, but I hope you'll understand me. In one of stock functions in my gm, there is an argument... Not an integer argument, but array. This array must include titles for textdraw menu, like:
pawn Код:
new vnames[][] =
{
"Planes",
"Helicopters",
"Bikes",
"Cars",
"Boats",
"Specials",
"RC vehicles"
};
So, when I use this stock function, i must add:
pawn Код:
ShowTextDrawMenu(playerid, menuid, "Vehicles spawn",vnames,0x990000AA);
As you can see, vnames is that veriable with array with titles.
But if I don't want to add any title, it gives me an error, that number of arguments does not much the defenition. So, I want to ask you, if there is any way to make this function argument optional? Thanks in advance.
Re: How to make an array argument in stock optional... -
pasha97 - 08.02.2013
Anybody answer please.
Re: How to make an array argument in stock optional... -
Scenario - 08.02.2013
I believe this will work for you: make vnames the last piece of the syntax and replace "vnames" with this:
Re: How to make an array argument in stock optional... -
RajatPawar - 08.02.2013
To make something optional, I would do, this is not the best method, this is a guess:
pawn Код:
SomeFunction(some integer = 0);
This would set the value already to 0, and wouldn't give anything even if you type:
pawn Код:
SomeFunction(); //I guess?
Re: How to make an array argument in stock optional... -
pasha97 - 08.02.2013
Quote:
Originally Posted by Rajat_Pawar
To make something optional, I would do, this is not the best method, this is a guess:
pawn Код:
SomeFunction(some integer = 0);
This would set the value already to 0, and wouldn't give anything even if you type:
pawn Код:
SomeFunction(); //I guess?
|
What you say is only for integer variables, but my one is an array with some number of strings(see the first post)
Re: How to make an array argument in stock optional... -
Scenario - 08.02.2013
*cough*
Re: How to make an array argument in stock optional... -
pasha97 - 08.02.2013
Quote:
Originally Posted by RealCop228
|
doesn't work. I get this:
G:\Ultra Fun Freeplay\pawno\include\TDMEN.inc(315) : error 001: expected token: "{", but found "-string-"
G:\Ultra Fun Freeplay\gamemodes\UFFtest.pwn(9670) : error 047: array sizes do not match, or destination array is too small
if i make this:
titles_array[][]= {"NULL"}
then there is only the second error
Re: How to make an array argument in stock optional... -
RajatPawar - 08.02.2013
Err...something like, I am not sure, but:
Re: How to make an array argument in stock optional... -
pasha97 - 08.02.2013
Quote:
Originally Posted by Rajat_Pawar
Err...something like, I am not sure, but:
|