Advertisement
Guest User

Untitled

a guest
Apr 25th, 2009
2,560
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.31 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. new Text:HealthBar[MAX_PLAYERS];
  4.  
  5. public OnFilterScriptInit()
  6. {
  7.     for(new i; i<MAX_PLAYERS; i++)
  8.     {
  9.         if(IsPlayerConnected(i))
  10.         {
  11.             OnPlayerConnect(i);
  12.         }
  13.     }
  14.     return 1;
  15. }
  16.  
  17. public OnFilterScriptExit()
  18. {
  19.     for(new i; i<MAX_PLAYERS; i++)
  20.     {
  21.         if(IsPlayerConnected(i))
  22.         {
  23.             TextDrawDestroy(HealthBar[i]);
  24.         }
  25.     }
  26.     return 1;
  27. }
  28.  
  29. public OnPlayerConnect(playerid)
  30. {
  31.     HealthBar[playerid] = TextDrawCreate(549.000000,52.000000,"..........");
  32.     TextDrawAlignment(HealthBar[playerid],1);
  33.     TextDrawBackgroundColor(HealthBar[playerid],0x00ff00ff);
  34.     TextDrawFont(HealthBar[playerid],3);
  35.     TextDrawLetterSize(HealthBar[playerid],0.569999,2.549999);
  36.     TextDrawColor(HealthBar[playerid],0x00ff0033);
  37.     TextDrawSetOutline(HealthBar[playerid],1);
  38.     TextDrawSetProportional(HealthBar[playerid],1);
  39.     TextDrawSetShadow(HealthBar[playerid],1);
  40.     return 1;
  41. }
  42.  
  43. public OnPlayerDisconnect(playerid)
  44. {
  45.     TextDrawDestroy(HealthBar[playerid]);
  46.     return 1;
  47. }
  48.  
  49. public OnPlayerDeath(playerid)
  50. {
  51.     TextDrawHideForPlayer(playerid,HealthBar[playerid]);
  52.     return 1;
  53. }
  54.  
  55. public OnPlayerSpawn(playerid)
  56. {
  57.     TextDrawSetString(HealthBar[playerid],"..........");
  58.     TextDrawShowForPlayer(playerid,HealthBar[playerid]);
  59.     return 1;
  60. }
  61.  
  62. public OnPlayerUpdate(playerid)
  63. {
  64.     new Float:Health;
  65.     GetPlayerHealth(playerid,Health);
  66.     if(Health >= 90)
  67.     {
  68.         TextDrawSetString(HealthBar[playerid],"..........");
  69.         return 1;
  70.     }
  71.     if(Health >= 80)
  72.     {
  73.         TextDrawSetString(HealthBar[playerid],".........");
  74.         return 1;
  75.     }
  76.     if(Health >= 70)
  77.     {
  78.         TextDrawSetString(HealthBar[playerid],"........");
  79.         return 1;
  80.     }
  81.     if(Health >= 60)
  82.     {
  83.         TextDrawSetString(HealthBar[playerid],".......");
  84.         return 1;
  85.     }
  86.     if(Health >= 50)
  87.     {
  88.         TextDrawSetString(HealthBar[playerid],"......");
  89.         return 1;
  90.     }
  91.     if(Health >= 40)
  92.     {
  93.         TextDrawSetString(HealthBar[playerid],".....");
  94.         return 1;
  95.     }
  96.     if(Health >= 30)
  97.     {
  98.         TextDrawSetString(HealthBar[playerid],"....");
  99.         return 1;
  100.     }
  101.     if(Health >= 20)
  102.     {
  103.         TextDrawSetString(HealthBar[playerid],"...");
  104.         return 1;
  105.     }
  106.     if(Health >= 10)
  107.     {
  108.         TextDrawSetString(HealthBar[playerid],"..");
  109.         return 1;
  110.     }
  111.     if(Health > 0)
  112.     {
  113.         TextDrawSetString(HealthBar[playerid],".");
  114.         return 1;
  115.     }
  116.     return 1;
  117. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement