Advertisement
leingod

[FilterScript] Leingod's TextDraw Message Box v.3.0

Jan 2nd, 2012
562
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 5.68 KB | None | 0 0
  1. /*
  2.                         Copyright(c), Leingod - 2011
  3. ________________________________________________________________________________
  4.  
  5.                     ##     ##### ## ##  #  #####   ##  ###
  6.                     ##     ##    ## ##  # #       #  # #  #
  7.                     ##     ####  ## # # # ##  ### #  # #   #
  8.                     ##     ##    ## #  ## ##    # #  # #  #
  9.                     ###### ##### ## #   #  #####   ##  ###
  10.  
  11.                            Le TextDraw Message Box
  12.                          ---------------------------
  13. ________________________________________________________________________________
  14.  
  15. FORUM SA:MP PROFILE: http://forum.sa-mp.com/member.php?u=120914
  16.  
  17. Credits:
  18. -Leingod (Me) For make this.
  19. -Sandra18[NL] I get little code from him
  20.  
  21. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  22. */
  23.  
  24. #include <a_samp>
  25. #include <zcmd>
  26.  
  27. //new
  28. new Text:Message[15];
  29. new MessageStr[15][128];
  30. new Text:LeTextDraw;
  31.  
  32. // DEFINES
  33. #define le_TD_version   "ver.3.0"
  34.  
  35. main()
  36. {
  37.     print("\n--------------------------------------------------------");
  38.     print(" Running FilterScript Leingod's TextDraw Message Box "#le_TD_version"");
  39.     print("--------------------------------------------------------\n");
  40. }
  41.  
  42. public OnFilterScriptInit()
  43. {
  44.     for(new line; line<15; line++)
  45.     {
  46.         format(MessageStr[line], 128, " ");
  47.     }
  48.     Message[0] = TextDrawCreate(365, 300+38, MessageStr[0]);
  49.     Message[1] = TextDrawCreate(365, 307+38, MessageStr[1]);
  50.     Message[2] = TextDrawCreate(365, 314+38, MessageStr[2]);
  51.     Message[3] = TextDrawCreate(365, 321+38, MessageStr[3]);
  52.     Message[4] = TextDrawCreate(365, 328+38, MessageStr[4]);
  53.     Message[5] = TextDrawCreate(365, 335+38, MessageStr[5]);
  54.     Message[6] = TextDrawCreate(365, 342+38, MessageStr[6]);
  55.     Message[7] = TextDrawCreate(365, 349+38, MessageStr[7]);
  56.     Message[8] = TextDrawCreate(365, 356+38, MessageStr[8]);
  57.     Message[9] = TextDrawCreate(365, 363+38, MessageStr[9]);
  58.     Message[10] = TextDrawCreate(365, 370+38, MessageStr[10]);
  59.     Message[11] = TextDrawCreate(365, 377+38, MessageStr[11]);
  60.     Message[12] = TextDrawCreate(365, 384+38, MessageStr[12]);
  61.     Message[13] = TextDrawCreate(365, 391+38, MessageStr[13]);
  62.     Message[14] = TextDrawCreate(365, 398+38, MessageStr[14]);
  63.     for(new line; line<15; line++)
  64.     {
  65.         TextDrawLetterSize(Message[line], 0.40, 0.90);
  66.         TextDrawSetShadow(Message[line], 0);
  67.         TextDrawAlignment(Message[line], 1);
  68.         TextDrawFont(Message[line], 1);
  69.         TextDrawShowForAll(Message[line]);
  70.     }
  71.     for(new line; line<15; line++)
  72.     {
  73.         TextDrawLetterSize(Message[line], 0.28, 0.83);
  74.         TextDrawSetShadow(Message[line], 0);
  75.         TextDrawAlignment(Message[line], 1);
  76.         TextDrawTextSize(Message[line], 640, 480);
  77.         TextDrawBoxColor(Message[line], 0x000000FF);
  78.         TextDrawFont(Message[line], 1);
  79.         TextDrawSetOutline(Message[line], 1);
  80.         TextDrawShowForAll(Message[line]);
  81.     }
  82.     return 1;
  83. }
  84.  
  85. public OnFilterScriptExit()
  86. {
  87.     for(new line; line<15; line++)
  88.     {
  89.         TextDrawDestroy(Message[line]);
  90.     }
  91.     return 1;
  92. }
  93.  
  94.  
  95. public OnPlayerConnect(playerid)
  96. {
  97.     LeTextDraw = TextDrawCreate(360.000000,335.000000,"- - -");
  98.     TextDrawUseBox(LeTextDraw,1);
  99.     TextDrawBoxColor(LeTextDraw,0x00000033);
  100.     TextDrawTextSize(LeTextDraw,800.000000,300.000000);
  101.     TextDrawAlignment(LeTextDraw,0);
  102.     TextDrawBackgroundColor(LeTextDraw,0x00000000);
  103.     TextDrawFont(LeTextDraw,1);
  104.     TextDrawLetterSize(LeTextDraw,1.000000,14.100000);
  105.     TextDrawColor(LeTextDraw,0x00000000);
  106.     TextDrawSetOutline(LeTextDraw,1);
  107.     TextDrawSetProportional(LeTextDraw,1);
  108.     TextDrawShowForPlayer(playerid, Text:LeTextDraw);
  109.     for(new line; line<15; line++)
  110.     {
  111.         TextDrawShowForPlayer(playerid, Message[line]);
  112.     }
  113.    
  114.     //example
  115.     new stringA[64], pName[MAX_PLAYER_NAME];
  116.     GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
  117.     format(stringA,sizeof stringA,"%s has joined the server.",pName);
  118.     SendLeMessage(playerid, stringA);
  119.     return 1;
  120. }
  121.  
  122. public OnPlayerDisconnect(playerid, reason)
  123. {
  124.     TextDrawHideForPlayer(playerid, Text:LeTextDraw);
  125.  
  126.     //example
  127.     new stringB[64], name[MAX_PLAYER_NAME];
  128.     GetPlayerName(playerid,name,MAX_PLAYER_NAME);
  129.     switch(reason)
  130.     {
  131.         case 0: format(stringB,sizeof stringB,"%s has left the server. (Timed out)",name);
  132.         case 1: format(stringB,sizeof stringB,"%s has left the server. (Leaving)",name);
  133.         case 2: format(stringB,sizeof stringB,"%s has left the server. (Kicked/Banned)",name);
  134.     }
  135.     SendLeMessage(playerid, stringB);
  136.     return 1;
  137. }
  138.  
  139. //example
  140. CMD:kill(playerid, params[])
  141. {
  142.     #pragma unused params
  143.     new xName[MAX_PLAYER_NAME], stringC[128];
  144.     GetPlayerName(playerid, xName, MAX_PLAYER_NAME);
  145.     SetPlayerHealth(playerid, -1);
  146.     format(stringC, sizeof(stringC), "~w~%s ~r~Has used command /kill.", xName);
  147.     SendLeMessage(playerid, stringC);
  148.     return 1;
  149. }
  150.  
  151. //example
  152. CMD:help(playerid, params[])
  153. {
  154.     #pragma unused params
  155.     new xName[MAX_PLAYER_NAME], stringD[128];
  156.     GetPlayerName(playerid, xName, MAX_PLAYER_NAME);
  157.     format(stringD, sizeof(stringD), "%s Has typed command /help.", xName);
  158.     SendLeMessage(playerid, stringD);
  159.     return 1;
  160. }
  161.    
  162.  
  163. stock SendLeMessage(playerid, const text[])
  164. {
  165.     for(new line; line < 15; line++)
  166.     {
  167.         TextDrawShowForPlayer(playerid, Message[line]);
  168.     }
  169.     for(new line; line < 15; line++)
  170.     {
  171.         TextDrawHideForAll(Message[line]);
  172.         if(line < 14)
  173.         {
  174.             MessageStr[line] = MessageStr[line+1];
  175.             TextDrawSetString(Message[line], MessageStr[line]);
  176.         }
  177.     }
  178.     format(MessageStr[14], 128, "%s",text);
  179.     TextDrawSetString(Message[14], MessageStr[14]);
  180.     for(new line; line < 15; line++)
  181.     {
  182.         TextDrawShowForAll(Message[line]);
  183.     }
  184.     return 1;
  185. }
  186. // ©Leingod 2011 - All rights Reserved
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement