Show dead player loot
#1

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;
}
Reply
#2

Could you explain the issue you're having a bit more clearly?
Reply
#3

Quote:
Originally Posted by Paulice
Посмотреть сообщение
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;
}
Reply
#4

Reset the array index? Example:
Код:
ItemYouPickedUp[the player's ID][slot of item][id] = 0;
[ ... ]
Then show the dialog again.
Reply
#5

Quote:
Originally Posted by Paulice
Посмотреть сообщение
Reset the array? Example:
PHP код:
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
Reply
#6

Quote:
Originally Posted by BHTMestre
Посмотреть сообщение
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.
Reply
#7

Quote:
Originally Posted by Paulice
Посмотреть сообщение
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
Reply
#8

help me
Reply
#9

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
Reply
#10

Quote:
Originally Posted by FailerZ
Посмотреть сообщение
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]).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)