OtaconEvil

[FS] counter textdraw [base] - By OTACON

Apr 12th, 2015
1,043
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. #include <zcmd>
  38.  
  39. new Text:counter[2],timer,count,bool:active,cfade;
  40. forward OnFunctionCounter(playerid);
  41.  
  42.  
  43. forward update(playerid);
  44. public update(playerid){
  45.  
  46.     TextDrawShowForPlayer(playerid,counter[0]);
  47.     TextDrawShowForPlayer(playerid,counter[1]);
  48.     new
  49.         data[10];
  50.     if(!active){
  51.         if(count>0){
  52.             format(data, sizeof(data), "%d", count);
  53.             TextDrawSetString(counter[1], data);
  54.             count--;
  55.             PlayerPlaySound(playerid, 1056, 0,0,0);
  56.         }else{
  57.             TextDrawSetString(counter[1], "go!");
  58.             active=true;
  59.             PlayerPlaySound(playerid, 1057, 0,0,0);
  60.             //PlayerPlaySound(playerid, 15802, 0,0,0);//go go go!
  61.             CallLocalFunction("OnFunctionCounter", "d", playerid);
  62.         }
  63.     }else stop(playerid);
  64.  
  65. }
  66.  
  67. stock start(playerid, &color=0x8C00FF55, &seconds=20){
  68.  
  69.     KillTimer(timer);
  70.     count=seconds;
  71.     cfade=color;
  72.     active=false;
  73.  
  74.     TextDrawHideForPlayer(playerid,counter[0]);
  75.     TextDrawDestroy(counter[0]);
  76.     TextDrawHideForPlayer(playerid,counter[1]);
  77.     TextDrawDestroy(counter[1]);
  78.    
  79.     counter[0] = TextDrawCreate(254.857177, 77.653381, "ld_beat:chit");
  80.     TextDrawLetterSize(counter[0], 0.000000, 0.000000);
  81.     TextDrawTextSize(counter[0], 127.999923, 134.399963);
  82.     TextDrawAlignment(counter[0], 1);
  83.     TextDrawColor(counter[0], cfade);
  84.     TextDrawSetShadow(counter[0], 0);
  85.     TextDrawSetOutline(counter[0], 0);
  86.     TextDrawFont(counter[0], 4);
  87.  
  88.     counter[1] = TextDrawCreate(318.857299, 125.440040, "_");
  89.     TextDrawLetterSize(counter[1], 0.769999, 3.925336);
  90.     TextDrawAlignment(counter[1], 2);
  91.     TextDrawColor(counter[1], -1);
  92.     TextDrawSetShadow(counter[1], 0);
  93.     TextDrawSetOutline(counter[1], 1);
  94.     TextDrawBackgroundColor(counter[1], 51);
  95.     TextDrawFont(counter[1], 3);
  96.     TextDrawSetProportional(counter[1], 1);
  97.  
  98.     timer=SetTimerEx("update",1000,true,"d",playerid);
  99.  
  100. }
  101.  
  102. stock stop(playerid){
  103.  
  104.     KillTimer(timer);
  105.     count=0;
  106.     active=false;
  107.  
  108.     TextDrawHideForPlayer(playerid,counter[0]);
  109.     TextDrawDestroy(counter[0]);
  110.     TextDrawHideForPlayer(playerid,counter[1]);
  111.     TextDrawDestroy(counter[1]);
  112.  
  113. }
  114.  
  115.  
  116.  
  117.  
  118. COMMAND:test1(playerid, params[]){
  119.     start(playerid);
  120.     return true;
  121. }
  122. COMMAND:test2(playerid, params[]){
  123.     stop(playerid);
  124.     return true;
  125. }
  126. public OnFunctionCounter(playerid){
  127.     SendClientMessage(playerid, -1, "INFO: the counter has finished!.");
  128.     return true;
  129. }
RAW Paste Data