Guest User

Connection Messages TD by RealCop228

a guest
Mar 1st, 2013
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 5.00 KB | None | 0 0
  1. // Credits for this go to RealCop228
  2. // You are free to use this any way you want.
  3. // You must keep these credits here.
  4. // You may not claim this as your own.
  5. // You may modify the hell out of this code.
  6. // You may not re-release this code w/o my permission.
  7.  
  8. #include <a_samp>
  9.  
  10. new
  11.     Text:TD_line[5],
  12.     szString_0[90],
  13.     szString_1[90],
  14.     szString_2[90],
  15.     szString_3[90],
  16.     szString_4[90];
  17.  
  18. public OnFilterScriptInit()
  19. {
  20.     TD_line[4] = TextDrawCreate(511.000000, 170.000000, ""); // format: ~b~(ID) ~y~USERNAME ~*~TYPE_of_CONNECTION
  21.     TextDrawBackgroundColor(TD_line[4], 255);
  22.     TextDrawFont(TD_line[4], 2);
  23.     TextDrawLetterSize(TD_line[4], 0.209999, 1.100000);
  24.     TextDrawColor(TD_line[4], -1);
  25.     TextDrawSetOutline(TD_line[4], 0);
  26.     TextDrawSetProportional(TD_line[4], 1);
  27.     TextDrawSetShadow(TD_line[4], 1);
  28.  
  29.     TD_line[3] = TextDrawCreate(511.000000, 182.000000, ""); // format: ~b~(ID) ~y~USERNAME ~*~TYPE_of_CONNECTION
  30.     TextDrawBackgroundColor(TD_line[3], 255);
  31.     TextDrawFont(TD_line[3], 2);
  32.     TextDrawLetterSize(TD_line[3], 0.209999, 1.100000);
  33.     TextDrawColor(TD_line[3], -1);
  34.     TextDrawSetOutline(TD_line[3], 0);
  35.     TextDrawSetProportional(TD_line[3], 1);
  36.     TextDrawSetShadow(TD_line[3], 1);
  37.  
  38.     TD_line[2] = TextDrawCreate(510.000000, 194.000000, ""); // format: ~b~(ID) ~y~USERNAME ~*~TYPE_of_CONNECTION
  39.     TextDrawBackgroundColor(TD_line[2], 255);
  40.     TextDrawFont(TD_line[2], 2);
  41.     TextDrawLetterSize(TD_line[2], 0.209999, 1.100000);
  42.     TextDrawColor(TD_line[2], -1);
  43.     TextDrawSetOutline(TD_line[2], 0);
  44.     TextDrawSetProportional(TD_line[2], 1);
  45.     TextDrawSetShadow(TD_line[2], 1);
  46.  
  47.     TD_line[1] = TextDrawCreate(511.000000, 206.000000, ""); // format: ~b~(ID) ~y~USERNAME ~*~TYPE_of_CONNECTION
  48.     TextDrawBackgroundColor(TD_line[1], 255);
  49.     TextDrawFont(TD_line[1], 2);
  50.     TextDrawLetterSize(TD_line[1], 0.209999, 1.100000);
  51.     TextDrawColor(TD_line[1], -1);
  52.     TextDrawSetOutline(TD_line[1], 0);
  53.     TextDrawSetProportional(TD_line[1], 1);
  54.     TextDrawSetShadow(TD_line[1], 1);
  55.  
  56.     TD_line[0] = TextDrawCreate(511.000000, 218.000000, ""); // format: ~b~(ID) ~y~USERNAME ~*~TYPE_of_CONNECTION
  57.     TextDrawBackgroundColor(TD_line[0], 255);
  58.     TextDrawFont(TD_line[0], 2);
  59.     TextDrawLetterSize(TD_line[0], 0.209999, 1.100000);
  60.     TextDrawColor(TD_line[0], -1);
  61.     TextDrawSetOutline(TD_line[0], 0);
  62.     TextDrawSetProportional(TD_line[0], 1);
  63.     TextDrawSetShadow(TD_line[0], 1);
  64.  
  65.     for(new i; i < MAX_PLAYERS; i ++)
  66.     {
  67.         if(IsPlayerConnected(i))
  68.         {
  69.             TextDrawShowForPlayer(i, TD_line[0]);
  70.             TextDrawShowForPlayer(i, TD_line[1]);
  71.             TextDrawShowForPlayer(i, TD_line[2]);
  72.             TextDrawShowForPlayer(i, TD_line[3]);
  73.             TextDrawShowForPlayer(i, TD_line[4]);
  74.         }
  75.     }
  76.     return 1;
  77. }
  78.  
  79. public OnFilterScriptExit()
  80. {
  81.     TextDrawHideForAll(TD_line[0]);
  82.     TextDrawDestroy(TD_line[0]);
  83.     TextDrawHideForAll(TD_line[1]);
  84.     TextDrawDestroy(TD_line[1]);
  85.     TextDrawHideForAll(TD_line[2]);
  86.     TextDrawDestroy(TD_line[2]);
  87.     TextDrawHideForAll(TD_line[3]);
  88.     TextDrawDestroy(TD_line[3]);
  89.     TextDrawHideForAll(TD_line[4]);
  90.     TextDrawDestroy(TD_line[4]);
  91.     return 1;
  92. }
  93.  
  94. public OnPlayerConnect(playerid)
  95. {
  96.     szString_4 = szString_3;
  97.     szString_3 = szString_2;
  98.     szString_2 = szString_1;
  99.     szString_1 = szString_0;
  100.  
  101.     format(szString_0, sizeof(szString_0), "~b~(%d) ~y~%s ~g~JOIN", playerid, getPlayerName(playerid));
  102.     TextDrawSetString(TD_line[0], szString_0);
  103.    
  104.     TextDrawSetString(TD_line[1], szString_1);
  105.     TextDrawSetString(TD_line[2], szString_2);
  106.     TextDrawSetString(TD_line[3], szString_3);
  107.     TextDrawSetString(TD_line[4], szString_4);
  108.     return 1;
  109. }
  110.  
  111. public OnPlayerDisconnect(playerid, reason)
  112. {
  113.     szString_4 = szString_3;
  114.     szString_3 = szString_2;
  115.     szString_2 = szString_1;
  116.     szString_1 = szString_0;
  117.  
  118.     switch(reason)
  119.     {
  120.         case 0: format(szString_0, sizeof(szString_0), "~b~(%d) ~y~%s ~r~TIME", playerid, getPlayerName(playerid));
  121.         case 1: format(szString_0, sizeof(szString_0), "~b~(%d) ~y~%s ~p~QUIT", playerid, getPlayerName(playerid));
  122.         case 2: format(szString_0, sizeof(szString_0), "~b~(%d) ~y~%s ~r~KICK", playerid, getPlayerName(playerid));
  123.     }
  124.     TextDrawSetString(TD_line[0], szString_0);
  125.  
  126.     TextDrawSetString(TD_line[1], szString_1);
  127.     TextDrawSetString(TD_line[2], szString_2);
  128.     TextDrawSetString(TD_line[3], szString_3);
  129.     TextDrawSetString(TD_line[4], szString_4);
  130.     return 1;
  131. }
  132.  
  133. public OnPlayerSpawn(playerid)
  134. {
  135.     TextDrawShowForPlayer(playerid, TD_line[0]);
  136.     TextDrawShowForPlayer(playerid, TD_line[1]);
  137.     TextDrawShowForPlayer(playerid, TD_line[2]);
  138.     TextDrawShowForPlayer(playerid, TD_line[3]);
  139.     TextDrawShowForPlayer(playerid, TD_line[4]);
  140.     return 1;
  141. }
  142.  
  143. public OnPlayerDeath(playerid, killerid)
  144. {
  145.     TextDrawHideForPlayer(playerid, TD_line[0]);
  146.     TextDrawHideForPlayer(playerid, TD_line[1]);
  147.     TextDrawHideForPlayer(playerid, TD_line[2]);
  148.     TextDrawHideForPlayer(playerid, TD_line[3]);
  149.     TextDrawHideForPlayer(playerid, TD_line[4]);
  150.     return 1;
  151. }
  152.  
  153. stock getPlayerName(playerid)
  154. {
  155.     new
  156.         szName[MAX_PLAYER_NAME];
  157.  
  158.     GetPlayerName(playerid, szName, sizeof(szName));
  159.     return szName;
  160. }
Advertisement
Add Comment
Please, Sign In to add comment