Raised This Month: $ Target: $400
 0% 

contatini() and its realisation in some plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-15-2009 , 12:51   Re: contatini() and its realisation in some plugin
Reply With Quote #1

Quote:
Originally Posted by .Owyn. View Post
yes my array is only strings and i don't need [j], in what condition will i needit ? still don't get the [j] thing
CheatReports is a 2-dimension array which means it is an array of arrays ... or in this case it can be referred to an array of strings.

A 1-dimension array is like so:
new TheArray[] = { 5 , 33 , 55 , 66 , 102 };

If we wanted to access 55 in this array, we would refer to it with TheArray[ 2 ] because the elements start at 0 for index and we want the 3rd element which is the number 55. 0=5, 1=33, 2=55 3=66 4=102

A 2-dimension array (array of strings).

new TheArray[][] = { "hello" , "my" , "friend" };

What this does is creates an array sized @ [ 3 ][ 7 ], the second dimension is 7 because it is automatically allocated to be large enough to store the largest string specified plus a null character, in this case "friend" which is 6 chars long + 1 so 7.

The array looks like this as far as memory is concerned:
0 = "hello**"
1 = "my*****"
2 = "friend*"
* = NULL or 0

To access the word "my" you use TheArray[ 1 ] because the word "my" is the 2nd element in the array and again, the array begins at a 0 index. 0="hello", 1="my", 2="friend".

About [j]:

If you want to access only a portion of the string you can specify the 2nd dimension. Example, suppose you wanted to access only "end" in the word "friend" you would do TheArray[ 2 ][ 3 ]. This is because the word "friend" is located at index 2 of the string array and "end" is found at index 3 of the word "friend"; 0=f 1=r 2=i 3=e.

See the Strings section in this tutorial.
__________________

Last edited by Bugsy; 08-15-2009 at 13:02.
Bugsy is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:00.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode