SA-MP Forums Archive
Random numbers - 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: Random numbers (/showthread.php?tid=553761)



Random numbers - viddo - 31.12.2014

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?


Re: Random numbers - ball - 31.12.2014

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);



Re: Random numbers - ATGOggy - 31.12.2014

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