Quote:
Originally Posted by Kaliber
The problem is you need an index for that.
For example:
PHP код:
enum biz_Lists
{
biz_T,
biz_N[50],
}
new BizTypeList[10][biz_Lists]; //We make this to 10...so u can max create 10 Biz (index: 0-9)
new biz_index; //We will need this to accsess everytime the Variable
//To Create one Biz we do sth like this
if(biz_index >= sizeof(BizTypeList)) return SendClientMessage(playerid,-1,"Biz is full!"); //PS: sizeof(BizTypeList) = 10
BizTypeList[biz_index][biz_T] = BUSINESS_TYPE_BANK; //For example
format(BizTypeList[biz_index][biz_N],50, "Bank"); //So we set this
biz_index++; //we count this up...so the next one we insert is an index above
/*
To read this stuff out...you need an index
In my example the Bank is at index 0. Cause the Variable biz_index was zero.
*/
//So we do sth like this:
new string[50],type;
format(string,50,BizTypeList[0][biz_N]); //Now string equals Bank
type = BizTypeList[0][biz_T]; //And type equals BUSINESS_TYPE_BANK
So i hope you see..the index is the key
|
How come this one doesn't work?
PHP код:
COMMAND:checkbiztype(playerid, params[])
{
new iBiz;
if( sscanf ( params, "d", iBiz)) return SCP(playerid, "[BizID]");
new BizTypeID = BusinessInfo[iBiz][bType];
new iTypeName = BizTypeList[BizTypeID][biz_N];
format(iStr, sizeof(iStr), "String: %s || Int: %d", iTypeName, iTypeName);
SendClientMessage(playerid, COLOR_WHITE, iStr);
return 1;
}
at first I retrieve the biz type ID, and then I adderss the ID's name from it's enum..