SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 17/07/2017, 06:12 PM   #1
BHTMestre
Big Clucker
 
Join Date: Apr 2014
Posts: 134
Reputation: 2
Default Show dead player loot

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

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;
}
BHTMestre is offline   Reply With Quote
Old 17/07/2017, 06:19 PM   #2
Paulice
Gangsta
 
Join Date: Jul 2017
Posts: 497
Reputation: 44
Default Re: Show dead player loot

Could you explain the issue you're having a bit more clearly?
Paulice is offline   Reply With Quote
Old 17/07/2017, 06:29 PM   #3
BHTMestre
Big Clucker
 
Join Date: Apr 2014
Posts: 134
Reputation: 2
Default Re: Show dead player loot

Quote:
Originally Posted by Paulice View Post
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

Code:
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;
}
BHTMestre is offline   Reply With Quote
Old 17/07/2017, 06:45 PM   #4
Paulice
Gangsta
 
Join Date: Jul 2017
Posts: 497
Reputation: 44
Default Re: Show dead player loot

Reset the array index? Example:
Code:
ItemYouPickedUp[the player's ID][slot of item][id] = 0;
[ ... ]
Then show the dialog again.
Paulice is offline   Reply With Quote
Old 17/07/2017, 06:46 PM   #5
BHTMestre
Big Clucker
 
Join Date: Apr 2014
Posts: 134
Reputation: 2
Default Re: Show dead player loot

Quote:
Originally Posted by Paulice View Post
Reset the array? Example:
PHP Code:
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
BHTMestre is offline   Reply With Quote
Old 17/07/2017, 06:47 PM   #6
Paulice
Gangsta
 
Join Date: Jul 2017
Posts: 497
Reputation: 44
Default Re: Show dead player loot

Quote:
Originally Posted by BHTMestre View Post
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.
Paulice is offline   Reply With Quote
Old 17/07/2017, 07:38 PM   #7
BHTMestre
Big Clucker
 
Join Date: Apr 2014
Posts: 134
Reputation: 2
Default Re: Show dead player loot

Quote:
Originally Posted by Paulice View Post
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 is offline   Reply With Quote
Old 17/07/2017, 09:06 PM   #8
BHTMestre
Big Clucker
 
Join Date: Apr 2014
Posts: 134
Reputation: 2
Default Re: Show dead player loot

help me
BHTMestre is offline   Reply With Quote
Old 17/07/2017, 09:27 PM   #9
FailerZ
Huge Clucker
 
FailerZ's Avatar
 
Join Date: Oct 2013
Location: 33.5138 N, 36.2765 E
Posts: 225
Reputation: 22
Default Re: Show dead player loot

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
__________________
[FilterScript]Digital Health & Armour [DHA]
[FilterScript]Labels Creator [LC]
[FilterScript]Debug Mode [D-Mode]
[FilterScript]Advance Fish System [AFS]
FailerZ is online now   Reply With Quote
Old 17/07/2017, 09:31 PM   #10
Paulice
Gangsta
 
Join Date: Jul 2017
Posts: 497
Reputation: 44
Default Re: Show dead player loot

Quote:
Originally Posted by FailerZ View Post
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]).
Paulice is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to show textdraw[MAX_PLAYERS] show for a player? Maheerali Scripting Help 2 14/08/2016 03:17 PM
simple show player money with textdraw will show player money to all !!!!LOL dash5487 Scripting Help 10 15/04/2015 09:43 PM
when player dead ,not again spawn kinggta Scripting Help 4 23/03/2014 05:46 PM
Bug when Player Dead MBilal Scripting Help 3 18/03/2014 11:46 PM
Script: HOw player is dead SworDDicK Help Archive 5 04/10/2010 07:21 PM


All times are GMT. The time now is 03:46 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.