OtaconEvil

[FS] Cronometro v0.1 BY OTACON

Sep 18th, 2013
396
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. #include <a_samp>
  19. #include <zcmd>
  20. #define FUNCTION:%0(%1) forward%0(%1); public%0(%1)
  21.  
  22. #define MAXIMO_CRONO (10)
  23. #define TIEMPO_CRONO (1*1000)
  24. static PlayerText:TD_Cronometro[MAX_PLAYERS][MAXIMO_CRONO],
  25. Cronometrando[MAX_PLAYERS][4],
  26. bool:UsandoCronometro[MAX_PLAYERS][2],
  27. MatarCronometro[MAX_PLAYERS];
  28.  
  29. FUNCTION: OnPlayerConnect(playerid) {
  30.     TD_Cronometro[playerid][7] = CreatePlayerTextDraw(playerid,494.000000, 148.000000, "_"); //Fondo
  31.     PlayerTextDrawBackgroundColor(playerid, TD_Cronometro[playerid][7], 255);
  32.     PlayerTextDrawFont(playerid, TD_Cronometro[playerid][7], 1);
  33.     PlayerTextDrawLetterSize(playerid, TD_Cronometro[playerid][7], 0.500000, 12.100000);
  34.     PlayerTextDrawColor(playerid, TD_Cronometro[playerid][7], -1);
  35.     PlayerTextDrawSetOutline(playerid, TD_Cronometro[playerid][7], 0);
  36.     PlayerTextDrawSetProportional(playerid, TD_Cronometro[playerid][7], 1);
  37.     PlayerTextDrawSetShadow(playerid, TD_Cronometro[playerid][7], 1);
  38.     PlayerTextDrawUseBox(playerid, TD_Cronometro[playerid][7], 1);
  39.     PlayerTextDrawBoxColor(playerid, TD_Cronometro[playerid][7], 0x0000155);
  40.     PlayerTextDrawTextSize(playerid, TD_Cronometro[playerid][7], 591.000000, 0.000000);
  41.  
  42.     TD_Cronometro[playerid][8] = CreatePlayerTextDraw(playerid,540.000000, 150.000000, "~y~By OTACON");
  43.     PlayerTextDrawBackgroundColor(playerid, TD_Cronometro[playerid][8], 255);
  44.     PlayerTextDrawFont(playerid, TD_Cronometro[playerid][8], 2);
  45.     PlayerTextDrawLetterSize(playerid, TD_Cronometro[playerid][8], 0.170000, 1.000000);
  46.     PlayerTextDrawColor(playerid, TD_Cronometro[playerid][8], -1);
  47.     PlayerTextDrawSetOutline(playerid, TD_Cronometro[playerid][8], 1);
  48.     PlayerTextDrawSetProportional(playerid, TD_Cronometro[playerid][8], 1);
  49.  
  50.     TD_Cronometro[playerid][9] = CreatePlayerTextDraw(playerid,556.000000, 176.000000, "~y~v 0.1");
  51.     PlayerTextDrawBackgroundColor(playerid, TD_Cronometro[playerid][9], 255);
  52.     PlayerTextDrawFont(playerid, TD_Cronometro[playerid][9], 2);
  53.     PlayerTextDrawLetterSize(playerid, TD_Cronometro[playerid][9], 0.170000, 1.000000);
  54.     PlayerTextDrawColor(playerid, TD_Cronometro[playerid][9], -1);
  55.     PlayerTextDrawSetOutline(playerid, TD_Cronometro[playerid][9], 1);
  56.     PlayerTextDrawSetProportional(playerid, TD_Cronometro[playerid][9], 1);
  57.  
  58.     TD_Cronometro[playerid][1] = CreatePlayerTextDraw(playerid,543.000000, 199.000000, "~w~00:00:00");
  59.     PlayerTextDrawAlignment(playerid, TD_Cronometro[playerid][1], 2);
  60.     PlayerTextDrawBackgroundColor(playerid, TD_Cronometro[playerid][1], 255);
  61.     PlayerTextDrawFont(playerid, TD_Cronometro[playerid][1], 3);
  62.     PlayerTextDrawLetterSize(playerid, TD_Cronometro[playerid][1], 0.490000, 3.300001);
  63.     PlayerTextDrawColor(playerid, TD_Cronometro[playerid][1], -1);
  64.     PlayerTextDrawSetOutline(playerid, TD_Cronometro[playerid][1], 1);
  65.     PlayerTextDrawSetProportional(playerid, TD_Cronometro[playerid][1], 1);
  66.    
  67.     TD_Cronometro[playerid][2] = CreatePlayerTextDraw(playerid,504.000000, 193.000000, "HORA   MIN   SEG");
  68.     PlayerTextDrawBackgroundColor(playerid, TD_Cronometro[playerid][2], 255);
  69.     PlayerTextDrawFont(playerid, TD_Cronometro[playerid][2], 2);
  70.     PlayerTextDrawLetterSize(playerid, TD_Cronometro[playerid][2], 0.220000, 0.899999);
  71.     PlayerTextDrawColor(playerid, TD_Cronometro[playerid][2], -1);
  72.     PlayerTextDrawSetOutline(playerid, TD_Cronometro[playerid][2], 1);
  73.     PlayerTextDrawSetProportional(playerid, TD_Cronometro[playerid][2], 1);
  74.    
  75.     TD_Cronometro[playerid][3] = CreatePlayerTextDraw(playerid,543.000000, 160.000000, "Cronometro");
  76.     PlayerTextDrawAlignment(playerid, TD_Cronometro[playerid][3], 2);
  77.     PlayerTextDrawBackgroundColor(playerid, TD_Cronometro[playerid][3], 255);
  78.     PlayerTextDrawFont(playerid, TD_Cronometro[playerid][3], 2);
  79.     PlayerTextDrawLetterSize(playerid, TD_Cronometro[playerid][3], 0.280000, 1.900000);
  80.     PlayerTextDrawColor(playerid, TD_Cronometro[playerid][3], -1);
  81.     PlayerTextDrawSetOutline(playerid, TD_Cronometro[playerid][3], 1);
  82.     PlayerTextDrawSetProportional(playerid, TD_Cronometro[playerid][3], 1);
  83.  
  84.     TD_Cronometro[playerid][4] = CreatePlayerTextDraw(playerid,504.000000, 234.000000, "III"); //Boton Reset
  85.     PlayerTextDrawBackgroundColor(playerid, TD_Cronometro[playerid][4], 255);
  86.     PlayerTextDrawFont(playerid, TD_Cronometro[playerid][4], 1);
  87.     PlayerTextDrawLetterSize(playerid, TD_Cronometro[playerid][4], 0.509999, 1.500000);
  88.     PlayerTextDrawColor(playerid, TD_Cronometro[playerid][4], -1);
  89.     PlayerTextDrawSetOutline(playerid, TD_Cronometro[playerid][4], 0);
  90.     PlayerTextDrawSetProportional(playerid, TD_Cronometro[playerid][4], 1);
  91.     PlayerTextDrawSetShadow(playerid, TD_Cronometro[playerid][4], 1);
  92.     PlayerTextDrawUseBox(playerid, TD_Cronometro[playerid][4], 1);
  93.     PlayerTextDrawBoxColor(playerid, TD_Cronometro[playerid][4], 0xFFFFFF55);
  94.     PlayerTextDrawTextSize(playerid, TD_Cronometro[playerid][4], 523.000000, 5.000000);
  95.     PlayerTextDrawSetSelectable(playerid, TD_Cronometro[playerid][4], 1);
  96.  
  97.     TD_Cronometro[playerid][5] = CreatePlayerTextDraw(playerid,534.000000, 234.000000, "III"); //Boton Encender
  98.     PlayerTextDrawBackgroundColor(playerid, TD_Cronometro[playerid][5], 255);
  99.     PlayerTextDrawFont(playerid, TD_Cronometro[playerid][5], 1);
  100.     PlayerTextDrawLetterSize(playerid, TD_Cronometro[playerid][5], 0.509999, 1.500000);
  101.     PlayerTextDrawColor(playerid, TD_Cronometro[playerid][5], -1);
  102.     PlayerTextDrawSetOutline(playerid, TD_Cronometro[playerid][5], 0);
  103.     PlayerTextDrawSetProportional(playerid, TD_Cronometro[playerid][5], 1);
  104.     PlayerTextDrawSetShadow(playerid, TD_Cronometro[playerid][5], 1);
  105.     PlayerTextDrawUseBox(playerid, TD_Cronometro[playerid][5], 1);
  106.     PlayerTextDrawBoxColor(playerid, TD_Cronometro[playerid][5], 0x137F0055);
  107.     PlayerTextDrawTextSize(playerid, TD_Cronometro[playerid][5], 552.000000, 5.000000);
  108.     PlayerTextDrawSetSelectable(playerid, TD_Cronometro[playerid][5], 1);
  109.  
  110.     TD_Cronometro[playerid][6] = CreatePlayerTextDraw(playerid,563.000000, 234.000000, "III"); //Boton Parar
  111.     PlayerTextDrawBackgroundColor(playerid, TD_Cronometro[playerid][6], 255);
  112.     PlayerTextDrawFont(playerid, TD_Cronometro[playerid][6], 1);
  113.     PlayerTextDrawLetterSize(playerid, TD_Cronometro[playerid][6], 0.509999, 1.500000);
  114.     PlayerTextDrawColor(playerid, TD_Cronometro[playerid][6], -1);
  115.     PlayerTextDrawSetOutline(playerid, TD_Cronometro[playerid][6], 0);
  116.     PlayerTextDrawSetProportional(playerid, TD_Cronometro[playerid][6], 1);
  117.     PlayerTextDrawSetShadow(playerid, TD_Cronometro[playerid][6], 1);
  118.     PlayerTextDrawUseBox(playerid, TD_Cronometro[playerid][6], 1);
  119.     PlayerTextDrawBoxColor(playerid, TD_Cronometro[playerid][6], 0x8A000055);
  120.     PlayerTextDrawTextSize(playerid, TD_Cronometro[playerid][6], 581.000000, 5.000000);
  121.     PlayerTextDrawSetSelectable(playerid, TD_Cronometro[playerid][6], 1);
  122.     return true;
  123. }
  124. FUNCTION: OnPlayerDisconnect(playerid, reason) {
  125.     for(new index=0; index<MAXIMO_CRONO; index++) \
  126.         PlayerTextDrawHide(playerid, TD_Cronometro[playerid][index]), \
  127.         PlayerTextDrawDestroy(playerid, TD_Cronometro[playerid][index]);
  128.     for(new index=0; index<4; index++) \
  129.         Cronometrando[playerid][index]=0;
  130.     UsandoCronometro[playerid][1]=false;
  131.     UsandoCronometro[playerid][0]=false;
  132.     KillTimer(MatarCronometro[playerid]);
  133.     return true;
  134. }
  135. FUNCTION: OnPlayerDeath(playerid, killerid, reason) {
  136.     for(new index=0; index<MAXIMO_CRONO; index++) \
  137.         PlayerTextDrawHide(playerid, TD_Cronometro[playerid][index]), \
  138.         PlayerTextDrawDestroy(playerid, TD_Cronometro[playerid][index]);
  139.     for(new index=0; index<4; index++) \
  140.         Cronometrando[playerid][index]=0;
  141.     UsandoCronometro[playerid][1]=false;
  142.     UsandoCronometro[playerid][0]=false;
  143.     KillTimer(MatarCronometro[playerid]);
  144.     return true;
  145. }
  146. FUNCTION: OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid) {
  147.     if(playertextid==TD_Cronometro[playerid][4]) { //Boton Reset
  148.         PlayerPlaySound(playerid, 21000, 0.0, 0.0, 0.0);
  149.         if(UsandoCronometro[playerid][0]==true && UsandoCronometro[playerid][1]==true || UsandoCronometro[playerid][0]==true && UsandoCronometro[playerid][1]==false) {
  150.              Cronometrando[playerid][3]=0, Cronometrando[playerid][2]=0, Cronometrando[playerid][1]=0;
  151.              PlayerTextDrawSetString(playerid, TD_Cronometro[playerid][1], "~w~00:00:00");
  152.              UsandoCronometro[playerid][1]=false;
  153.              KillTimer(MatarCronometro[playerid]);
  154.         } return true;
  155.     }
  156.     if(playertextid==TD_Cronometro[playerid][5]) { //Boton Encender
  157.         PlayerPlaySound(playerid, 21000, 0.0, 0.0, 0.0);
  158.         if(UsandoCronometro[playerid][0]==true && UsandoCronometro[playerid][1]==false) {
  159.              UsandoCronometro[playerid][1]=true;
  160.              KillTimer(MatarCronometro[playerid]);
  161.              MatarCronometro[playerid]=SetTimerEx("CargarCronometro",TIEMPO_CRONO,true,"d",playerid);
  162.         } return true;
  163.     }
  164.     if(playertextid==TD_Cronometro[playerid][6]) { //Boton Parar
  165.         PlayerPlaySound(playerid, 21000, 0.0, 0.0, 0.0);
  166.         if(UsandoCronometro[playerid][0]==true && UsandoCronometro[playerid][1]==true) {
  167.              UsandoCronometro[playerid][1] = false;
  168.              KillTimer(MatarCronometro[playerid]);
  169.         } return true;
  170.     } return true;
  171. }
  172. FUNCTION: CargarCronometro(playerid) {
  173.     new data[50];
  174.     if(UsandoCronometro[playerid][0]==true && UsandoCronometro[playerid][1]==true) {
  175.         format(data,sizeof(data),"~w~%02d:%02d:%02d", Cronometrando[playerid][3], Cronometrando[playerid][2], Cronometrando[playerid][1]);
  176.         PlayerTextDrawSetString(playerid, TD_Cronometro[playerid][1], data);
  177.         Cronometrando[playerid][1]++, PlayerPlaySound(playerid, 21000, 0.0, 0.0, 0.0);
  178.         if(Cronometrando[playerid][1]>=60) {
  179.             Cronometrando[playerid][1] = 0;
  180.             Cronometrando[playerid][2]++;
  181.         } if(Cronometrando[playerid][2]>=60)
  182.         { Cronometrando[playerid][3]++; }
  183.     } return true;
  184. }
  185. COMMAND:cronometro(playerid, params[]) {
  186.     if(IsPlayerConnected(playerid) && GetPlayerState(playerid)==PLAYER_STATE_ONFOOT) {
  187.         if(!UsandoCronometro[playerid][0]) {
  188.             SelectTextDraw(playerid, 0x7C7B7B7B);
  189.             UsandoCronometro[playerid][0] = true;
  190.             KillTimer(MatarCronometro[playerid]);
  191.             for(new index=0; index<MAXIMO_CRONO; index++) \
  192.                 PlayerTextDrawShow(playerid, TD_Cronometro[playerid][index]);
  193.         } else {
  194.             CancelSelectTextDraw(playerid);
  195.             UsandoCronometro[playerid][0] = false;
  196.             KillTimer(MatarCronometro[playerid]);
  197.             for(new index=0; index<MAXIMO_CRONO; index++) \
  198.                 PlayerTextDrawHide(playerid, TD_Cronometro[playerid][index]);
  199.         }
  200.     } return true;
  201. }
  202. /*
  203.     * ## LEASE ATENTAMENTE PARA NO CONVERTIRSE EN LAMMER!!.: :D ##
  204.     *
  205.     * Estè Simple FILTERSCRIPT esta hecho especialmente para www.forum.sa-mp.com
  206.     * NO Publicar estè FILTERSCRIPT en Otros foros de SA-MP y hacerse pasar por el creador del CODE.
  207.     *
  208.     * Codigo Creado Por OTACON
  209.     *
  210.     * CREDITOS:
  211.     *     OTACON: Realizacion y Idea de creacion del code.
  212.     *     TÙ: Modificacion libremente respetando lo mencionado ;).
  213.     *
  214.     *    NOTA: Menos Creditos para los que me los critican.. JO'PUTAS! :D xD ;)
  215.     *
  216.     *            Prohibido TOTALMENTE el Robo de Créditos o la
  217.     *              Publicación de este FILTERSCRIPT sin Mi Permiso.
  218. */
RAW Paste Data