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
![](http://www.bildites.lv/images/k8v7vmsoe5499dp1osyc.png)
Items is saving in file in that order
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
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.