OtaconEvil

[FS] Contador Cuenta Regresiva By OTACON

Oct 3rd, 2013
189
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. #include <a_samp>
  36. #include <zcmd>
  37. #include <sscanf2>
  38. #define CALLBACK:%0(%1) forward%0(%1); public%0(%1)
  39.  
  40. #define B "{FFFFFF}" //white
  41. #define R "{BC0000}" //red
  42. #define G "{009100}" //green
  43.  
  44. #define TIMER_COUNTDOWN (1*1000)
  45. #define COLOR_N 0x00000055
  46. #define COLOR_B 0xFFFDFFFF
  47. #define COLOR_R 0xC00000FF
  48. #define COLOR_G 0x009800FF
  49. #define MAX_COUNTDOWN (10)
  50. static Text:CountdownTD[MAX_PLAYERS][MAX_COUNTDOWN],
  51. DataCountdown[4],bool:ActiveCountdown,KillCountdown;
  52.  
  53. CALLBACK: OnFilterScriptInit() {
  54.     print("\n**************************************");
  55.     print("            Countdown Timer             ");
  56.     print("           Date: 29/09/2013             ");
  57.     print("            Author: OTACON              ");
  58.     print("   --* Downloaded with Success!!. *--   ");
  59.     print("***************************************\n");
  60.     SendRconCommand("hostname Countdown Timer");
  61.     SendRconCommand("gamemodetext By OTACON");
  62.     return true;
  63. }
  64. CALLBACK: OnFilterScriptExit() {
  65.     print("\n**************************************");
  66.     print("            Countdown Timer             ");
  67.     print("           Date: 29/09/2013             ");
  68.     print("            Author: OTACON              ");
  69.     print("     --* Loaded with Success!!. *--     ");
  70.     print("***************************************\n");
  71.     SendRconCommand("hostname Countdown Timer");
  72.     SendRconCommand("gamemodetext By OTACON");
  73.     return true;
  74. }
  75. CALLBACK: OnPlayerConnect(playerid) {
  76.     CountdownTD[playerid][0] = TextDrawCreate(529.000000, 354.000000, "_");
  77.     TextDrawAlignment(CountdownTD[playerid][0], 2);
  78.     TextDrawBackgroundColor(CountdownTD[playerid][0], 255);
  79.     TextDrawFont(CountdownTD[playerid][0], 2);
  80.     TextDrawLetterSize(CountdownTD[playerid][0], 0.189999, 9.799999);
  81.     TextDrawColor(CountdownTD[playerid][0], -1);
  82.     TextDrawSetOutline(CountdownTD[playerid][0], 1);
  83.     TextDrawSetProportional(CountdownTD[playerid][0], 1);
  84.     TextDrawUseBox(CountdownTD[playerid][0], 1);
  85.     TextDrawBoxColor(CountdownTD[playerid][0], COLOR_N);
  86.     TextDrawTextSize(CountdownTD[playerid][0], -24.000000, 179.000000);
  87.    
  88.     CountdownTD[playerid][1] = TextDrawCreate(529.000000, 385.000000, "_");
  89.     TextDrawAlignment(CountdownTD[playerid][1], 2);
  90.     TextDrawBackgroundColor(CountdownTD[playerid][1], COLOR_G);
  91.     TextDrawFont(CountdownTD[playerid][1], 3);
  92.     TextDrawLetterSize(CountdownTD[playerid][1], 0.799999, 4.599999);
  93.     TextDrawColor(CountdownTD[playerid][1], COLOR_B);
  94.     TextDrawSetOutline(CountdownTD[playerid][1], 1);
  95.     TextDrawSetProportional(CountdownTD[playerid][1], 1);
  96.  
  97.     TextDrawLetterSize(CountdownTD[playerid][1], 0.799999, 4.599999);
  98.     CountdownTD[playerid][2] = TextDrawCreate(458.000000, 422.000000, "DAYS");
  99.     TextDrawLetterSize(CountdownTD[playerid][2], 0.250000, 1.900000);
  100.     TextDrawBackgroundColor(CountdownTD[playerid][2], COLOR_G);
  101.     CountdownTD[playerid][3] = TextDrawCreate(505.000000, 422.000000, "HOURS");
  102.     TextDrawLetterSize(CountdownTD[playerid][3], 0.220000, 1.900000);
  103.     TextDrawBackgroundColor(CountdownTD[playerid][3], COLOR_G);
  104.     CountdownTD[playerid][4] = TextDrawCreate(552.000000, 422.000000, "MINUTES");
  105.     TextDrawLetterSize(CountdownTD[playerid][4], 0.179999, 1.900000);
  106.     TextDrawBackgroundColor(CountdownTD[playerid][4], COLOR_G);
  107.     CountdownTD[playerid][5] = TextDrawCreate(598.000000, 422.000000, "SECONDS");
  108.     TextDrawLetterSize(CountdownTD[playerid][5], 0.159999, 1.900000);
  109.     TextDrawBackgroundColor(CountdownTD[playerid][5], COLOR_G);
  110.     CountdownTD[playerid][6] = TextDrawCreate(528.000000, 349.000000, "COUNTDOWN TIMER");
  111.     TextDrawLetterSize(CountdownTD[playerid][6], 0.259999, 2.499998);
  112.     TextDrawBackgroundColor(CountdownTD[playerid][6], COLOR_R);
  113.     CountdownTD[playerid][7] = TextDrawCreate(575.000000, 369.000000, "By OTACON");
  114.     TextDrawLetterSize(CountdownTD[playerid][7], 0.189999, 1.599999);
  115.     TextDrawBackgroundColor(CountdownTD[playerid][7], COLOR_G);
  116.     for(new index=2; index<MAX_COUNTDOWN; index++) {
  117.         TextDrawAlignment(CountdownTD[playerid][index], 2);
  118.         TextDrawFont(CountdownTD[playerid][index], 2);
  119.         TextDrawColor(CountdownTD[playerid][index], -1);
  120.         TextDrawSetOutline(CountdownTD[playerid][index], 1);
  121.         TextDrawSetProportional(CountdownTD[playerid][index], 1); }
  122.        
  123.     CountdownTD[playerid][8] = TextDrawCreate(530.000000, 331.000000, "PLACE YOUR MESSAGE HERE!...");
  124.     TextDrawAlignment(CountdownTD[playerid][8], 2);
  125.     TextDrawBackgroundColor(CountdownTD[playerid][8], 255);
  126.     TextDrawFont(CountdownTD[playerid][8], 1);
  127.     TextDrawLetterSize(CountdownTD[playerid][8], 0.260000, 1.600000);
  128.     TextDrawColor(CountdownTD[playerid][8], -1);
  129.     TextDrawSetOutline(CountdownTD[playerid][8], 1);
  130.     TextDrawSetProportional(CountdownTD[playerid][8], 1);
  131.     TextDrawUseBox(CountdownTD[playerid][8], 1);
  132.     TextDrawBoxColor(CountdownTD[playerid][8], COLOR_N);
  133.     TextDrawTextSize(CountdownTD[playerid][8], -17.000000, 180.000000);
  134.  
  135.     CountdownTD[playerid][9] = TextDrawCreate(438.000000, 316.000000, "MESSAGE:");
  136.     TextDrawBackgroundColor(CountdownTD[playerid][9], COLOR_G);
  137.     TextDrawFont(CountdownTD[playerid][9], 1);
  138.     TextDrawLetterSize(CountdownTD[playerid][9], 0.260000, 1.600000);
  139.     TextDrawColor(CountdownTD[playerid][9], COLOR_B);
  140.     TextDrawSetOutline(CountdownTD[playerid][9], 1);
  141.     TextDrawSetProportional(CountdownTD[playerid][9], 1);
  142.     return true;
  143. }
  144. CALLBACK: OnPlayerDisconnect(playerid, reason) {
  145.     for(new index=0; index<MAX_COUNTDOWN; index++) \
  146.         TextDrawHideForPlayer(playerid,CountdownTD[playerid][index]), \
  147.            TextDrawDestroy(CountdownTD[playerid][index]);
  148.     return true;
  149. }
  150. CALLBACK: UpdateCountdown() {
  151.     new data[50];
  152.     for(new player=0; player<GetMaxPlayers(); player++) {
  153.         if(!IsPlayerConnected(player)) continue;
  154.         if(!ActiveCountdown) {
  155.             for(new index=0; index<MAX_COUNTDOWN; index++) \
  156.                 TextDrawHideForPlayer(player,CountdownTD[player][index]);
  157.             for(new index=0; index<4; index++) \
  158.                 DataCountdown[index]=0;
  159.             KillTimer(KillCountdown);
  160.         } else {
  161.             static CountdownTemp[2];
  162.             DataCountdown[3]++;
  163.             if(DataCountdown[3]>=60) DataCountdown[3]=0, DataCountdown[2]--, CountdownTemp[0]++;
  164.             if(CountdownTemp[0]>=60) CountdownTemp[0]=0, DataCountdown[1]--, CountdownTemp[1]++;
  165.             if(CountdownTemp[1]>=24) CountdownTemp[1]=0, DataCountdown[0]--;
  166.             if(DataCountdown[2]<=0) DataCountdown[2]=0;
  167.             if(DataCountdown[1]<=0) DataCountdown[1]=0;
  168.             if(DataCountdown[0]<=0) DataCountdown[0]=0;
  169.             format(data,sizeof(data),"%02d:%02d:%02d:%02d",DataCountdown[0],DataCountdown[1],DataCountdown[2],DataCountdown[3]);
  170.             TextDrawSetString(CountdownTD[player][1],data);
  171.             for(new index=0; index<MAX_COUNTDOWN; index++) \
  172.                 TextDrawHideForPlayer(player,CountdownTD[player][index]),\
  173.                 TextDrawShowForPlayer(player,CountdownTD[player][index]);
  174.             if(DataCountdown[0]<=0 && DataCountdown[1]<=0 && DataCountdown[2]<=0 && DataCountdown[3]<=0) {
  175.                 ActiveCountdown=false;
  176.                 CountdownFunction(player);
  177.                 for(new index=0; index<2; index++) \
  178.                     CountdownTemp[index]=0;
  179.             }
  180.         }
  181.     }
  182. }
  183. stock CountdownFunction(playerid) {
  184.     /*
  185.         PLACE YOUR FUNCTION HERE!...
  186.         PLACE YOUR FUNCTION HERE!...
  187.         PLACE YOUR FUNCTION HERE!...
  188.     */
  189.     for(new msg=0; msg<100; msg++) \
  190.         SendClientMessage(playerid, -1, "   "B"[ ! ] "G"The countdown timer is over"B"!."), \
  191.         SendClientMessage(playerid, -1, "   "B"[ ! ] "R"COUNTDOWN TIMER - By OTACON"B"!.");
  192. }
  193. COMMAND:countdown(playerid, params[]) {
  194.     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1," "B"[ ! ] "G"You Not Authorized to Use this command"B"!.");
  195.     if(sscanf(params,"dddds[20]",params[0],params[1],params[2],params[3],params[4])) return SendClientMessage(playerid, -1, "   "B"[ ! ] "G"Type the command: "R"/countdown "G"[days] [hours] [minutes] [seconds] [message]");
  196.     if(strval(params[0])<0||strval(params[0])>30) return SendClientMessage(playerid, -1, "  "B"[ ! ] "G"not go below 0 or above 30 days"B"!.");
  197.     if(strval(params[1])<0||strval(params[1])>12) return SendClientMessage(playerid, -1, "  "B"[ ! ] "G"not go below 0 or above 12 hours"B"!.");
  198.     if(strval(params[2])<0||strval(params[2])>60) return SendClientMessage(playerid, -1, "  "B"[ ! ] "G"not go below 0 or above 60 minutes"B"!.");
  199.     if(strval(params[3])<0||strval(params[3])>60) return SendClientMessage(playerid, -1, "  "B"[ ! ] "G"not go below 0 or above 60 seconds"B"!.");
  200.     if(strlen(params[4])<0||strlen(params[4])>20) return SendClientMessage(playerid, -1, "  "B"[ ! ] "G"not go below 0 or above 20 characters"B"!.");
  201.     ActiveCountdown=false;
  202.     ActiveCountdown=true;
  203.     for(new index=0; index<4; index++) \
  204.         DataCountdown[index]=0;
  205.     DataCountdown[0]=params[0];
  206.     DataCountdown[1]=params[1];
  207.     DataCountdown[2]=params[2];
  208.     DataCountdown[3]=params[3];
  209.     TextDrawSetString(CountdownTD[playerid][8],params[4]);
  210.     for(new index=0; index<MAX_COUNTDOWN; index++) \
  211.         TextDrawHideForPlayer(playerid,CountdownTD[playerid][index]),\
  212.         TextDrawShowForPlayer(playerid,CountdownTD[playerid][index]);
  213.     KillTimer(KillCountdown);
  214.     KillCountdown=SetTimer("UpdateCountdown",TIMER_COUNTDOWN,true);
  215.     SendClientMessage(playerid, -1, "   "B"[ ! ] "G"COUNTDOWN TIMER - ACTIVATED"B"!.");
  216.     return true;
  217. }
  218. /*
  219.     * ## LEASE ATENTAMENTE PARA NO CONVERTIRSE EN LAMMER!!.: :D ##
  220.     *
  221.     * Estè Simple FILTERSCRIPT esta hecho especialmente para www.forum.sa-mp.com
  222.     * NO Publicar estè FILTERSCRIPT en Otros foros de SA-MP y hacerse pasar por el creador del CODE.
  223.     *
  224.     * Codigo Creado Por OTACON
  225.     *
  226.     * CREDITOS:
  227.     *     OTACON: Realizacion y Idea de creacion del code.
  228.     *     TÙ: Modificacion libremente respetando lo mencionado ;).
  229.     *
  230.     *    NOTA: Menos Creditos para los que me los critican.. JO'PUTAS! :D xD ;)
  231.     *
  232.     *            Prohibido TOTALMENTE el Robo de Créditos o la
  233.     *              Publicación de este FILTERSCRIPT sin Mi Permiso.
  234. */
  235. /*
  236.     * ## READ CAREFULLY TO AVOID BECOMING LAMMER!.: :D ##
  237.     *
  238.     * This simple FILTERSCRIPT is made especially for www.forum.sa-mp.com
  239.     * DO NOT Post the FILTERSCRIPT in Other SAMP forums and impersonating the creator of the CODE.
  240.     *
  241.     * Code Created By OTACON
  242.     *
  243.     * CREDITS:
  244.     *     OTACON: Idea Making and code creation.
  245.     *     YOUR: Modification freely respecting the above ;).
  246.     *
  247.     *    NOTE: Less Credits for those who criticize me.. JO'PUTAS! :D xD ;)
  248.     *
  249.     *                    FULLY spaces Theft Credit or
  250.     *             Publication of this FILTERSCRIPT without my permission.
  251. */
RAW Paste Data