Are arrays of strings possible?
#4

Quote:
Originally Posted by admantis
Посмотреть сообщение
Fortunately, PAWN (much like any other computer language) supports bi or even tri dimensional arrays, allowing you to store extra data on different indexes on different dimensions!.

For the example Borg posted, the first dimension would represent the index of each text, and the second dimension would store the characters of each string (with a max of 32).
That is correct.

Here's some more description:

pawn Код:
new crimeArray[8][32] = {
    {"Reckless Driving"}, // Can be accessed with "crimeArray[0]"
    {"Vehicular Homicide"}, // Can be accessed with "crimeArray[1]"
    {"vehicular manslaughter"}, // Can be accessed with "crimeArray[2]"
    {"vehicular assault"}, // Can be accessed with "crimeArray[3]"
    {"hit and run"}, // Can be accessed with "crimeArray[4]"
    {"water eluding"}, // Can be accessed with "crimeArray[5]"
    {"air eluding"}, // Can be accessed with "crimeArray[6]"
    {"rTest"} // Can be accessed with "crimeArray[7]"
};

//----In some function or callback
new cStr[128];
format(cStr, sizeof(cStr), "You are being charged with %s, and you will only be let out of jail if you are bailed out by another player. The bail price is $%d.", crimeArray[3], 5600);
cStr would equal:
You are being charged with vehicular assault, and you will only be let out of jail if you are bailed out by another player. The bail price is $5600.
Reply


Messages In This Thread
Are arrays of strings possible? - by Coolflip - 02.09.2013, 03:03
Re: Are arrays of strings possible? - by Borg - 02.09.2013, 03:12
Re: Are arrays of strings possible? - by admantis - 02.09.2013, 04:47
Re: Are arrays of strings possible? - by SchurmanCQC - 02.09.2013, 04:56

Forum Jump:


Users browsing this thread: 1 Guest(s)