Hey There!
I just realized ArrayFindString will returns the index of the first occurence of the specified string. As it says in the documentation.
If you have an array like:
- de_dust2_long
- de_nuke
And you are looking for a string like:
- de_dust2
The function will returns 0 instead of -1. I know de_dust2 is part of de_dust2_long, but wouldn't be nice a 3rd param of the original function to search exact string or substing?
PHP Code:
ArrayFindStringEx(&Array: Which, szItem[], bExact = 1) {
if ( !bExact )
return ArrayFindString(Which, szItem);
new szTmpItem[32], iArraySize = ArraySize(Which);
for ( new i; i < iArraySize; i ++ ) {
ArrayGetString(Which, i, szTmpItem, charsmax(szTmpItem));
if ( equal(szItem, szTmpItem) )
return i;
}
return -1;
}