CREATING ARRAYS
1) setarray name,length;
Will create a new array with the specified length which will be identified with the specified name.
2) arrayname = {0,0,..};
Same as above, but you can specify what will be in the array. (e.g. settings = {1,4,0,1,1,3}
ARRAY INDEXES
1) You must first create an array before you can access it. To access an array, then use "arrayname[#]" where # is the index you want to access. Also, indexes start at 0. So if you use:
NPC Code:
setarray settings,6;
Then the last index in the array will be 5.
2) To change something in an array, just use:
NPC Code:
name[i] = #;
name: The name of the array you wish to access
i: The index in which you want to change the value of
#: The value you want to set the accessed array index to
(Note: Regular arrays can only hold variables.)
3) If you want access something from an array, but not change it, just use something such as:
NPC Code:
if (playerchats && strequals(#c,show hp)) {
setplayerprop #c, #v(attributes[2]);
}
Have I missed anything (besides string arrays)?