Random numbers

pawn Код:
if(TypingAge[playerid] == 1)
        new age;
        age = strval(text);
        pInfo[playerid][Age] = age;
        SCM(playerid, COLOR_LIGHTYELLOW, "Age set: %d", age);
        TypingAge[playerid] = 0;
        return 0;
It's supposed to set the age he typed then display it on the screen... it shows random numbers.. also in the data file it only shows "1".

For example: when I type 19 ... the message is "Age set: 541725712412" ... any idea why?

You can't format text inside SCM function. At first format, then SCM

new s[32];
format(s, 32, "Age set: %d", age);
SCM(playerid, -1, s);

Try adding this:
PHP код:
if(!IsNumeric(text)) return SCM(playerid,-1,"Enter your age (in numbers)"); 

Forum Jump:

Users browsing this thread: 1 Guest(s)