SA-MP Forums Archive
Getting date problem (+rep) - 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: Getting date problem (+rep) (/showthread.php?tid=548651)



Getting date problem (+rep) - ScripteRMKD - 01.12.2014

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


Re: Getting date problem (+rep) - Runn3R - 01.12.2014

Uhh..

https://sampwiki.blast.hk/wiki/Getdate
https://sampwiki.blast.hk/wiki/Gettime


Re: Getting date problem (+rep) - ScripteRMKD - 01.12.2014

code plz ?


Re: Getting date problem (+rep) - mati233 - 01.12.2014

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


Re: Getting date problem (+rep) - ScripteRMKD - 01.12.2014

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


Re: Getting date problem (+rep) - Capua - 01.12.2014

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.


Re: Getting date problem (+rep) - AnthonyTimmers - 01.12.2014

Change it to

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



Re: Getting date problem (+rep) - zT KiNgKoNg - 01.12.2014

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


Re: Getting date problem (+rep) - mati233 - 01.12.2014

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



Re: Getting date problem (+rep) - AnthonyTimmers - 01.12.2014

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.