Nyft_

Marcar jogadores por perto do jogador ~NYFT

May 9th, 2022 (edited)
1,017
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.30 KB | None | 0 0
  1. #include a_samp
  2. #include streamer
  3.  
  4. static const Float:STREAM_DISTANCE = 100.0;
  5.  
  6. static bool:playerActiveStreamIn[MAX_PLAYERS];
  7. static Text3D:playerActiveStreamLabel[MAX_PLAYERS][MAX_PLAYERS];
  8.  
  9. main(){}
  10.  
  11. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  12. {
  13.     if((newkeys & KEY_YES) && !playerActiveStreamIn[playerid])
  14.     {
  15.         new label[32], Float:x, Float:y, Float:z, Float:distance;
  16.  
  17.         playerActiveStreamIn[playerid] = true;
  18.  
  19.         for(new i = (GetPlayerPoolSize() + 1); i != -1; --i) // foreach
  20.         {
  21.             GetPlayerPos(i, x, y, z);
  22.  
  23.             if((distance = GetPlayerDistanceFromPoint(playerid, x, y, z)) <= STREAM_DISTANCE)
  24.             {
  25.                 format(label, sizeof(label), "(%i) - Distância: %.1f", i, distance);
  26.                 playerActiveStreamLabel[playerid][i] = CreateDynamic3DTextLabel(label, -1, 0.0, 0.0, 0.5, STREAM_DISTANCE, .attachedplayer = i, .playerid = playerid);
  27.             }
  28.         }
  29.     }
  30.     if((newkeys & KEY_NO) && playerActiveStreamIn[playerid])
  31.     {
  32.         playerActiveStreamIn[playerid] = false;
  33.  
  34.         for(new i = (GetPlayerPoolSize() + 1); i != -1; --i) // foreach
  35.             if(IsValidDynamic3DTextLabel(playerActiveStreamLabel[playerid][i]))
  36.                   DestroyDynamic3DTextLabel(playerActiveStreamLabel[playerid][i]);
  37.     }
  38.     return 1;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment