I made a system to show the inventory of a dead player, and when the player takes an item from the inventory does not add the dialog, but gives the item to the player.
my code
my code
Code:
ShowLooting( playerid )
{
new text[ 3000 ], subtxt[ 128 ], lootslot;
for( new items; items < MAX_ITEMS; items++)
{
new id = GetDeadID( playerid );
new itemid = PlayerDeadItemID[ items ][ id ];
if( PlayerDeadItemQnt[ items ][ id ] > 0)
{
printf( "%d", items );
DeadGet[ playerid ][ lootslot ] = id;
DeadList[ playerid ][ lootslot ] = itemid;
DeadQntList[ playerid ][ lootslot ] = PlayerDeadItemQnt[ items ][ id ];
// --
format( subtxt, sizeof subtxt, "%d\t%s\n", PlayerDeadItemQnt[ items ][ id ], ItemInfo[ itemid ][ Item_Name ]);
strcat( text, subtxt );
lootslot++;
}
}
ShowPlayerDialog( playerid, DIALOG_LOOT, DIALOG_STYLE_LIST, "Quantia | Item ", text, "Pegar", "x");
return 1;
}
take_OnDialogResponse( playerid, dialogid, response, listitem)
{
if(dialogid == DIALOG_LOOT)
{
if(!response) return 1;
if(response)
{
AddItem( playerid, ItemInfo[ DeadList[ playerid ][ listitem ] ][ Item_Name ], DeadQntList[ playerid ][ listitem ] );
PlayerDeadItemQnt[ listitem ][ DeadGet[ playerid ][ listitem ]] --;
}
return 1;
}
return 0;
}