20.11.2012, 17:08
The array funcname[MAX_FUNC_NAME] is getting indexed by the size of the command, so if the command is bigger than the define MAX_FUNC_NAME, it gets a runtime error and the function stops.
You could add a check to prevent the error occuring.
Example:
You could add a check to prevent the error occuring.
Example:
pawn Код:
new
pos,
funcname[MAX_FUNC_NAME];
while (cmdtext[++pos] > ' ')
{
if(pos > MAX_FUNC_NAME) return 1; // added
funcname[pos-1] = tolower(cmdtext[pos]);
}
format(funcname, sizeof(funcname), "cmd_%s", funcname);

