Printing out something from an enum
#5

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(playeridparams[])
{
new 
iBiz;
if( 
sscanf params"d"iBiz)) return SCP(playerid"[BizID]");
new 
BizTypeID BusinessInfo[iBiz][bType];
new 
iTypeName BizTypeList[BizTypeID][biz_N];
format(iStrsizeof(iStr), "String: %s || Int: %d"iTypeNameiTypeName);
SendClientMessage(playeridCOLOR_WHITEiStr);
return 
1;

at first I retrieve the biz type ID, and then I adderss the ID's name from it's enum..
Reply


Messages In This Thread
Printing out something from an enum - by Amit1998 - 30.05.2016, 21:13
Re: Printing out something from an enum - by Amit1998 - 31.05.2016, 15:09
Re: Printing out something from an enum - by Dayrion - 31.05.2016, 15:57
Re: Printing out something from an enum - by Kaliber - 31.05.2016, 15:58
Re: Printing out something from an enum - by Amit1998 - 31.05.2016, 17:07
Re: Printing out something from an enum - by Kaliber - 31.05.2016, 17:14
Re: Printing out something from an enum - by Amit1998 - 31.05.2016, 17:41
Re: Printing out something from an enum - by Konstantinos - 31.05.2016, 18:28
Re: Printing out something from an enum - by Amit1998 - 31.05.2016, 18:57
Re: Printing out something from an enum - by Konstantinos - 31.05.2016, 19:15

Forum Jump:


Users browsing this thread: 1 Guest(s)