Advertisement
Hiddos

HidBar v1.2

Feb 18th, 2013
1,191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <a_samp>
  2. public OnFilterScriptInit()
  3. {
  4.     print("\n--------------------------------------");
  5.     print(" HidBar 1.2 loaded to the server");
  6.     print("--------------------------------------\n");
  7.     return 1;
  8. }
  9.  
  10. public OnFilterScriptExit()
  11. {
  12.     for(new i = 0; i != MAX_PLAYERS; i++)
  13.     {
  14.         if(IsPlayerConnected(i))
  15.         {
  16.             new Text3D:hitbar = Text3D:(GetPVarInt(i, "hidbar_HitBar") - 1);
  17.             if(_:hitbar != -1)
  18.             {
  19.                 Delete3DTextLabel(hitbar);
  20.                 DeletePVar(i, "hidbar_HitBar");
  21.             }
  22.         }
  23.     }
  24. }
  25.  
  26. public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
  27. {
  28.     new str[4];
  29.     new Float:Pos[3];
  30.     GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
  31.     format(str, 4, "%.1f", amount);
  32.     new Text3D:hitbar = Create3DTextLabel(str, 0xFF0000FF, Pos[0], Pos[1], Pos[2] + 0.6, 30.0, 0);
  33.     SetTimerEx("UpdateHitBar", 66, 0, "iffffii", playerid, amount, Pos[0], Pos[1], Pos[2] + 0.8, 16, 0xFF0000FF);
  34.     SetPVarInt(playerid, "hidbar_HitBar", _:hitbar + 1);
  35.     return 1;
  36. }
  37.  
  38. forward UpdateHitBar(playerid, Float:hp, Float:x, Float:y, Float:z, update_no, color);
  39. public UpdateHitBar(playerid, Float:hp, Float:x, Float:y, Float:z, update_no, color)
  40. {
  41.     new Text3D:hitbar = Text3D:(GetPVarInt(playerid, "hidbar_HitBar") - 1);
  42.     Delete3DTextLabel(hitbar);
  43.     update_no--;
  44.     if(!update_no)
  45.     {
  46.         DeletePVar(playerid, "hidbar_HitBar");
  47.         return;
  48.     }
  49.  
  50.     new string[4];
  51.     z += 0.05;
  52.     color -= 12;
  53.     format(string, sizeof string, "%.1f", hp);
  54.     hitbar = Create3DTextLabel(string, color, x, y, z, 30.0, 0);
  55.     SetTimerEx("UpdateHitBar", 66, 0, "iffffii", playerid, hp, x, y, z, update_no, color);
  56.     SetPVarInt(playerid, "hidbar_HitBar", _:hitbar + 1);
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement