OtaconEvil

[FS] Easy, digital clock | textdraw | By OTACON

Dec 20th, 2014
561
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.     * ## LEASE ATENTAMENTE PARA NO CONVERTIRSE EN LAMMER!!.: :D ##
  3.     *
  4.     * Estè Simple FILTERSCRIPT esta hecho especialmente para www.forum.sa-mp.com
  5.     * NO Publicar estè FILTERSCRIPT en Otros foros de SA-MP y hacerse pasar por el creador del CODE.
  6.     *
  7.     * Codigo Creado Por OTACON
  8.     *
  9.     * CREDITOS:
  10.     *     OTACON: Realizacion y Idea de creacion del code.
  11.     *     TÙ: Modificacion libremente respetando lo mencionado ;).
  12.     *
  13.     *    NOTA: Menos Creditos para los que me los critican.. JO'PUTAS! :D xD ;)
  14.     *
  15.     *                Prohibido TOTALMENTE el Robo de Créditos o la
  16.     *                  Publicación de este FILTERSCRIPT sin Mi Permiso.
  17. */
  18. /*
  19.     * ## READ CAREFULLY TO AVOID BECOMING LAMMER!.: :D ##
  20.     *
  21.     * This simple FILTERSCRIPT is made especially for www.forum.sa-mp.com
  22.     * DO NOT Post the FILTERSCRIPT in Other SAMP forums and impersonating the creator of the CODE.
  23.     *
  24.     * Code Created By OTACON
  25.     *
  26.     * CREDITS:
  27.     *     OTACON: Idea Making and code creation.
  28.     *     YOUR: Modification freely respecting the above ;).
  29.     *
  30.     *    NOTE: Less Credits for those who criticize me.. JO'PUTAS! :D xD ;)
  31.     *
  32.     *                        FULLY spaces Theft Credit or
  33.     *                 Publication of this FILTERSCRIPT without my permission.
  34. */
  35.  
  36. #include <a_samp>
  37.  
  38. #define pressed(%0) (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
  39. #define released(%0) (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
  40. #define FUNCTION:%0(%1) forward%0(%1); public%0(%1)
  41.  
  42. #define Set_Clock(%0,%1) KillTimer(kill_clock_data[%0]), kill_clock_data[%0]=SetTimerEx("clock_data",1000,true,"db",%0,%1)
  43. #define Kill_Clock(%0) KillTimer(kill_clock_data[%0])
  44.  
  45. #define CLOCK_LANGUAGE (1) // 0 (spanish) - 1 (english)
  46. #define MAX_TD_CLOCK (4)
  47. new
  48.         Text:TD_clock[MAX_TD_CLOCK],
  49.         TD_select_language=CLOCK_LANGUAGE,
  50.         bool:clock_activated[MAX_PLAYERS],
  51.         kill_clock_data[MAX_PLAYERS];
  52.  
  53. FUNCTION: clock_data(playerid,bool:clock){
  54.     new time[2][3], d[2][20], dd[100];
  55.     gettime(time[0][0], time[0][1], time[0][2]);
  56.     getdate(time[1][0], time[1][1], time[1][2]);
  57.     switch (((gettime()+334800)/86400-(gettime()+334800)/86400/7*7)){
  58.         case 1: d[0] = ((!TD_select_language)?("lunes"):("monday"));
  59.         case 2: d[0] = ((!TD_select_language)?("martes"):("tuesday"));
  60.         case 3: d[0] = ((!TD_select_language)?("miercoles"):("wednesday"));
  61.         case 4: d[0] = ((!TD_select_language)?("jueves"):("thursday"));
  62.         case 5: d[0] = ((!TD_select_language)?("viernes"):("friday"));
  63.         case 6: d[0] = ((!TD_select_language)?("sabado"):("saturday"));
  64.         case 7: d[0] = ((!TD_select_language)?("domingo"):("sunday"));
  65.     }
  66.     switch(time[1][1]){
  67.         case 1: d[1] = ((!TD_select_language)?("enero"):("jan"));
  68.         case 2: d[1] = ((!TD_select_language)?("febrero"):("february"));
  69.         case 3: d[1] = ((!TD_select_language)?("marzo"):("march"));
  70.         case 4: d[1] = ((!TD_select_language)?("abril"):("april"));
  71.         case 5: d[1] = ((!TD_select_language)?("mayo"):("may"));
  72.         case 6: d[1] = ((!TD_select_language)?("junio"):("June"));
  73.         case 7: d[1] = ((!TD_select_language)?("julio"):("july"));
  74.         case 8: d[1] = ((!TD_select_language)?("agosto"):("august"));
  75.         case 9: d[1] = ((!TD_select_language)?("septiembre"):("september"));
  76.         case 10: d[1] = ((!TD_select_language)?("octubre"):("october"));
  77.         case 11: d[1] = ((!TD_select_language)?("noviembre"):("november"));
  78.         case 12: d[1] = ((!TD_select_language)?("diciembre"):("december"));
  79.     }
  80.     format(dd,sizeof(dd),"~w~%02d:%02d",time[0][0], time[0][1]);
  81.     TextDrawSetString(TD_clock[1],dd);
  82.     format(dd,sizeof(dd),"~w~%s",d[0]);
  83.     TextDrawSetString(TD_clock[2],dd);
  84.     format(dd,sizeof(dd),"~w~%02d %s %s",time[1][2],((!TD_select_language)?("de"):("of")),d[1]);
  85.     TextDrawSetString(TD_clock[3],dd);
  86.    
  87.     if(!clock){ Kill_Clock(playerid); ApplyAnimation(playerid,"CARRY","null",0.0,0,0,0,0,0,0); for(new x=0; x<sizeof(TD_clock); x++) {TextDrawHideForPlayer(playerid, TD_clock[x]);}
  88.     }else{ ApplyAnimation(playerid,"COP_AMBIENT","null",0.0,0,0,0,0,0,0); ApplyAnimation(playerid,"COP_AMBIENT","Coplook_watch",4.1,0,0,0,1,1); for(new x=0; x<sizeof(TD_clock); x++) {TextDrawShowForPlayer(playerid, TD_clock[x]);} }
  89. }
  90.  
  91. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys){
  92.     if(pressed(KEY_YES)) {  if(clock_activated[playerid]!=true) clock_activated[playerid]=true, Set_Clock(playerid,true); }
  93.     else if(released(KEY_YES)) {  if(clock_activated[playerid]!=false) clock_activated[playerid]=false, Set_Clock(playerid,false);  }
  94.     return true;
  95. }
  96.  
  97. public OnFilterScriptInit(){
  98.     for(new x=0; x<sizeof(TD_clock); x++) {TextDrawDestroy(TD_clock[x]);}
  99.     TD_clock[0] = TextDrawCreate(320.000000, 345.000000, "_");
  100.     TextDrawBackgroundColor(TD_clock[0], 255);
  101.     TextDrawFont(TD_clock[0], 1);
  102.     TextDrawLetterSize(TD_clock[0], 0.500000, 8.200000);
  103.     TextDrawColor(TD_clock[0], -1);
  104.     TextDrawSetOutline(TD_clock[0], 0);
  105.     TextDrawSetProportional(TD_clock[0], 1);
  106.     TextDrawSetShadow(TD_clock[0], 1);
  107.     TextDrawUseBox(TD_clock[0], 1);
  108.     TextDrawBoxColor(TD_clock[0], 255);
  109.     TextDrawTextSize(TD_clock[0], 580.000000, 0.000000);
  110.     TextDrawSetSelectable(TD_clock[0], false);
  111.  
  112.     TD_clock[1] = TextDrawCreate(395.000000, 343.000000, "_"); //00:00
  113.     TextDrawAlignment(TD_clock[1], 2);
  114.     TextDrawBackgroundColor(TD_clock[1], 255);
  115.     TextDrawFont(TD_clock[1], 2);
  116.     TextDrawLetterSize(TD_clock[1], 0.839999, 7.400000);
  117.     TextDrawColor(TD_clock[1], -1);
  118.     TextDrawSetOutline(TD_clock[1], 1);
  119.     TextDrawSetProportional(TD_clock[1], 1);
  120.     TextDrawSetSelectable(TD_clock[1], false);
  121.  
  122.     TD_clock[2] = TextDrawCreate(466.000000, 359.000000, "_"); //saturday
  123.     TextDrawBackgroundColor(TD_clock[2], 255);
  124.     TextDrawFont(TD_clock[2], 2);
  125.     TextDrawLetterSize(TD_clock[2], 0.500000, 2.800000);
  126.     TextDrawColor(TD_clock[2], -1);
  127.     TextDrawSetOutline(TD_clock[2], 1);
  128.     TextDrawSetProportional(TD_clock[2], 1);
  129.     TextDrawSetSelectable(TD_clock[2], false);
  130.  
  131.     TD_clock[3] = TextDrawCreate(466.000000, 385.000000, "_"); //20 de december
  132.     TextDrawBackgroundColor(TD_clock[3], 255);
  133.     TextDrawFont(TD_clock[3], 2);
  134.     TextDrawLetterSize(TD_clock[3], 0.260000, 1.400000);
  135.     TextDrawColor(TD_clock[3], -1);
  136.     TextDrawSetOutline(TD_clock[3], 1);
  137.     TextDrawSetProportional(TD_clock[3], 1);
  138.     TextDrawSetSelectable(TD_clock[3], false);
  139.     return true;
  140. }
RAW Paste Data