21.07.2017, 00:08
This is the best method I could think of:
pawn Код:
new bool:continueLoop = true;
for (new x = 0; x < sizeof(datatesting); x++)
{
for (new xx = 0; xx < x; xx++)
{
if (strfind(datatesting[xx][dmCategory], datatesting[xx][dmCategory]) == 0) // strfind is faster than strcmp
{
continueLoop = false; // we can't break here the main loop, so we set our variable as false
break; // already found a duplicate, stop this duplicate-detector loop !
}
}
if (continueLoop == false) // if a duplicate one was detected, continue our loop
{
continueLoop = true;
continue;
}
format(string, sizeof(string), "%s\t%d\n",datatesting[x][dmCategory],x);
strcat(fullstr, string);
}