[Solved] Function with returning strings
#1

Hi people!
First sry for my bad English.
I wanted to create a function in which strings are getting "returned" like in split-func, look at my function:

Code:
forward ListGoods(checkpointid,bool:tanktrailer,Field[][],goods);
public ListGoods(checkpointid,bool:tanktrailer,Field[][],goods)
{
    new exports,data[30];

  	MySQLCheckConnection();

    exports=CompanyInfo[checkpointid][companyexports];

  	if(tanktrailer==false)
  	{
  		new count=0;
  		for(new i=1;i<=exports;i++)
		{
			switch(i)
			{
     			case 1: {strcat(data,CompanyInfo[checkpointid][name_export1]);}
     			case 2: {strcat(data,CompanyInfo[checkpointid][name_export2]);}
     			case 3: {strcat(data,CompanyInfo[checkpointid][name_export3]);}
     			case 4: {strcat(data,CompanyInfo[checkpointid][name_export4]);}
			}
			if(strcmp(data,"Benzin",true) and strcmp(data,"Motorцl",true))
			{
			    count++;
			    strcat(Field[count],data); // 1262
			    print(Field[count]);
			    print(data);
			}
		}
		goods=count;
  	}
  	else
  	{
  	    new count=0;
  		for(new i=1;i<=exports;i++)
		{
			switch(i)
			{
     			case 1: {strcat(data,CompanyInfo[checkpointid][name_export1]);}
     			case 2: {strcat(data,CompanyInfo[checkpointid][name_export2]);}
     			case 3: {strcat(data,CompanyInfo[checkpointid][name_export3]);}
     			case 4: {strcat(data,CompanyInfo[checkpointid][name_export4]);}
			}
			if(strcmp(data,"Benzin",true) and strcmp(data,"Motorцl",true))
			{
			    count++;
			    strcat(Field[count],data); // 1284
			    print(Field[count]);
			    print(data);
			}
		}
		goods=count;
	}
}
and this function should be used somewhere in the script:

Code:
new ladung[6][30],ladungen,string[256];
ListGoods(checkpointid,false,ladung,ladungen);
but on compiling they are these errors:

Code:
(1262) : warning 224: indeterminate array size in "sizeof" expression (symbol "maxlength")
(1284) : warning 224: indeterminate array size in "sizeof" expression (symbol "maxlength")
I don't know what I do wrong, I have looked 1000 times at the split function, but I didn't found an error

Edit: I wrote the third argument in error lines as 30 (strcat(arg1,arg2,30)). But I don't know how to delete my own post, only can edit it?!
Reply
#2

what ever you do, ... a public function can not return an array.
Reply
#3

this is false public function can return integers, and indirectly all this is why i wrote "returned" and not returned
Reply
#4

Didn't see [solved] tag, sorry just woken up lol, please forgive me :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)