How to store inputtext into variable properly?
#5

You must declare it as array, eg:

Код:
#define MAX_FIRSTNAME 20
new CharacterFirstname[MAX_PLAYERS][MAX_FIRSTNAME];
(The define holds the maximum length of the first name, optional but useful to check for input length etc).

Later, you can insert inputtext to the array like this:

Код:
CharacterFirstname[playerid][0] = 0; // Empties the string, in case you didn't do it in OnPlayerConnect
strcat(CharacterFirstname[playerid], inputtext, MAX_FIRSTNAME); // Writes inputtext into the array - strcat appends strings, so it must be cleared before (see above)
It must be a multidimensional array, because you don't want to store just one value per player, but a string (array).
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)