02.12.2016, 21:41
PHP Code:
// ** INCLUDES
#include <a_samp>
// ** MAIN
main()
{
print("Loaded \"count_numbers_in_string.amx\".");
new array[10];
CountNumbersInString("1672893871653409172564", array);
for(new i = 0; i < sizeof(array); i ++)
{
printf("%d was found %d time(s) in string", i, array[i]);
}
}
// ** CALLBACKS
public OnGameModeInit()
{
return 1;
}
public OnGameModeExit()
{
return 1;
}
// ** FUNCTIONS
stock CountNumbersInString(const string[], array[])
{
new temp[2];
for(new i = 0, j = strlen(string); i < j; i ++)
{
temp[0] = string[i];
array[strval(temp)] ++;
}
return 1;
}