Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stock GetTimeToDate(time_start, time_str[])
- {
- new secs = time_start - gettime();
- if( secs < 0 )
- {
- format( time_str, 20, "-");
- return 0;
- }
- new Lat = secs / 31556926 % 12;
- new Miesiecy = secs / 604800 % 52;
- new Dni = secs / 86400 % 7;
- new Godzin = secs / 3600 % 24;
- new Minut = secs / 60 % 60;
- new time = secs % 60;
- #if defined dli
- #undef dli
- #endif
- #define dli(%1,%2,%3,%4) ((%1==1)?(%2):(((%1% 10>1)&&(%1% 10<5)&&!((%1% 100>=10)&&(%1% 100<=21)))?(%3):(%4)))
- if( Lat > 0 ) format( time_str, 20, "%d %s", dli(Lat, "roku", "lat", "lat"));
- else if( Miesiecy > 0 ) format( time_str, 20, "%d %s",Miesiecy, dli(Miesiecy,"miesiąca","Miesiecy","Miesiecy"));
- else if( Dni > 0 ) format( time_str, 20, "%d %s",Dni, dli(Dni,"dnia","dni","dni"));
- else if( Godzin > 0 ) format( time_str, 20, "%d %s",Godzin, dli(Godzin,"godzina", "godziny","godzin"));
- else if( Minut > 0 ) format( time_str, 20, "%d %s",Minut, dli(Minut,"minuta","minuty","minut"));
- else if( time > 0 ) format( time_str, 20, "%d %s",secs, dli(secs,"sekunda","sekundy","sekund"));
- #undef dli
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement