help how to change birthday date to age
#1

heello i want change it if some one registered his type only his age not the data

pawn Код:
else if(RegistrationStep[playerid] == 2)
        {
         new year, month,day;
   getdate(year, month, day);
            new DateInfo[3][20];
            split(text, DateInfo, '/');
            if(year - strvalEx(DateInfo[2]) > 100 || strvalEx(DateInfo[2]) < 1 || strvalEx(DateInfo[2]) >= year)
            {
                ClearChatbox(playerid, 8);
                SendClientMessage(playerid, COLOR_GREEN, "-----------------------------------------------------------------------");
                SendClientMessage(playerid, COLOR_WHITE, "What is your Birthdate? (Use dd/mm/yyyy)");
                SendClientMessage(playerid, COLOR_GREEN, "-----------------------------------------------------------------------");
                ClearChatbox(playerid, 2);
                return 0;
            }
            new check = year - strvalEx(DateInfo[2]);
            if(check == year)
            {
                ClearChatbox(playerid, 8);
                SendClientMessage(playerid, COLOR_GREEN, "-----------------------------------------------------------------------");
                SendClientMessage(playerid, COLOR_WHITE, "What is your Birthdate? (Use dd/mm/yyyy)");
                SendClientMessage(playerid, COLOR_GREEN, "-----------------------------------------------------------------------");
                ClearChatbox(playerid, 2);
                return 0;
            }
            if(strvalEx(DateInfo[1]) > month)
            {
                check -= 1;
            }
            else if(strvalEx(DateInfo[1]) == month && strval(DateInfo[0]) > day)
            {
                check -= 1;
            }
            PlayerInfo[playerid][pAge] = check;
            ClearChatbox(playerid, 8);
            SendClientMessage(playerid, COLOR_GREEN, "-----------------------------------------------------------------------");
            format(string, sizeof(string), "Ok, so you are %d year old.",PlayerInfo[playerid][pAge]);
            SendClientMessage(playerid, COLOR_GREY, string);
            RegistrationStep[playerid] = 3;
            SendClientMessage(playerid, COLOR_WHITE, "3. What is your Origin? (Type in: America, Europe, Asia or Africa)");
            SendClientMessage(playerid, COLOR_GREEN, "-----------------------------------------------------------------------");
            ClearChatbox(playerid, 2);
            return 0;
        }
Reply


Messages In This Thread
help how to change birthday date to age - by Vlad_Riabov - 25.01.2011, 00:44

Forum Jump:


Users browsing this thread: 2 Guest(s)