Getting date problem (+rep)
#1

Hello Guys.I maked simple script for getting date.

pawn Код:
new godina, mesec, den, maxdenovi, maxsaati;
    day= 31;
                month = 12;
                year = 2014;
                hour = 23;
                minute = 15;
pawn Код:
switch(mesec)
                {
                    case 1, 3, 5, 7, 8, 10, 12: maxdenovi = 31;
                    case 4, 6, 9, 11: maxdenovi = 30;
                    case 2: maxdenovi = ((!(godina % 4)) ? (29) : (28));
                }
                if((den += 15) > maxdenovi) den -= maxdenovi, mesec++;
                if(mesec > 12) mesec -= 12, godina++;
                if(saat > 23) saat -= 23, den++;
                if(den  > maxdenovi) den  -= maxdenovi, mesec++;
                if(mesec > 12) mesec -= 12, godina++;
                if(minuta > 60) minuta -= 60, saat++;
den - day
maxdenovi - maxdays
godina - year
mesec - month


Right now i have String SendMessage

pawn Код:
SCMF(playerid, COLOR_WHITE, "{00C0FF}[INFO]{FFFFFF} Go podignavte vasiot pasos koj sto trae do %d/%d/%d %d:%d",den,mesec,godina,vadenjesaat,vadenjeminuta);
I maked if the maxhour is 24 hours and if hour is hour > 24) day++; but didnt work.Example for my code 31.12.2014 23:15 and i have maked +1 hour to get the passport.Right now he say me The passport will be done at: 31.12.2014 at 24:15 i changed the maxhour to 23 and didnt work again.Can anyone help me to make in place of 31.12.2014 at 24:15 to say 01.01.2015 at 00:15
Reply
#2

Uhh..

https://sampwiki.blast.hk/wiki/Getdate
https://sampwiki.blast.hk/wiki/Gettime
Reply
#3

code plz ?
Reply
#4

https://sampforum.blast.hk/showthread.php?tid=254915
Reply
#5

mati233 please read before comment Thanks.Im looking for code to check days, 24 hour, month, year and etc ...
Reply
#6

Quote:
Originally Posted by ScripteRMKD
Посмотреть сообщение
mati233 please read before comment Thanks.Im looking for code to check days, 24 hour, month, year and etc ...
An example code is HERE and HERE. The examples are clear enough for any dummy to understand.
Reply
#7

Change it to

Код:
if (hour > 22)
{
    hour = 0; 
    day++;
}
else
{
    hour++;
}
Reply
#8

Quote:
Originally Posted by AnthonyTimmers
Посмотреть сообщение
Change it to

Код:
if (hour > 22)
{
    hour = 0; 
}
else
{
    hour++;
}
Well whats the point in that, How many hours are there in a full day? 24 NOT 22
Reply
#9

Sorry I didn't remember pawno doesn't have a function that converts timestamps to formatted dates.
You could try this inc:
https://sampforum.blast.hk/showthread.php?tid=347605

My suggestion would be something like:
PHP код:
new Timestamp gettime() + 3600// +1 hour
TimestampToDate(TimestampyearmonthdayhourminutesecondHourGMT);
SCMF(playeridCOLOR_WHITE"{00C0FF}[INFO]{FFFFFF} Go podignavte vasiot pasos koj sto trae do %d/%d/%d %d:%d",day,month,year,hour,minute); 
Reply
#10

Quote:
Originally Posted by zT KiNgKoNg
Посмотреть сообщение
Well whats the point in that, How many hours are there in a full day? 24 NOT 22
If the hour is higher than 22, it'd most likely be 23. (If you only use hour++) What hour comes after 23? 0. Think before you post please.

Anyways, why did you create a second thread about the same topic? Fully working code about this is in your previous thread.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)