View Single Post
  #3  
Old 02-19-2003, 09:28 AM
screen_name screen_name is offline
is watching you
Join Date: Mar 2002
Location: The 3rd Dimension
Posts: 2,160
screen_name is on a distinguished road
Send a message via AIM to screen_name Send a message via MSN to screen_name
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)?
__________________
[signature]insert here[/signature]
Reply With Quote