Advertisement
Guest User

for Pro-Pawn

a guest
Nov 19th, 2014
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.64 KB | None | 0 0
  1. /*
  2.             13/07/2013 3:49 p.m.
  3.         Система динамических объявлений
  4.             By [FADE]Parka
  5.             Version: 0.1a
  6.  
  7. (forked and translated to Russian from http://forum.sa-mp.com/showthread.php?t=450640)
  8.     Перевод: Daniel_Cortez
  9. */
  10. #include <a_samp>
  11. #include <sscanf2>
  12. #include <dc_cmd>
  13.  
  14. #define fpub:%0(%1) forward %0(%1); public %0(%1)
  15.  
  16.  
  17. new
  18.     Float:TD_Position,
  19.     Text:Announce,
  20.     Text:Background,
  21.     sAnnounce[118],
  22.     Type,
  23.     bool:aProgress = false,
  24.     TimeTextDraw;
  25.  
  26. public OnPlayerText(playerid, text[]) return 1;
  27.  
  28. public OnFilterScriptInit()
  29. {
  30.     print("\n\n   13/07/2013 3:49 p.m.");
  31.     print("Система динамических объявлений");
  32.     print("     By [FADE]Parka\n\n");
  33.    
  34.     Announce = TextDrawCreate(250.000000, 1.000000, "~y~Dynamic ~b~ Announce~r~ System");
  35.     TextDrawBackgroundColor(Announce, 51);
  36.     TextDrawFont(Announce, 1);
  37.     TextDrawLetterSize(Announce, 0.440000, 1.300000);
  38.     TextDrawColor(Announce, -1);
  39.     TextDrawSetOutline(Announce, 1);
  40.     TextDrawSetProportional(Announce, 1);
  41.     return TextDrawSetSelectable(Announce, 0);
  42. }
  43.  
  44. public OnFilterScriptExit()
  45. {
  46.     return KillTimer(TimeTextDraw);
  47. }
  48.  
  49. CMD:announce(playerid,params[])
  50. {
  51.     #define TD_Type params[0]
  52.     #define TD_Text params[1]
  53.     if(IsPlayerAdmin(playerid) == 0)
  54.         return SendClientMessage( playerid, 0xFF0000ff, "Ошибка: Вы не администратор!");
  55.     if(sscanf(params, "ds[118]", TD_Type, TD_Text))
  56.         return SendClientMessage( playerid, 0xFF0000ff, "Использование: /Announce <тип(0-низ,1-верх)> <текст>");
  57.     if(aProgress)
  58.         return SendClientMessage( playerid, 0xFF0000ff, "Ошибка: Подождите, пока исчезнет предыдущее объявление.");
  59.     Type = TD_Type;
  60.     AnnounceBox(320.0, (TD_Type) ? 435.0 : 1.0000);
  61.     aProgress = true;
  62.     TD_Position = 641.0000;
  63.     sAnnounce[0] = 0, strcat(sAnnounce, TD_Text);
  64.     AnnounceTextDraw();
  65.     return SendClientMessage( playerid, 0x00FF00FF, "Объявление передано успешно!");
  66.     #undef  TD_Text
  67.     #undef  TD_Type
  68. }
  69.  
  70. fpub:AnnounceBox(Float: TD_x, Float: TD_y)
  71. {
  72.     Background = TextDrawCreate( TD_x, TD_y, "~n~_");
  73.     TextDrawAlignment(Background, 2);
  74.     TextDrawBackgroundColor(Background, 255);
  75.     TextDrawFont(Background, 1);
  76.     TextDrawLetterSize(Background, 0.500000, 1.000000);
  77.     TextDrawColor(Background, -1);
  78.     TextDrawSetOutline(Background, 0);
  79.     TextDrawSetProportional(Background, 1);
  80.     TextDrawSetShadow(Background, 1);
  81.     TextDrawUseBox(Background, 1);
  82.     TextDrawBoxColor(Background, 85);
  83.     TextDrawTextSize(Background, 0.000000, 658.000000);
  84.     TextDrawSetSelectable(Background, 0);
  85.     TextDrawShowForAll(Background);
  86. }
  87.  
  88. fpub:RemoveAnnounce()
  89. {
  90.     aProgress = false;
  91.     TextDrawHideForAll(Announce);
  92.     TextDrawDestroy(Background);
  93.     return KillTimer(TimeTextDraw);
  94. }
  95.  
  96. fpub:AnnounceTextDraw()
  97. {
  98.     UpDateTextDraw(Announce);
  99.     TD_Position -= 1.0;
  100.    
  101.     if(floatcmp(TD_Position, -385.0) <= 0)
  102.     {
  103.         RemoveAnnounce();
  104.         TD_Position = 641.0000;
  105.         return 1;
  106.     }
  107.    
  108.     if(floatcmp(TD_Position, 640.0) >= 0)
  109.     {
  110.         TextDrawSetString(Announce , sAnnounce);
  111.     }
  112.     return SetTimer("AnnounceTextDraw", 50, false);
  113. }
  114.  
  115. fpub:UpDateTextDraw(Text:TextId)
  116. {
  117.     EditAnnounceType(TextId, (Type) ? 435.0 : 1.0000);
  118.     return TextDrawShowForAll(TextId);
  119. }
  120.  
  121. fpub:EditAnnounceType(Text:TextId, Float:TD_x)
  122. {
  123.     TextDrawDestroy(TextId);
  124.     TextId = TextDrawCreate( TD_Position, TD_x, sAnnounce);
  125.     TextDrawBackgroundColor(TextId, 51);
  126.     TextDrawFont(TextId, 1);
  127.     TextDrawLetterSize(TextId, 0.440000, 1.300000);
  128.     TextDrawColor(TextId, -1);
  129.     TextDrawSetOutline(TextId, 1);
  130.     TextDrawSetProportional(TextId, 1);
  131.     TextDrawSetSelectable(TextId, 0);
  132. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement