I have this stock:
Code:
#define _BOOL(%1) view_as< bool >( %1 )
stock bool StringToBool(const char[] str, bool simple=true) {
if ( simple )
return _BOOL( StringToInt( str ) );
if ( strcmp( str, "true", false ) == 0 || strcmp( str, "yes", false ) == 0 || strcmp( str , "on", false ) == 0 || str[0] == '1' )
return true;
return false;
}
Sometimes i use words like "true" in my configs, sometimes only "0" and "1". You can use same method if you want.
__________________