SA-MP Forums Archive
Dialog messup - 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: Dialog messup (/showthread.php?tid=342843)



Dialog messup - bleedis - 15.05.2012

Hey there again hehe.
Im creating my server and now comes the time when i want to add inventory system in it. Im using THIS system for that.
There is that command who checks player inventory -
pawn Код:
if(!strcmp(cmdtext[1],"myitems",true))
{
  new idx,amount,itemname[MAX_ITEM_NAME];
  new tmp[128];
  while(GetPlayerItemInfo(playerid,idx,itemname,_,amount))
  {
    if(strlen(itemname))
    {
      format(tmp,128,"%s -- %d",itemname,amount);
      SendClientMessage(playerid,0xFFFFFFFF,tmp);
    }
  }
  return 1;
}
and outcome is this -

But i want to remaki it to dialog_style_msgbox
Code:
pawn Код:
if(!strcmp(cmdtext[1],"myitems",true))
    {
      new idx, amount,itemname[MAX_ITEM_NAME];
      new tmp[128];
      while(GetPlayerItemInfo(playerid,idx,itemname,_,amount))
      {
        if(strlen(itemname))
        {
          format(tmp,128,"%s -- %d",itemname,amount);
          ShowPlayerDialog(playerid, INVENTORY, DIALOG_STYLE_MSGBOX, "{6199D4}Inventars.", tmp,"Aizvert", "");
        }
      }
      return 1;
    }
and outcome is this
Items is saving in file in that order
Код:
Medkit4Armour3Mask3
anyone can help me to get it to dialog?
Thanks


Re: Dialog messup - TzAkS. - 15.05.2012

And how can we help you?
You did that to dialog,do it like this for all and be sure you use differit id for all dialogs.
And for this
Код:
Medkit4Armour3Mask3
you need to add \n for new line.


Re: Dialog messup - bleedis - 15.05.2012

Saving is not a problem. Just outcome of the command, when im using sendclientmessage it shows all items when dialog only last piece i want that in dialog there are all items not only last. hope u get a point.


Re: Dialog messup - bleedis - 16.05.2012

Any help guys?


AW: Dialog messup - EthanR - 16.05.2012

Код:
if(!strcmp(cmdtext[1],"myitems",true))
{
    new idx, amount,itemname[MAX_ITEM_NAME];
    new tmp[128], string[256];
    while(GetPlayerItemInfo(playerid,idx,itemname,_,amount))
    {
        if(strlen(itemname))
        {
          format(tmp,128,"%s -- %d\n",itemname,amount);
	  strcat(string, tmp);
        }
    }
    ShowPlayerDialog(playerid, INVENTORY, DIALOG_STYLE_MSGBOX, "{6199D4}Inventars.", tmp,"Aizvert", "");
    return 1;
}
try this here. might work. (I don't really like strcat so better try it lol)

EDIT: For you to understand, strcat moves 1 string into another. You first have to make a string with all Information before you can display the dialog. So first you collect the information in the while(GetPlayerItemInfo loop and then you display the dialog after it.


Re: AW: Dialog messup - bleedis - 16.05.2012

Still showing only last item. first 2 doesnt show


Re: Dialog messup - SuperViper - 16.05.2012

Change the format line to this:

pawn Код:
format(tmp,128,"%s%s -- %d\n",tmp,itemname,amount);
I recommend changing the length of the 'tmp' variable to 200, because the person might have more items.


Re: Dialog messup - bleedis - 16.05.2012

Thank u. Working.