Posts: 1,801
Threads: 21
Joined: Mar 2008
Reputation:
0
The logic is correct, however to make it work the length of empty slots must always be zero (first slot (0) must be 0) - obviously.
If that's the case I don't see anything wrong there.
No matter what slot is the selected, because of break it's always just one that gets writen to.
Btw you can also replace the "%s" with name directly, no need to use a format specifier if you want to set it to the whole string without any actual formatting. Or use strcat since it's empty anyways.
Or did I get you wrong somehow?
Posts: 11,827
Threads: 33
Joined: Dec 2011
Reputation:
0
Using isnull is way better than strlen as well as strcpy (a macro of strcat that resets the string before copying to destination) for copying strings instead of format.
You cannot have a 2D array inside an enumerator (I believe in Zeex's version of the compiler that is possible but not sure). As of now, you got 10 items with no size for the text.
EDIT: To be more precise: Consider Statistics[playerid][Item] as string
If you print string[0] will give all the characters, if you do string[1] will give all the characters except the first one that why the first letter disappears in every iterator.
Posts: 694
Threads: 2
Joined: Oct 2012
Reputation:
0
A - why don't you use isnull?
B - don't use format
C - Why don't you use IDs for this matter? Assign a unique ID to each item, save them in array, use them then if you want to know which item there is, just match the id to the array to get the name.
Posts: 11,827
Threads: 33
Joined: Dec 2011
Reputation:
0
strcmp returns 0 when both strings are equal (same) so modify that line. When using list with dialogs, "inputtext" holds the text of the line (row) you selected.