PDA

View Full Version : Show dead player loot


BHTMestre
17/07/2017, 05:12 PM
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


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;
}

Paulice
17/07/2017, 05:19 PM
Could you explain the issue you're having a bit more clearly?

BHTMestre
17/07/2017, 05:29 PM
Could you explain the issue you're having a bit more clearly?

I want to make when the player picks up the item, some of the dialog

example


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 ] );
HERE REMOVE DIALOG'S SELECTED ITEM!
}
return 1;
}

return 0;
}

Paulice
17/07/2017, 05:45 PM
Reset the array index? Example:
ItemYouPickedUp[the player's ID][slot of item][id] = 0;
[ ... ]

Then show the dialog again.

BHTMestre
17/07/2017, 05:46 PM
Reset the array? Example:
ItemYouPickedUp[the player's ID][slot of item][name] = 0;
[ ... ]

Then show the dialog again.

Friend, I want when the player takes the item, disappear from the dialog

Paulice
17/07/2017, 05:47 PM
Friend, I want when the player takes the item, disappear from the dialog

Friend, that's what you should do to make it disappear from the dialog.

BHTMestre
17/07/2017, 06:38 PM
Friend, that's what you should do to make it disappear from the dialog.

When I get the first item does not add up from the list, when I get the second item, add the first one

BHTMestre
17/07/2017, 08:06 PM
help me

FailerZ
17/07/2017, 08:27 PM
Make a Boolean variable (Add it to your existing enum) to determine if that inventory slot is in use. Make it in use (true) when the player receive an item..
When the player drop the item..Make the slot (false)
Then here when you are looping though them add another check of it to check if the variable in use (true).
That's it

Paulice
17/07/2017, 08:31 PM
Make a Boolean variable (Add it to your existing enum) to determine if that inventory slot is in use. Make it in use (true) when the player receive an item..
When the player drop the item..Make the slot (false)
Then here when you are looping though them add another check of it to check if the variable in use (true).
That's it

Or simply set the ID of the item to -1 (or if you do not use zero [0] then set it to zero [0]).

BHTMestre
17/07/2017, 09:09 PM
Or simply set the ID of the item to -1 (or if you do not use zero [0] then set it to zero [0]).
see SS
http://imgur.com/a/NQIsl