Array sizes do not match - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Array sizes do not match (
/showthread.php?tid=304880)
Array sizes do not match -
Jack_Leslie - 20.12.2011
pawn Код:
stock CountrySearch(const string[])
{
if (!string[0])
return string;
static
x = sizeof (cntNames),
results_found = 0,
result_string[512],
return_string[512 + 128];
while (x >= 0)
{
if (strfind(cntNames[x], string, false) != -1)
{
results_found += 1;
strcat(result_string, cntNames[x]);
if (results_found > 1) strcat(result_string, "\n");
}
x -= 1;
}
if (results_found >= 0)
{
if (!results_found)
format(return_string, sizeof (return_string), "No results found for '%s'.\nPlease check your spelling and try again.", string);
if (results_found == 1)
format(return_string, sizeof (return_string), "Did you mean: %s", result_string);
else if (results_found <= 10)
format(return_string, sizeof (return_string), "Did you mean one of these?\n%s", result_string);
else
format(return_string, sizeof (return_string), "Did you mean one of these?\n%s\nNOTE: Only the first 10 results are shown, the rest is cut off.", result_string);
return return_string;
}
}
On line:
Re: Array sizes do not match -
FarSe. - 20.12.2011
pawn Код:
stock CountrySearch(const string[])
{
static
x = sizeof (cntNames),
results_found = 0,
result_string[512],
return_string[512 + 128];
if (string[0] != EOS)
{
while (x >= 0)
{
if (strfind(cntNames[x], string, false) != -1)
{
results_found += 1;
strcat(result_string, cntNames[x]);
if (results_found > 1) strcat(result_string, "\n");
}
x -= 1;
}
if (results_found >= 0)
{
if (!results_found)
format(return_string, sizeof (return_string), "No results found for '%s'.\nPlease check your spelling and try again.", string);
if (results_found == 1)
format(return_string, sizeof (return_string), "Did you mean: %s", result_string);
else if (results_found <= 10)
format(return_string, sizeof (return_string), "Did you mean one of these?\n%s", result_string);
else
format(return_string, sizeof (return_string), "Did you mean one of these?\n%s\nNOTE: Only the first 10 results are shown, the rest is cut off.", result_string);
}
}
return return_string;
}