| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- #include <YSI_Coding\y_hooks>
- new Iterator:OwnedItem[MAX_PLAYERS]<MAX_ITEMS>;
- hook OnGameModeInit()
- {
- Iter_Init(OwnedItem);
- }
- hook OnPlayerDisconnect(playerid, reason)
- {
- Iter_Clear(OwnedItem[playerid]);
- }
- hook OnPlayerFirstSpawn(playerid)
- {
- foreach(new i : Item)
- {
- if(Inventory_GetItemOwnerSQLID(i) == Character_GetSQLID(playerid))
- {
- Iter_Add(OwnedItem[playerid], i);
- }
- }
- }
- Inventory_ShowItems(playerid)
- {
- new count;
- new string[1024];
- new listitemEx[MAX_ITEMS];
- strcat(string, "These are your items:\n");
- foreach(new i : OwnedItem[playerid])
- {
- listitemEx[count] = i;
- count++;
- strcat(string, va_return("%s (SQL ID %d)\n", Inventory_GetItemName(i), i));
- }
- inline _response(response, listitem, string:inputtext[])
- {
- #pragma unused inputtext
- if(!response)
- return 1;
- Inventory_ShowItemMenu(playerid, listitemEx[listitem]);
- }
- Dialog_ShowCallback(playerid, using inline _response, DIALOG_STYLE_TABLIST_HEADERS, "Your inventory", string, "Next", "Close");
- return 1;
- }
- Inventory_ShowItemMenu(playerid, itemid)
- {
- inline _response(responseEx, listitemEx, string:inputtextEx[])
- {
- #pragma unused inputtextEx
- if(!responseEx)
- return Inventory_ShowItems(playerid);
- switch(listitemEx)
- {
- case 1: Inventory_ShowItems(playerid);
- case 2: Inventory_ShowItems(playerid);
- }
- }
- Dialog_ShowCallback(playerid, using inline _response, DIALOG_STYLE_TABLIST_HEADERS, Inventory_GetItemName(itemid), "What do you want to do with this item?\nUse\nDrop", "Next", "Back");
- return 1;
- }
- CMD:inventory(playerid, params[])
- {
- Inventory_ShowItems(playerid);
- return 1;
- }
|