some question about contatini() and its realisation in some plugin
PHP Code:
i is the line number and j is allways null, thougt it's a size, means that only 1st symbol is checking but it's not, maybe it is becose of the array type? i'm not really into data types |
Re: some question about contatini() and its realisation in some plugin
The way that small c parses strings in function calls is why this works.
Basically if you have a string of: new hi[5] = "Hello". That's [0]: h [1]: e ... [4]: o [5]: ^0 //null terminated string If you pass to a function check( hi[2] ), what gets passes is check( "llo" ). So in your example since j is null aka. 0 its passing a starting point of the string at 0. There was a good post about this in snippets/tutorial by Twilight Suzuka. |
Re: contatini() and its realisation in some plugin
Is the CheatReports array an array of strings containing the strings you are checking for? If so you can remove the [j] from the containi() check. Hope this helps
Little example: PHP Code:
|
Re: contatini() and its realisation in some plugin
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
|
Re: contatini() and its realisation in some plugin
Quote:
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. |
| All times are GMT -4. The time now is 15:00. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.