Case/Dialog identification issue
#5

Create an inventory array and than you could access the specific item without problems
This code only works if the order of the items is the same as in your inventory dialog
PHP код:
ShowItemDialog(playeriditem) {
    const
        
size 5
    
;
    if(
<= item size) {
        new
            
count,
            
inventory[size]
        ;
        if(
PlayerInfo[playerid][pIAmphetamine] >= 1inventory[count++] = 1;
        if(
PlayerInfo[playerid][pIBackpack] >= 1inventory[count++] = 2;
        if(
PlayerInfo[playerid][pICocaine] >= 1inventory[count++] = 3;
        if(
PlayerInfo[playerid][pIHikingBag] >= 1inventory[count++] = 4;
        if(
PlayerInfo[playerid][pIMarijuana] >= 1inventory[count++] = 5;
        static
            
info[] = "Use\nShow\nDrop",
            
button1[] = "Select",
            
button2[] = "Cancel"
        
;
        switch(
inventory[item]) {
            case 
1: return ShowPlayerDialog(playeridDIALOG_IAMPHETAMINEDIALOG_STYLE_LISTCOL_WHITE "Amphetamine Pill"infobutton1button2);
            case 
2: return ShowPlayerDialog(playeridDIALOG_IBACKPACKDIALOG_STYLE_LISTCOL_WHITE "Backpack"infobutton1button2);
            case 
3: return ShowPlayerDialog(playeridDIALOG_ICOCAINEDIALOG_STYLE_LISTCOL_WHITE "Ball of Cocaine"infobutton1button2);
            case 
4: return ShowPlayerDialog(playeridDIALOG_IHIKINGDIALOG_STYLE_LISTCOL_WHITE "Hiking Bag"infobutton1button2);
            case 
5: return ShowPlayerDialog(playeridDIALOG_IMARIJUANADIALOG_STYLE_LISTCOL_WHITE "Marijuana Cigarette"infobutton1button2);
        }
    }
    return 
false;

PHP код:
case DIALOG_INVENTORY:
{
    if(
response)
    {
        
ShowItemDialog(playeridlistitem);
    }

Reply


Messages In This Thread
Case/Dialog identification issue - by cuzido - 07.02.2016, 23:16
Re: Case/Dialog identification issue - by cuzido - 08.02.2016, 15:18
Re: Case/Dialog identification issue - by Vince - 08.02.2016, 15:30
Re: Case/Dialog identification issue - by cuzido - 08.02.2016, 16:12
Re: Case/Dialog identification issue - by Nero_3D - 08.02.2016, 16:19
Re: Case/Dialog identification issue - by cuzido - 08.02.2016, 16:36

Forum Jump:


Users browsing this thread: 1 Guest(s)