Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

listitem issue - Always set to 0

$
0
0
So for some reason, the item selected is always listitem = 0; No matter what item it is at the time of selection, it'll always set to 0 with the odd chance it uses the correct one... Once out of like ~50 tries. I'm being blind or overlooking something, because this is giving me a real headache.

Stock to show inventory items;
PHP Code:

stock ShowCharacterInventory(playerid)
{
    new 
larstr[600], titlestr[80], counter 0;
    new 
newinv ReturnInvItems(playerid);
    
printf("%i"newinv);
    for(new 
0newinvi++)
    {
        
Dialog_SetListitemPreviewRot(playeridi, -30.00.025.01.00xFFFFFFFF0xFFFFFFFF);
        
format(larstrsizeof(larstr), "%s%i\t%s (%i)\n"larstrInvItems[i][iModelID], InvItems[i][iItemName], InvItems[i][iItemAmount]);
        
counter++;
    }
    if(
counter == 0)
        return 
SendClientMessage(playeridCOLOR_RED"SERVER: You have no inventory items");
        
    
format(titlestrsizeof(titlestr), "Inventory: %i/%i"counter16);
    
ShowPlayerDialog(playeridDIALOG_INVENTORY_SELECTDIALOG_STYLE_PREVIEW_MODELtitlestrlarstr"Select""<<");
    return 
1;


That works fine, shows all the correct items in a users inventory etc etc.

The DIALOG_INVENTORY_SELECT;
PHP Code:

case DIALOG_INVENTORY_SELECT:
        {
            if(!
response)
                return 
0;
            new 
str[128];
            new 
Float:xFloat:yFloat:z;
            
GetPlayerPos(playeridxyz);
            new 
world GetPlayerVirtualWorld(playerid);
            new 
int GetPlayerInterior(playerid);
            
            
ApplyAnimation(playerid,"BOMBER","BOM_Plant_Crouch_In"4.0000001);
            
            
printf("%i - %i"listitemInvItems[listitem][iItemsID]);
            
DropItem(playeridInvItems[listitem][iItemsID], InvItems[listitem][iModelID], InvItems[listitem][iItemAmount], InvItems[listitem][iItemName], xyzworldint);
            
RemoveFromInv(playeridInvItems[listitem][iItemsID], InvItems[listitem][iModelID], InvItems[listitem][iItemName], InvItems[listitem][iItemAmount]);
            
            
format(strsizeof(str), "You have dropped a %s."InvItems[listitem][iItemName]);
            
SendClientMessage(playeridCOLOR_WHITEstr);
        } 


Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>