Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ================= STOCK ====================
- stock date( timestamp )
- {
- /*
- ~ convert a Timestamp to a Date.
- ~ 10.07.2009
- date( 1247182451 ) will print >> 09.07.2009-23:34:11
- date( 1247182451, 1) will print >> 09/07/2009, 23:34:11
- date( 1247182451, 2) will print >> July 09, 2009, 23:34:11
- date( 1247182451, 3) will print >> 9 Jul 2009, 23:34
- */
- new year=1970, day=0, month=0, hour=0, mins=0, sec=0;
- new days_of_month[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };
- new returnstring[32];
- while(timestamp>31622400){
- timestamp -= 31536000;
- if ( ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0) ) timestamp -= 86400;
- year++;
- }
- if ( ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0) )
- days_of_month[1] = 29;
- else
- days_of_month[1] = 28;
- while(timestamp>86400){
- timestamp -= 86400, day++;
- if(day==days_of_month[month]) day=0, month++;
- }
- while(timestamp>=60){
- timestamp -= 60, mins++;
- if( mins == 60) mins=0, hour++;
- }
- sec=timestamp;
- format(returnstring, 31, "%d-%02d-%02d %02d:%02d:%02d", year, month+1, day+1, hour, mins, sec);
- return returnstring;
- }
- ================= Paaiškinimas ====================
- DarboInfo[pInfo[playerid][direktorius]][nedirbsiki] = gettime() + strval(inputt);
- SendFormatToAll(-1, "{9FACF3}%s{ffffff} nedirbs iki {9FACF3}%s", DarboPav, date(DarboInfo[pInfo[playerid][direktorius]][nedirbsiki]));
- SendFormatToAll(-1, "{ffffff}Priežastis: {9FACF3}%s", inputt1);
- // Pridėjus laiką ir įrašius į variable panaudojus stock date, rodo netikslų laiką, pridėjus kad ir 60 sec pvž yra 13 valanda dienos o rodo kad nedirbs iki 11 valandos dienos.
- ================= Paaiškinimas ====================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement