SA-MP Forums Archive
strmid - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: strmid (/showthread.php?tid=615712)



strmid - GoldenLion - 26.08.2016

Hi, I have a /products command in my script which you can change products' prices with. It used yo have dialog style list in this format "item - ($price)", but now I changed it to tablist headers and the problem is when I do /products and change the price of an item, it doesn't give me the name of the item because it is supposed to extract the item's name before "-", but I have now tablist headers and it doesn't have a "-" it's like that: "Item\tPrice\n\Cellphone\t%s\n\".
So basically all I need to know is how to get the item's name from there.
Here is the code:
Код:
Dialog:EditProduct(playerid, response, listitem, inputtext[])
{
	static
	    bizid = -1;

	if ((bizid = Business_Inside(playerid)) != -1 && Business_IsOwner(playerid, bizid))
	{
		if (response)
		{
		    static
		        item[24];

		    strmid(item, inputtext, 0, strfind(inputtext, " ") - 1); // <-- here
		    strpack(PlayerData[playerid][pEditingItem], item, 32 char);

            PlayerData[playerid][pProductModify] = listitem;
      		Dialog_Show(playerid, PriceSet, DIALOG_STYLE_INPUT, "Business: Set Price", "Please enter the new product price for \"%s\":", "Modify", "Back", item);
		}
	}
	return 1;
}
As you can see I tried putting a space there, but it doesn't work. I need to get that "\t" there, but I don't know how. Does anyone know?

EDIT: Omg wrong section again wtf why do i always post here


Re: strmid - Konstantinos - 26.08.2016

It's a bug with DIALOG_STYLE_TABLIST_HEADERS. "inputtext" stores the text before the first \t and anything after will not be stored.


Re: strmid - GoldenLion - 26.08.2016

Oh alright, so does it mean that I can't get the item's name? Or I just need to make inputtext as the item's name? Also is there the same bug in DIALOG_STYLE_TABLIST?


Re: strmid - Konstantinos - 26.08.2016

If the row the player selects is "item\t$money", then you can only retrieve the name of the item using "inputtext" but not the price.

I'm not sure about DIALOG_STYLE_TABLIST (I cannot currently test it either), I can't seem to find the posts reported this in 0.3.7 RC and even the wiki doesn't mention it.


Re: strmid - GoldenLion - 26.08.2016

Alright, thanks.