Advertisement
Guest User

Vida

a guest
Dec 2nd, 2016
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.63 KB | None | 0 0
  1. //=========================== [ Includes ] =====================================
  2. #include <a_samp>
  3.  
  4.  
  5. #define ATUALIZAR_VIDA 1 //1000 é um segundo e 10000 é 10 segundos assim vai....
  6. #define COR_TEXTDRAW -1 //aqui você vai colocar a cor do textdraw em hexadecimal o padrão aqui é branco....
  7.  
  8.  
  9.  
  10. //========================== [ News ] ==========================================
  11. new PlayerText:vida[MAX_PLAYERS];
  12. new stringV[10];
  13. new Float:vida2;
  14.  
  15. forward updatevida();
  16.  
  17.  
  18.  
  19. public OnFilterScriptInit()
  20. {
  21. SetTimer("updatevida",ATUALIZAR_VIDA,true);
  22. print("FilterScript feito por Marllun");
  23. return 1;
  24. }
  25.  
  26.  
  27. public OnPlayerConnect(playerid)
  28. {
  29. vida[playerid] = CreatePlayerTextDraw(playerid,562.000000, 67.000000, " ");
  30. PlayerTextDrawBackgroundColor(playerid,vida[playerid], 255);
  31. PlayerTextDrawFont(playerid,vida[playerid], 1);
  32. PlayerTextDrawLetterSize(playerid,vida[playerid], 0.290000, 0.899999);
  33. PlayerTextDrawColor(playerid,vida[playerid], COR_TEXTDRAW);
  34. PlayerTextDrawSetOutline(playerid,vida[playerid], 0);
  35. PlayerTextDrawSetProportional(playerid,vida[playerid], 1);
  36. PlayerTextDrawSetShadow(playerid,vida[playerid], 1);
  37. PlayerTextDrawSetString(playerid,vida[playerid],stringV);
  38. return 1;
  39. }
  40.  
  41. public OnPlayerDisconnect(playerid, reason)
  42. {
  43. PlayerTextDrawHide(playerid,vida[playerid]);
  44. return 1;
  45. }
  46.  
  47. public updatevida()
  48. {
  49. for(new i; i < MAX_PLAYERS; i++)
  50. {
  51. GetPlayerHealth(i,vida2);
  52. format(stringV, sizeof(stringV), "%0.1f",vida2);
  53. if(IsPlayerConnected(i))
  54. {
  55. PlayerTextDrawSetString(i,vida[i],stringV);
  56. }
  57. }
  58. return 1;
  59. }
  60.  
  61.  
  62. public OnPlayerSpawn(playerid)
  63. {
  64. PlayerTextDrawShow(playerid,vida[playerid]);
  65. return 1;
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement