Getting correct IDS from a dialog
#1

Hey,

PHP код:
for(new 0MAX_INVENTORY_SLOTSc++)
                                {
                                    if(
cActor[i][items][c] == -1format(string,sizeof(string),"%s\n{FFAF00}Empty",string);
                                    else 
format(string,sizeof(string),"%s\n{FFAF00}%s: %d",string,Itens[cActor[i][items][c]][item_nome],cActor[i][ia][c]);
                                } 
This is my code to get items from an actor which will be displayed in a dialog later.
The slot in which there is no item, I used the string "Empty" for that so that the listitem would be the itemid of cActor which I've to use to remove the item in OnDialogRepsonse. So what I wanted to ask is, it looks ugly with everywhere "Empty" in the dialog. Is there any way to just display only the items with correct IDS?
For example, if I display only the items in dialog and leave the slots which are empty, I won't be able to get the slot id in listitem on OnDialogResponse then.
If you don't know what I'm trying to say is this, I currently use listitem to get the ID of the selected item.
PHP код:
cActor[i][item][listitem]--; 
And if I remove the "Empty" string
PHP код:
cActor[i][ia][listitem]--; // the "listitem" won't give the correct slot ID so any other way. 
Reply
#2

Quote:
Originally Posted by Sunehildeep
Посмотреть сообщение
I won't be able to get the slot id in listitem on OnDialogResponse then.
If you don't know what I'm trying to say is this, I currently use listitem to get the ID of the selected item.
You are wrong, you can get the slot id by using sscanf on inputtext, but you have to show slot id in dialog window.

Example:

Код:
format(string, 32, "%d\t%s", vehicleid, veh_name);
ShowPlayerDialog...

OnDialogResponse:

sscanf(inputtext, "ds[32]", vehicleid, veh_name);
Reply
#3

Quote:
Originally Posted by raydx
Посмотреть сообщение
You are wrong, you can get the slot id by using sscanf on inputtext, but you have to show slot id in dialog window.

Example:

Код:
format(string, 32, "%d\t%s", vehicleid, veh_name);
ShowPlayerDialog...

OnDialogResponse:

sscanf(inputtext, "ds[32]", vehicleid, veh_name);
Well, didn't knew about that :3, thx, repped.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)