SA-MP Forums Archive
Show dead player loot - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Show dead player loot (/showthread.php?tid=637581)



Show dead player loot - BHTMestre - 17.07.2017

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



Re: Show dead player loot - Paulice - 17.07.2017

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


Re: Show dead player loot - BHTMestre - 17.07.2017

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



Re: Show dead player loot - Paulice - 17.07.2017

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


Re: Show dead player loot - BHTMestre - 17.07.2017

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


Re: Show dead player loot - Paulice - 17.07.2017

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.


Re: Show dead player loot - BHTMestre - 17.07.2017

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


Re: Show dead player loot - BHTMestre - 17.07.2017

help me


Re: Show dead player loot - FailerZ - 17.07.2017

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


Re: Show dead player loot - Paulice - 17.07.2017

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]).