Advertisement
Guest User

Untitled

a guest
Feb 13th, 2019
408
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. ================= STOCK ====================
  2.  
  3.  
  4. stock date( timestamp )
  5. {
  6. /*
  7. ~ convert a Timestamp to a Date.
  8. ~ 10.07.2009
  9.  
  10. date( 1247182451 ) will print >> 09.07.2009-23:34:11
  11. date( 1247182451, 1) will print >> 09/07/2009, 23:34:11
  12. date( 1247182451, 2) will print >> July 09, 2009, 23:34:11
  13. date( 1247182451, 3) will print >> 9 Jul 2009, 23:34
  14. */
  15. new year=1970, day=0, month=0, hour=0, mins=0, sec=0;
  16.  
  17. new days_of_month[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };
  18. new returnstring[32];
  19.  
  20. while(timestamp>31622400){
  21. timestamp -= 31536000;
  22. if ( ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0) ) timestamp -= 86400;
  23. year++;
  24. }
  25.  
  26. if ( ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0) )
  27. days_of_month[1] = 29;
  28. else
  29. days_of_month[1] = 28;
  30.  
  31.  
  32. while(timestamp>86400){
  33. timestamp -= 86400, day++;
  34. if(day==days_of_month[month]) day=0, month++;
  35. }
  36.  
  37. while(timestamp>=60){
  38. timestamp -= 60, mins++;
  39. if( mins == 60) mins=0, hour++;
  40. }
  41.  
  42. sec=timestamp;
  43.  
  44. format(returnstring, 31, "%d-%02d-%02d %02d:%02d:%02d", year, month+1, day+1, hour, mins, sec);
  45.  
  46. return returnstring;
  47. }
  48.  
  49.  
  50.  
  51. ================= Paaiškinimas ====================
  52.  
  53. DarboInfo[pInfo[playerid][direktorius]][nedirbsiki] = gettime() + strval(inputt);
  54.  
  55. SendFormatToAll(-1, "{9FACF3}%s{ffffff} nedirbs iki {9FACF3}%s", DarboPav, date(DarboInfo[pInfo[playerid][direktorius]][nedirbsiki]));
  56. SendFormatToAll(-1, "{ffffff}Priežastis: {9FACF3}%s", inputt1);
  57.  
  58. // 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.
  59.  
  60. ================= Paaiškinimas ====================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement