Advertisement
DomingoEx

allocations

Aug 13th, 2015
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.80 KB | None | 0 0
  1. // allocations by DIz
  2. // 13.08.2015 v0.2
  3. new
  4.     PlayerText: playerAllocation[MAX_PLAYERS][4];
  5. forward
  6.     hideAllocation(playerid);
  7.  
  8. stock showAllocation(playerid, Float:minX, Float:minY, Float:maxX, Float:maxY, time = -1, Float:size = 0.0, color = 0xFF0000FF) {
  9.     if(GetPVarInt(playerid, "lookOnAllocation")) {
  10.         for(new t; t < 4; t++)
  11.             PlayerTextDrawDestroy(playerid, playerAllocation[playerid][t]);
  12.         if(GetPVarType(playerid, "lookAllocationTimer") != PLAYER_VARTYPE_NONE)
  13.             KillTimer(GetPVarInt(playerid, "lookAllocationTimer")),
  14.             DeletePVar(playerid, "lookAllocationTimer");
  15.     }
  16.  
  17.     playerAllocation[playerid][0] = CreatePlayerTextDraw(playerid, minX, minY, "up");
  18.     PlayerTextDrawLetterSize    (playerid, playerAllocation[playerid][0], 0.0, (size-0.2));
  19.     PlayerTextDrawUseBox        (playerid, playerAllocation[playerid][0], 1);
  20.     PlayerTextDrawBoxColor      (playerid, playerAllocation[playerid][0], color);
  21.     PlayerTextDrawTextSize      (playerid, playerAllocation[playerid][0], maxX-4.0, 0.0);
  22.  
  23.     playerAllocation[playerid][1] = CreatePlayerTextDraw(playerid, minX, maxY - (size+0.4) * 10.0, "down");
  24.     PlayerTextDrawLetterSize    (playerid, playerAllocation[playerid][1], 0.0, (size-0.2));
  25.     PlayerTextDrawUseBox        (playerid, playerAllocation[playerid][1], 1);
  26.     PlayerTextDrawBoxColor      (playerid, playerAllocation[playerid][1], color);
  27.     PlayerTextDrawTextSize      (playerid, playerAllocation[playerid][1], maxX-4.0, 0.0);
  28.  
  29.     playerAllocation[playerid][2] = CreatePlayerTextDraw(playerid, minX, minY, "left");
  30.     PlayerTextDrawLetterSize    (playerid, playerAllocation[playerid][2], 0.0, 0.111 * (maxY - minY - (size+0.4) * 10.0) - 0.3);
  31.     PlayerTextDrawUseBox        (playerid, playerAllocation[playerid][2], 1);
  32.     PlayerTextDrawBoxColor      (playerid, playerAllocation[playerid][2], color);
  33.     PlayerTextDrawTextSize      (playerid, playerAllocation[playerid][2], minX - 2.0 + size * 10, 0.0);
  34.  
  35.     playerAllocation[playerid][3] = CreatePlayerTextDraw(playerid, maxX - (size+0.2) * 10.0, minY, "right");
  36.     PlayerTextDrawLetterSize    (playerid, playerAllocation[playerid][3], 0.0, 0.111 * (maxY - minY - (size+0.4) * 10.0) - 0.3);
  37.     PlayerTextDrawUseBox        (playerid, playerAllocation[playerid][3], 1);
  38.     PlayerTextDrawBoxColor      (playerid, playerAllocation[playerid][3], color);
  39.     PlayerTextDrawTextSize      (playerid, playerAllocation[playerid][3], maxX - 4.0, 0.0);
  40.  
  41.     for(new t; t < 4; t++)
  42.         PlayerTextDrawShow(playerid, playerAllocation[playerid][t]);
  43.     if(time != -1)
  44.         SetPVarInt(playerid, "lookAllocationTimer", SetTimerEx("hideAllocation", time, false, "i", playerid));
  45.     SetPVarInt(playerid, "lookOnAllocation", 1);
  46.     return true;
  47. }
  48.  
  49. public hideAllocation(playerid) {
  50.     for(new t; t < 4; t++)
  51.         PlayerTextDrawDestroy(playerid, playerAllocation[playerid][t]);
  52.     DeletePVar(playerid, "lookOnAllocation");
  53.     DeletePVar(playerid, "lookAllocationTimer");
  54.     return true;
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement