View Full Version : The date of birth.

29/08/2011, 06:17 PM
Hi everybody.I wank to ask,how to make that thing,when player register,he get dialog,input,and there he have write his date of birth,but primarily is how to make format,i have mean player have write like that:"Day/Month/Year/


Like that.And i want to do if day is more than 31, or less than 1,then he get this dialog again,or if he write month more than 12, or less than 1,then too he get this dialog again,and with years,if he write more than 2011, or less than 1950,then dialog he get again.

29/08/2011, 06:35 PM
new Dates[3][11];
new DateString[11]="04/02/1997";

new day = strval(Dates[0]);
new month = strval(Dates[1]);
new year = strval(Dates[2]);

if(day<1||day>31) SendClientMessage(playerid,0xFFFFFFFF,"Day can only be from 1 to 31");
if(month<1||month>12) SendClientMessage(playerid,0xFFFFFFFF,"Month can only be from 1 to 12");
if(year<1) SendClientMessage(playerid,0xFFFFFFFF,"Year can be less than 1");

It's a example how you can do it with dialogs or whatever you need. Just make DateString variable equal to inputtext.
Not tested, but it should work.

29/08/2011, 07:03 PM
C:\Documents and Settings\Owner\Desktop\NAUJAUSIAS SAMP SERVERIS\gamemodes\freeroam.pwn(221) : error 017: undefined symbol "split"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase

1 Error.

29/08/2011, 07:50 PM
stock split(const strsrc[], strdest[][], delimiter)
new i, li;
new aNum;
new len;
while(i <= strlen(strsrc))
if(strsrc[i] == delimiter || i == strlen(strsrc))
len = strmid(strdest[aNum], strsrc, li, i, 128);
strdest[aNum][len] = 0;
li = i+1;
return 1;

sorry, i forgot.

29/08/2011, 08:01 PM
Or you could use sscanf, which is faster and much better than this split function.

new day, month, year,
DateString[11] = "04/02/1997";
sscanf(DateString, "p</>ddd", day, month, year);

Code untested.