Guest User

Untitled

a guest
Oct 16th, 2011
455
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.53 KB | None | 0 0
  1. //Players on the map by Games
  2. #include <a_samp>
  3.  
  4. new Text:Map;
  5. new Text:MapLine[4];
  6. new UseMap[MAX_PLAYERS];
  7. new Text:Textdraw[MAX_PLAYERS][MAX_PLAYERS];
  8. new TextCount[MAX_PLAYERS];
  9. new FirstUse[MAX_PLAYERS];
  10.  
  11. forward UpdateText();
  12.  
  13. public OnFilterScriptInit()
  14. {
  15.     SetTimer("UpdateText",2000,1);
  16.  
  17.     Map = TextDrawCreate(120.0, 20.0, "samaps:map");
  18.     TextDrawFont(Map, 4);
  19.     TextDrawColor(Map, 0xFFFFFFFF);
  20.     TextDrawTextSize(Map, 400.0, 400.0);
  21.  
  22.     MapLine[0] = TextDrawCreate(522.000000, 18.000000, "~n~");
  23.     TextDrawBackgroundColor(MapLine[0], 255);
  24.     TextDrawFont(MapLine[0], 1);
  25.     TextDrawLetterSize(MapLine[0], 0.639999, -0.000000);
  26.     TextDrawColor(MapLine[0], -1);
  27.     TextDrawSetOutline(MapLine[0], 0);
  28.     TextDrawSetProportional(MapLine[0], 1);
  29.     TextDrawSetShadow(MapLine[0], 1);
  30.     TextDrawUseBox(MapLine[0], 1);
  31.     TextDrawBoxColor(MapLine[0], 255);
  32.     TextDrawTextSize(MapLine[0], 118.000000, -3.000000);
  33.  
  34.     MapLine[1] = TextDrawCreate(522.000000, 421.000000, "~n~");
  35.     TextDrawBackgroundColor(MapLine[1], 255);
  36.     TextDrawFont(MapLine[1], 1);
  37.     TextDrawLetterSize(MapLine[1], 0.639999, -0.000000);
  38.     TextDrawColor(MapLine[1], -1);
  39.     TextDrawSetOutline(MapLine[1], 0);
  40.     TextDrawSetProportional(MapLine[1], 1);
  41.     TextDrawSetShadow(MapLine[1], 1);
  42.     TextDrawUseBox(MapLine[1], 1);
  43.     TextDrawBoxColor(MapLine[1], 255);
  44.     TextDrawTextSize(MapLine[1], 118.000000, -3.000000);
  45.  
  46.     MapLine[2] = TextDrawCreate(122.000000, 18.000000, "~n~");
  47.     TextDrawBackgroundColor(MapLine[2], 255);
  48.     TextDrawFont(MapLine[2], 1);
  49.     TextDrawLetterSize(MapLine[2], 0.619999, 44.800025);
  50.     TextDrawColor(MapLine[2], -1);
  51.     TextDrawSetOutline(MapLine[2], 0);
  52.     TextDrawSetProportional(MapLine[2], 1);
  53.     TextDrawSetShadow(MapLine[2], 1);
  54.     TextDrawUseBox(MapLine[2], 1);
  55.     TextDrawBoxColor(MapLine[2], 255);
  56.     TextDrawTextSize(MapLine[2], 114.000000, 0.000000);
  57.  
  58.     MapLine[3] = TextDrawCreate(522.000000, 18.000000, "~n~");
  59.     TextDrawBackgroundColor(MapLine[3], 255);
  60.     TextDrawFont(MapLine[3], 1);
  61.     TextDrawLetterSize(MapLine[3], 0.619999, 44.800025);
  62.     TextDrawColor(MapLine[3], -1);
  63.     TextDrawSetOutline(MapLine[3], 0);
  64.     TextDrawSetProportional(MapLine[3], 1);
  65.     TextDrawSetShadow(MapLine[3], 1);
  66.     TextDrawUseBox(MapLine[3], 1);
  67.     TextDrawBoxColor(MapLine[3], 255);
  68.     TextDrawTextSize(MapLine[3], 522.000000, 0.000000);
  69.     return 1;
  70. }
  71.  
  72. public OnPlayerCommandText(playerid, cmdtext[])
  73. {
  74.     if(strcmp(cmdtext, "/map",true) == 0)
  75.     {
  76.         if(UseMap[playerid] == 0)
  77.         {
  78.             UseMap[playerid]=1;
  79.             FirstUse[playerid]=0;
  80.             TextCount[playerid]=0;
  81.             TextDrawShowForPlayer(playerid, Map);
  82.             TextDrawShowForPlayer(playerid, MapLine[0]);
  83.             TextDrawShowForPlayer(playerid, MapLine[1]);
  84.             TextDrawShowForPlayer(playerid, MapLine[2]);
  85.             TextDrawShowForPlayer(playerid, MapLine[3]);
  86.         }
  87.         else
  88.         {
  89.             UseMap[playerid]=0;
  90.             TextDrawHideForPlayer(playerid, Map);
  91.             TextDrawHideForPlayer(playerid, MapLine[0]);
  92.             TextDrawHideForPlayer(playerid, MapLine[1]);
  93.             TextDrawHideForPlayer(playerid, MapLine[2]);
  94.             TextDrawHideForPlayer(playerid, MapLine[3]);
  95.             for(new i; i<TextCount[playerid]; i++)
  96.             {
  97.                 TextDrawHideForPlayer(playerid, Textdraw[playerid][i]);
  98.                 TextDrawDestroy(Textdraw[playerid][i]);
  99.             }
  100.  
  101.         }
  102.         return 1;
  103.     }
  104.     return 0;
  105. }
  106.  
  107. public UpdateText()
  108. {
  109.     for(new i; i<MAX_PLAYERS; i++)
  110.     {
  111.         if(UseMap[i] == 1 && IsPlayerConnected(i))
  112.         {
  113.             for(new j; j<MAX_PLAYERS; j++)
  114.             {
  115.                 if(IsPlayerConnected(j))
  116.                 {
  117.                     if(FirstUse[j] == 1)
  118.                     {
  119.                         for(new k; k<TextCount[i]; k++)
  120.                         {
  121.                             TextDrawHideForPlayer(i, Textdraw[i][k]);
  122.                             TextDrawDestroy(Textdraw[i][k]);
  123.                         }
  124.                         TextCount[i]=0;
  125.                     }
  126.                     new Float:x,Float:y,Float:z;
  127.                     GetPlayerPos(j,x,y,z);
  128.                     if(y<-2777 || y>2805 || x<-2724 || x>2870) continue;
  129.                     new Float:X,Float:Y;
  130.                     FirstUse[j]=1;
  131.                     if(y < 0) Y=(y-(y*2))/14.06+204;
  132.                     else Y=208-y/14.06;
  133.                     if(x < 0) X=317-((x-(x*2))/13.8);
  134.                     else X=302+x/13.8;
  135.                     Textdraw[i][TextCount[i]] = TextDrawCreate(X,Y, ".");
  136.                     TextDrawBackgroundColor(Textdraw[i][TextCount[i]], 255);
  137.                     TextDrawFont(Textdraw[i][TextCount[i]], 1);
  138.                     TextDrawLetterSize(Textdraw[i][TextCount[i]], 0.719999, 2.200000);
  139.                     TextDrawColor(Textdraw[i][TextCount[i]], -1);
  140.                     TextDrawSetOutline(Textdraw[i][TextCount[i]], 0);
  141.                     TextDrawSetProportional(Textdraw[i][TextCount[i]], 1);
  142.                     TextDrawSetShadow(Textdraw[i][TextCount[i]], 1);
  143.                     TextDrawShowForPlayer(i, Textdraw[i][TextCount[i]]);
  144.                     TextCount[i]++;
  145.                 }
  146.             }
  147.         }
  148.     }
  149.     return 1;
  150. }
  151.  
Advertisement
Add Comment
Please, Sign In to add comment