Advertisement
EnzoMetlc

[FilterScript] AimData - Basic information while aiming.

Jul 27th, 2015
514
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.71 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3.  
  4. static PlayerText:PlayerDataTD[MAX_PLAYERS][2];
  5. static Text:PlayerDataBOX[3];
  6.  
  7.  
  8. public OnFilterScriptInit()
  9. {
  10.     /* Global TDs */
  11.     PlayerDataBOX[0] = TextDrawCreate(621.000000, 344.000000, "_"); /* General Box */
  12.     TextDrawBackgroundColor(PlayerDataBOX[0], 255);
  13.     TextDrawFont(PlayerDataBOX[0], 1);
  14.     TextDrawLetterSize(PlayerDataBOX[0], 0.500000, 9.000000);
  15.     TextDrawColor(PlayerDataBOX[0], -1);
  16.     TextDrawSetOutline(PlayerDataBOX[0], 0);
  17.     TextDrawSetProportional(PlayerDataBOX[0], 1);
  18.     TextDrawSetShadow(PlayerDataBOX[0], 1);
  19.     TextDrawUseBox(PlayerDataBOX[0], 1);
  20.     TextDrawBoxColor(PlayerDataBOX[0], 150);
  21.     TextDrawTextSize(PlayerDataBOX[0], 365.000000, 0.000000);
  22.  
  23.     PlayerDataBOX[1] = TextDrawCreate(621.000000, 367.000000, "_"); /* Red Box */
  24.     TextDrawBackgroundColor(PlayerDataBOX[1], 255);
  25.     TextDrawFont(PlayerDataBOX[1], 1);
  26.     TextDrawLetterSize(PlayerDataBOX[1], 0.500000, -0.500000);
  27.     TextDrawColor(PlayerDataBOX[1], -1);
  28.     TextDrawSetOutline(PlayerDataBOX[1], 0);
  29.     TextDrawSetProportional(PlayerDataBOX[1], 1);
  30.     TextDrawSetShadow(PlayerDataBOX[1], 1);
  31.     TextDrawUseBox(PlayerDataBOX[1], 1);
  32.     TextDrawBoxColor(PlayerDataBOX[1], -16776961);
  33.     TextDrawTextSize(PlayerDataBOX[1], 365.000000, 0.000000);
  34.  
  35.         PlayerDataBOX[2] = TextDrawCreate(621.000000, 367.000000, "_"); /* Green Box */
  36.     TextDrawBackgroundColor(PlayerDataBOX[2], 255);
  37.     TextDrawFont(PlayerDataBOX[2], 1);
  38.     TextDrawLetterSize(PlayerDataBOX[2], 0.500000, -0.500000);
  39.     TextDrawColor(PlayerDataBOX[2], -1);
  40.     TextDrawSetOutline(PlayerDataBOX[2], 0);
  41.     TextDrawSetProportional(PlayerDataBOX[2], 1);
  42.     TextDrawSetShadow(PlayerDataBOX[2], 1);
  43.     TextDrawUseBox(PlayerDataBOX[2], 1);
  44.     TextDrawBoxColor(PlayerDataBOX[2], 16711935);
  45.     TextDrawTextSize(PlayerDataBOX[2], 365.000000, 0.000000);
  46.    
  47.  
  48.     /* If you want to edit the TDs with 'Zamaroht TextDraw Editor'
  49.     // Avoid problems
  50.     new File:INI = fopen("tdlist.lst", io_write);
  51.     new str[25];
  52.    
  53.     while(fread(INI, str))
  54.     {
  55.         if(!strcmp(str, "PlayerData.tde\r\n")) return fclose(INI);
  56.     }
  57.  
  58.     INI = fopen("tdlist.lst", io_append);
  59.     fwrite(INI, "PlayerData.tde\r\n");
  60.     fclose(INI);
  61.     */
  62.     return 1;
  63. }
  64.  
  65.  
  66.  
  67.  
  68. public OnPlayerConnect(playerid)
  69. {
  70.         PlayerDataTD[playerid][0] = CreatePlayerTextDraw(playerid, 373.000000, 342.000000, "_"); /* Name(ID) */
  71.     PlayerTextDrawBackgroundColor(playerid, PlayerDataTD[playerid][0], 255);
  72.     PlayerTextDrawFont(playerid, PlayerDataTD[playerid][0], 2);
  73.     PlayerTextDrawLetterSize(playerid, PlayerDataTD[playerid][0], 0.360000, 2.100000);
  74.     PlayerTextDrawColor(playerid, PlayerDataTD[playerid][0], -1);
  75.     PlayerTextDrawSetOutline(playerid, PlayerDataTD[playerid][0], 0);
  76.     PlayerTextDrawSetProportional(playerid, PlayerDataTD[playerid][0], 1);
  77.     PlayerTextDrawSetShadow(playerid, PlayerDataTD[playerid][0], 1);
  78.  
  79.     PlayerDataTD[playerid][1] = CreatePlayerTextDraw(playerid, 385.000000, 371.000000, "_"); /* Data */
  80.     PlayerTextDrawBackgroundColor(playerid, PlayerDataTD[playerid][1], 255);
  81.     PlayerTextDrawFont(playerid,PlayerDataTD[playerid][1], 1);
  82.     PlayerTextDrawLetterSize(playerid, PlayerDataTD[playerid][1], 0.630000, 1.900000);
  83.     PlayerTextDrawColor(playerid, PlayerDataTD[playerid][1], -1);
  84.     PlayerTextDrawSetOutline(playerid, PlayerDataTD[playerid][1], 1);
  85.     PlayerTextDrawSetProportional(playerid, PlayerDataTD[playerid][1], 1);
  86.     return 1;
  87. }
  88.  
  89.  
  90. public OnPlayerUpdate(playerid)
  91. {
  92.     new targetid = GetPlayerTargetPlayer(playerid);
  93.    
  94.     if(targetid != 0xFFFF)
  95.     {
  96.         /* Get player target data */
  97.         new name[21], Float:health, Float:armour;
  98.         new str1[25], str2[128];
  99.        
  100.         GetPlayerName(targetid, name, sizeof(name));
  101.         GetPlayerHealth(targetid, health);
  102.         GetPlayerArmour(targetid, armour);
  103.        
  104.         format(str1, sizeof(str1), "%s(%d)", name, targetid);
  105.         format(str2, sizeof(str2), "Health: ~g~~h~%0.2f~n~~w~Armour: ~b~~h~%0.2f~n~~r~%s", health, armour, (!IsPlayerNPC(targetid)) ? ("Player") : ("BOT"));
  106.        
  107.         /* Show boxs */
  108.         TextDrawShowForPlayer(playerid, PlayerDataBOX[0]);
  109.         TextDrawShowForPlayer(playerid, PlayerDataBOX[(GetPlayerTeam(playerid) == GetPlayerTeam(targetid)) ? 2 : 1]);
  110.        
  111.         /* Update TDs and shows */
  112.         PlayerTextDrawSetString(playerid, PlayerDataTD[playerid][0], str1);
  113.         PlayerTextDrawSetString(playerid, PlayerDataTD[playerid][1], str2);
  114.        
  115.         PlayerTextDrawShow(playerid, PlayerDataTD[playerid][0]);
  116.         PlayerTextDrawShow(playerid, PlayerDataTD[playerid][1]);
  117.     }
  118.     else
  119.     {
  120.         TextDrawHideForPlayer(playerid, PlayerDataBOX[0]);
  121.         TextDrawHideForPlayer(playerid, PlayerDataBOX[1]);
  122.         TextDrawHideForPlayer(playerid, PlayerDataBOX[2]);
  123.         PlayerTextDrawHide(playerid, PlayerDataTD[playerid][0]);
  124.         PlayerTextDrawHide(playerid, PlayerDataTD[playerid][1]);
  125.     }
  126.     return 1;
  127. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement