[Help] IsNumeric
#1

Hey guys, I'm at my wits end with this problem - I have a half decent script that is meant to get a colours id by the name e.g black = 0 but whenever i compile it I get the following error. Please help!

error 017: undefined symbol "IsNumeric"

Код:
public GetColorCode(clr[])
{
	new color = -1;
	if (IsNumeric(clr))
	{
	  color = strval(clr);
	  return color;
	}
	if (strcmp(clr, "black", true)==0) color=0;
	if (strcmp(clr, "white", true)==0) color=1;
	if (strcmp(clr, "blue", true)==0) color=2;
	if (strcmp(clr, "red", true)==0) color=3;
	if (strcmp(clr, "green", true)==0) color=16;
	if (strcmp(clr, "purple", true)==0) color=5;
	if (strcmp(clr, "yellow", true)==0) color=6;
	if (strcmp(clr, "lightblue", true)==0) color=7;
	if (strcmp(clr, "navy", true)==0) color=61;
	if (strcmp(clr, "beige", true)==0) color=102;
	if (strcmp(clr, "darkgreen", true)==0) color=51;
	if (strcmp(clr, "darkblue", true)==0) color=103;
	if (strcmp(clr, "darkgrey", true)==0) color=13;
	if (strcmp(clr, "gold", true)==0) color=99;
	if (strcmp(clr, "brown", true)==0) color=55;
	if (strcmp(clr, "darkbrown", true)==0) color=84;
	if (strcmp(clr, "darkred", true)==0) color=74;
	if (strcmp(clr, "maroon", true)==0) color=115;
	if (strcmp(clr, "pink", true)==0) color=126;
	return color;
}
Reply
#2

pawn Код:
IsNumeric(const string[])
{
    for (new i = 0, j = strlen(string); i < j; i++)
    {
        if (string[i] > '9' || string[i] < '0') return 0;
    }
    return 1;
}
Put this somewhere in your script. (NOT in a callback)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)