Guest User

Tannz0rz

a guest
May 17th, 2010
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.80 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define FILTERSCRIPT
  4.  
  5. // Change me: total number of players that can be on your server
  6. #define TOTAL_PLAYER_SLOTS 50
  7.  
  8. new
  9.     Text:Players[TOTAL_PLAYER_SLOTS],
  10.     Text:You[TOTAL_PLAYER_SLOTS],
  11.     bool:PlayerScan[TOTAL_PLAYER_SLOTS];
  12.    
  13. public OnFilterScriptInit()
  14. {
  15.     SetTimer("UpdateScan", 1000, 0);
  16.     return 0;
  17. }
  18.  
  19. public OnPlayerCommandText(playerid, cmdtext[])
  20. {
  21.     if(!strcmp(cmdtext, "/scan", true))
  22.     {
  23.         PlayerScan[playerid] = !PlayerScan[playerid];
  24.         return 1;
  25.     }
  26.     return 0;
  27. }
  28.  
  29. forward UpdateScan();
  30. public UpdateScan()
  31. {
  32.     new
  33.         i,
  34.         j,
  35.         Float:x,
  36.         Float:y,
  37.         Float:z,
  38.         name[MAX_PLAYER_NAME],
  39.         strname[MAX_PLAYER_NAME + 1];
  40.  
  41.     // Clear the textdraws in a separate loop
  42.     //  Clearing them in the same one that creates them may cause bugs
  43.     for(; i < TOTAL_PLAYER_SLOTS; ++i)
  44.     {
  45.         TextDrawHideForAll(Players[i]);
  46.         TextDrawHideForAll(You[i]);
  47.         TextDrawDestroy(Players[i]);
  48.         TextDrawDestroy(You[i]);
  49.     }
  50.    
  51.     for(i = 0; i < TOTAL_PLAYER_SLOTS; ++i)
  52.         if(IsPlayerConnected(i))
  53.         {
  54.             GetPlayerPos(i, x, y, z);
  55.             GetPlayerName(i, name, MAX_PLAYER_NAME);
  56.             format(strname, MAX_PLAYER_NAME + 1, ".%s", name);
  57.  
  58.             // Math time
  59.  
  60.             // If players go beyond the given boundaries, use the default coordinates
  61.             x = ((x < -3000.0) ? -2975.0 : x);
  62.             x = ((x > 2500.0) ? 2500.0 : x);
  63.             y = ((y < -2500.0) ? -2500.0 : y);
  64.             y = ((y > 3000.0) ? 2975.0 : y);
  65.            
  66.             // Convert from a 3000x3000 coordinate 4-quadrant graph
  67.             //  To a single 6000x6000 graph
  68.             x = ((x < 0) ? (3000.0 - floatabs(x)) : (x + 3000.0));
  69.             y = ((y < 0) ? (3000.0 + floatabs(y)) : (3000.0 - y));
  70.            
  71.             // Scale the coordinates to fit the screen
  72.             x /= 9.375;
  73.             y /= 12.5;
  74.  
  75.             // Set up the textdraws
  76.             Players[i] = TextDrawCreate(x, y, strname);
  77.             TextDrawAlignment(Players[i],0);
  78.             TextDrawBackgroundColor(Players[i],(IsPlayerNPC(i) ? 0x660000ff : 0x000000ff));
  79.             TextDrawFont(Players[i],1);
  80.             TextDrawLetterSize(Players[i],0.3, 0.4);
  81.             TextDrawColor(Players[i],0xffffffff);
  82.             TextDrawSetOutline(Players[i],1);
  83.             TextDrawSetProportional(Players[i],1);
  84.             TextDrawSetShadow(Players[i],10);
  85.  
  86.             for(j = 0; j < TOTAL_PLAYER_SLOTS; ++j)
  87.                 if(PlayerScan[j])
  88.                 {
  89.                     if(j != i)
  90.                         TextDrawShowForPlayer(j, Players[i]);
  91.                     else
  92.                     {
  93.                         You[j] = TextDrawCreate(x, y, strname);
  94.                         TextDrawAlignment(You[j],0);
  95.                         TextDrawBackgroundColor(You[j],0xffffffff);
  96.                         TextDrawFont(You[j],1);
  97.                         TextDrawLetterSize(You[j],0.3, 0.4);
  98.                         TextDrawColor(You[j],0x000000ff);
  99.                         TextDrawSetOutline(You[j],1);
  100.                         TextDrawSetProportional(You[j],1);
  101.                         TextDrawSetShadow(You[j],10);
  102.                         TextDrawShowForPlayer(j, You[j]);
  103.                     }
  104.                 }
  105.                
  106.     }
  107.    
  108.     return SetTimer("UpdateScan", 1000, 0);
  109. }
Advertisement
Add Comment
Please, Sign In to add comment