Advertisement
Guest User

Teaserbar

a guest
Jul 9th, 2010
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 10.00 KB | None | 0 0
  1. /*====================================================================*\
  2. | This Filterscript is made by Meta, Scripter of "iLife-Community.net" |
  3. |                                                                      |
  4. | You are allowed to do what you want with this code, because it's not |
  5. |                          hard to do this :D                          |
  6. | If you use it, giving Credits would be kind, but not neccecary       |
  7. \*====================================================================*/
  8. #include <a_samp>
  9.  
  10. #define COLOR_LIGHTBLUE 0x33CCFFAA
  11. #define COLOR_LIGHTRED 0xFF6347AA
  12. #define COLOR_GRAD2 0xBFC0C2FF
  13.  
  14. forward RefreshTeaser();
  15. forward ShowTeaser();
  16. forward HideTeaser();
  17.  
  18. new bool:TeaserShown = false;
  19. new Text:Teasertext;
  20. new Text:Teaserbox;
  21. new Teasertimer;
  22. new Teaserstate;
  23. new TeaserTa[256] = "_";
  24. new TeaserTn[256] = "_";
  25. new Float:TeaserY = 447.0;
  26.  
  27. public OnFilterScriptInit()
  28. {
  29.     AntiDeAMX();
  30.     Teaserbox = TextDrawCreate(320.000000, TeaserY, "_");
  31.     TextDrawAlignment(Teaserbox, 2);
  32.     TextDrawBackgroundColor(Teaserbox, 255);
  33.     TextDrawFont(Teaserbox, 1);
  34.     TextDrawLetterSize(Teaserbox, 0.400000, 1.300000);
  35.     TextDrawColor(Teaserbox, -1);
  36.     TextDrawSetOutline(Teaserbox, 1);
  37.     TextDrawSetProportional(Teaserbox, 1);
  38.     TextDrawUseBox(Teaserbox, 1);
  39.     TextDrawBoxColor(Teaserbox, 160);
  40.     TextDrawTextSize(Teaserbox, 0.000000, 636.000000);
  41.  
  42.          if(Teaserstate < 11) { Teasertext = TextDrawCreate(320.000000, TeaserY, TeaserTa); }
  43.     else if(Teaserstate > 10) { Teasertext = TextDrawCreate(320.000000, TeaserY, TeaserTn); }
  44.     TextDrawAlignment(Teasertext, 2);
  45.     TextDrawBackgroundColor(Teasertext, 255);
  46.     TextDrawFont(Teasertext, 1);
  47.     TextDrawLetterSize(Teasertext, 0.400000, 1.300000);
  48.     TextDrawColor(Teasertext, -1);
  49.     TextDrawSetOutline(Teasertext, 1);
  50.     TextDrawSetProportional(Teasertext, 1);
  51.     return 1;
  52. }
  53.  
  54. public OnFilterScriptExit()
  55. {
  56.     TextDrawDestroy(Teasertext);
  57.     TextDrawDestroy(Teaserbox);
  58.     return 1;
  59. }
  60.  
  61. main()
  62. {
  63.     print("\n                           ___________________");
  64.     print("                           |     Teaserbar    |");
  65.     print("                           |------------------|");
  66.     print("                           |  © 2010 by Meta  |");
  67.     print("                           ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\n");
  68. }
  69.  
  70. public OnPlayerConnect(playerid)
  71. {
  72.     if(TeaserShown) { TextDrawShowForPlayer(playerid, Teasertext); TextDrawShowForPlayer(playerid, Teaserbox); }
  73.     return 1;
  74. }
  75.  
  76. public OnPlayerCommandText(playerid, cmdtext[])
  77. {
  78.     new tmp[256], cmd[256], idx;
  79.     cmd = strtok(cmdtext, idx);
  80.     if(strcmp(cmdtext, "/teaser", true) == 0)
  81.     {
  82.         if(IsPlayerConnected(playerid))
  83.         {
  84.             if(IsPlayerAdmin(playerid))
  85.             {
  86.                 if(Teaserstate != 0) { SendClientMessage(playerid, COLOR_LIGHTRED, "Wait a second!"); return 1; }
  87.                 if(TeaserShown == false)
  88.                 {
  89.                     TeaserShown = true;
  90.                     Teasertimer = SetTimer("ShowTeaser", 30, 1);
  91.                     SendClientMessage(playerid, COLOR_LIGHTBLUE, "Teaser is shown for all players!");
  92.                 }
  93.                 else
  94.                 {
  95.                     TeaserShown = false;
  96.                     Teasertimer = SetTimer("HideTeaser", 30, 1);
  97.                     SendClientMessage(playerid, COLOR_LIGHTBLUE, "Teaser is hidden for all players!");
  98.                 }
  99.             }
  100.         }
  101.         return 1;
  102.     }
  103.     if(strcmp(cmd, "/teasertext", true) == 0)
  104.     {
  105.         if(IsPlayerConnected(playerid))
  106.         {
  107.             if(IsPlayerAdmin(playerid))
  108.             {
  109.                 if(Teaserstate != 0) { SendClientMessage(playerid, COLOR_LIGHTRED, "Wait a second!"); return 1; }
  110.                 tmp = strtok(cmdtext,idx);
  111.                 format(TeaserTn, sizeof(TeaserTn), "%s", tmp);
  112.                 SendClientMessage(playerid, COLOR_LIGHTBLUE, "Changed text!");
  113.                 if(TeaserShown) { Teasertimer = SetTimer("RefreshTeaser", 30, 1); } else { TeaserTa = TeaserTn; }
  114.             }
  115.         }
  116.         return 1;
  117.     }
  118.     return 0;
  119. }
  120.  
  121. public RefreshTeaser()
  122. {
  123.     TextDrawDestroy(Teasertext);
  124.     TextDrawDestroy(Teaserbox);
  125.     if(Teaserstate == 0) { TeaserY = 434.500000; }
  126.     if(Teaserstate == 1) { TeaserY = 435.200000; }
  127.     if(Teaserstate == 2) { TeaserY = 436.200000; }
  128.     if(Teaserstate == 3) { TeaserY = 437.500000; }
  129.     if(Teaserstate == 4) { TeaserY = 439.000000; }
  130.     if(Teaserstate == 5) { TeaserY = 440.500000; }
  131.     if(Teaserstate == 6) { TeaserY = 442.000000; }
  132.     if(Teaserstate == 7) { TeaserY = 443.500000; }
  133.     if(Teaserstate == 8) { TeaserY = 445.500000; }
  134.     if(Teaserstate == 9) { TeaserY = 447.500000; }
  135.     if(Teaserstate == 10) { TeaserY = 449.000000; }
  136.     if(Teaserstate == 11) { TeaserY = 447.500000; }
  137.     if(Teaserstate == 12) { TeaserY = 445.500000; }
  138.     if(Teaserstate == 13) { TeaserY = 443.500000; }
  139.     if(Teaserstate == 14) { TeaserY = 442.000000; }
  140.     if(Teaserstate == 15) { TeaserY = 440.500000; }
  141.     if(Teaserstate == 16) { TeaserY = 439.000000; }
  142.     if(Teaserstate == 17) { TeaserY = 437.500000; }
  143.     if(Teaserstate == 18) { TeaserY = 436.200000; }
  144.     if(Teaserstate == 19) { TeaserY = 435.200000; }
  145.     if(Teaserstate == 20) { TeaserY = 434.500000; }
  146.     if(Teaserstate == 20) { TeaserY = 434.000000; }
  147.  
  148.     Teaserbox = TextDrawCreate(320.000000, TeaserY, "_");
  149.     TextDrawAlignment(Teaserbox, 2);
  150.     TextDrawBackgroundColor(Teaserbox, 255);
  151.     TextDrawFont(Teaserbox, 1);
  152.     TextDrawLetterSize(Teaserbox, 0.400000, 1.300000);
  153.     TextDrawColor(Teaserbox, -1);
  154.     TextDrawSetOutline(Teaserbox, 1);
  155.     TextDrawSetProportional(Teaserbox, 1);
  156.     TextDrawUseBox(Teaserbox, 1);
  157.     TextDrawBoxColor(Teaserbox, 160);
  158.     TextDrawTextSize(Teaserbox, 0.000000, 636.000000);
  159.  
  160.          if(Teaserstate < 11) { Teasertext = TextDrawCreate(320.000000, TeaserY, TeaserTa); }
  161.     else if(Teaserstate > 10) { Teasertext = TextDrawCreate(320.000000, TeaserY, TeaserTn); }
  162.     TextDrawAlignment(Teasertext, 2);
  163.     TextDrawBackgroundColor(Teasertext, 255);
  164.     TextDrawFont(Teasertext, 1);
  165.     TextDrawLetterSize(Teasertext, 0.400000, 1.300000);
  166.     TextDrawColor(Teasertext, -1);
  167.     TextDrawSetOutline(Teasertext, 1);
  168.     TextDrawSetProportional(Teasertext, 1);
  169.  
  170.     TextDrawShowForAll(Teasertext);
  171.     TextDrawShowForAll(Teaserbox);
  172.  
  173.     if(Teaserstate == 21) { KillTimer(Teasertimer); Teaserstate = 0; TeaserTa = TeaserTn; return 1; }
  174.     Teaserstate++;
  175.     return 1;
  176. }
  177.  
  178. public HideTeaser()
  179. {
  180.     TextDrawDestroy(Teasertext);
  181.     TextDrawDestroy(Teaserbox);
  182.     if(Teaserstate == 0) { TeaserY = 434.500000; }
  183.     if(Teaserstate == 1) { TeaserY = 435.200000; }
  184.     if(Teaserstate == 2) { TeaserY = 436.200000; }
  185.     if(Teaserstate == 3) { TeaserY = 437.500000; }
  186.     if(Teaserstate == 4) { TeaserY = 439.000000; }
  187.     if(Teaserstate == 5) { TeaserY = 440.500000; }
  188.     if(Teaserstate == 6) { TeaserY = 442.000000; }
  189.     if(Teaserstate == 7) { TeaserY = 443.500000; }
  190.     if(Teaserstate == 8) { TeaserY = 445.500000; }
  191.     if(Teaserstate == 9) { TeaserY = 447.500000; }
  192.     if(Teaserstate == 10) { TeaserY = 449.000000; }
  193.  
  194.     Teaserbox = TextDrawCreate(320.000000, TeaserY, "_");
  195.     TextDrawAlignment(Teaserbox, 2);
  196.     TextDrawBackgroundColor(Teaserbox, 255);
  197.     TextDrawFont(Teaserbox, 1);
  198.     TextDrawLetterSize(Teaserbox, 0.400000, 1.300000);
  199.     TextDrawColor(Teaserbox, -1);
  200.     TextDrawSetOutline(Teaserbox, 1);
  201.     TextDrawSetProportional(Teaserbox, 1);
  202.     TextDrawUseBox(Teaserbox, 1);
  203.     TextDrawBoxColor(Teaserbox, 160);
  204.     TextDrawTextSize(Teaserbox, 0.000000, 636.000000);
  205.  
  206.     Teasertext = TextDrawCreate(320.000000, TeaserY, TeaserTa);
  207.     TextDrawAlignment(Teasertext, 2);
  208.     TextDrawBackgroundColor(Teasertext, 255);
  209.     TextDrawFont(Teasertext, 1);
  210.     TextDrawLetterSize(Teasertext, 0.400000, 1.300000);
  211.     TextDrawColor(Teasertext, -1);
  212.     TextDrawSetOutline(Teasertext, 1);
  213.     TextDrawSetProportional(Teasertext, 1);
  214.  
  215.     TextDrawShowForAll(Teasertext);
  216.     TextDrawShowForAll(Teaserbox);
  217.  
  218.     if(Teaserstate == 10) { TextDrawDestroy(Teasertext); TextDrawDestroy(Teaserbox); Teaserstate = 0; TeaserTa = TeaserTn; KillTimer(Teasertimer); return 1; }
  219.     Teaserstate++;
  220.     return 1;
  221. }
  222.  
  223. public ShowTeaser() // von 449 auf 434
  224. {
  225.     TextDrawDestroy(Teasertext);
  226.     TextDrawDestroy(Teaserbox);
  227.     if(Teaserstate == 0) { TeaserY = 447.500000; }
  228.     if(Teaserstate == 1) { TeaserY = 445.500000; }
  229.     if(Teaserstate == 2) { TeaserY = 443.500000; }
  230.     if(Teaserstate == 3) { TeaserY = 442.000000; }
  231.     if(Teaserstate == 4) { TeaserY = 440.500000; }
  232.     if(Teaserstate == 5) { TeaserY = 439.000000; }
  233.     if(Teaserstate == 6) { TeaserY = 437.500000; }
  234.     if(Teaserstate == 7) { TeaserY = 436.200000; }
  235.     if(Teaserstate == 8) { TeaserY = 435.200000; }
  236.     if(Teaserstate == 9) { TeaserY = 434.500000; }
  237.     if(Teaserstate == 10) { TeaserY = 434.000000; }
  238.  
  239.     Teaserbox = TextDrawCreate(320.000000, TeaserY, "_");
  240.     TextDrawAlignment(Teaserbox, 2);
  241.     TextDrawBackgroundColor(Teaserbox, 255);
  242.     TextDrawFont(Teaserbox, 1);
  243.     TextDrawLetterSize(Teaserbox, 0.400000, 1.300000);
  244.     TextDrawColor(Teaserbox, -1);
  245.     TextDrawSetOutline(Teaserbox, 1);
  246.     TextDrawSetProportional(Teaserbox, 1);
  247.     TextDrawUseBox(Teaserbox, 1);
  248.     TextDrawBoxColor(Teaserbox, 160);
  249.     TextDrawTextSize(Teaserbox, 0.000000, 636.000000);
  250.  
  251.     Teasertext = TextDrawCreate(320.000000, TeaserY, TeaserTn);
  252.     TextDrawAlignment(Teasertext, 2);
  253.     TextDrawBackgroundColor(Teasertext, 255);
  254.     TextDrawFont(Teasertext, 1);
  255.     TextDrawLetterSize(Teasertext, 0.400000, 1.300000);
  256.     TextDrawColor(Teasertext, -1);
  257.     TextDrawSetOutline(Teasertext, 1);
  258.     TextDrawSetProportional(Teasertext, 1);
  259.  
  260.     TextDrawShowForAll(Teasertext);
  261.     TextDrawShowForAll(Teaserbox);
  262.  
  263.     if(Teaserstate == 10) { KillTimer(Teasertimer); Teaserstate = 0; return 1; }
  264.     Teaserstate++;
  265.     return 1;
  266. }
  267.  
  268. stock Teaser_IsPlayerAdmin(playerid)
  269.     return (IsPlayerAdmin(playerid) || CallRemoteFunction("IsPlayerAdminCall","i",playerid));
  270.    
  271. strtok(const string[], &index)
  272. {
  273.     new length = strlen(string);
  274.     while ((index < length) && (string[index] <= ' '))
  275.     {
  276.         index++;
  277.     }
  278.  
  279.     new offset = index;
  280.     new result[20];
  281.     while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  282.     {
  283.         result[index - offset] = string[index];
  284.         index++;
  285.     }
  286.     result[index - offset] = EOS;
  287.     return result;
  288. }
  289.    
  290. AntiDeAMX()
  291. {
  292.     new xyz[][] =
  293.     {
  294.         "Unarmed (Fist)",
  295.         "Brass K"
  296.     };
  297.     #pragma unused xyz
  298. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement