How to Extract values from a string ?
#1

Hi ! I'm actually scripting a shop system, where people can buy or sell some stuffs from their inventories. I'm having some problems for the buying part, as the prices and the quantities aren't always the same (setted by the seller).

So i have to extract the values from the " Menu row" they selected, to take the money, and give them the stuffs they bought.
It's hard to explain so i took a screen shot :


How can i do ?


I also add the script of the menu, dunno if it can help.
Код:
public CreateAKBulletsMenus()
{
	AK47Bullets = CreateMenu("AK47 Bullets", 2, 200.0, 100.0, 150.0, 150.0);
	new quantity[240];
	for(new i = 0; i < sizeof(SHOP); i++)
	{
if(SHOP[i][Item] == 24)
{
if(SHOP[i][Quantity] > 0)
{
				format(quantity,240,"%d x AK47 Bullets",SHOP[i][Quantity]);
AddMenuItem(AK47Bullets, 0, quantity);
				format(quantity,240,"	%d $",SHOP[i][Price]);
AddMenuItem(AK47Bullets, 1, quantity);
			}
		}
	}
	AddMenuItem(AK47Bullets, 0, "[Exit]");
}
Reply
#2

The same way you put these prices when making the menu.

And to get value from string use strval(string[]).
Reply
#3

Quote:
Originally Posted by MadeMan
The same way you put these prices when making the menu.

And to get value from string use strval(string[]).
I don't understand :S.

How can i do using OnPlayerSelectedMenuRow(playerid, row) ?
Reply
#4

string is a character set, which may represent a text, phrase, word and so on.
Examples

By declaring this array, it is initially looks like this:

new StringTest [10], (can hold a string with up to 10 chars)

[][][][][][][][][][]

But when I hold her say hello, looks like this:

[H][e][l][l][o][\0][][][][]

this is the basics.

(sorry my bad english)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)