Advertisement
FailerZ

Digital Health & Armour [DHA]

Jan 14th, 2014
1,823
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.01 KB | None | 0 0
  1. //      /$$$$$$$$            /$$ /$$                     /$$$$$$$$
  2. //      | $$_____/          |__/| $$                    |_____ $$
  3. //      | $$        /$$$$$$  /$$| $$  /$$$$$$   /$$$$$$      /$$/
  4. //      | $$$$$    |____  $$| $$| $$ /$$__  $$ /$$__  $$    /$$/
  5. //      | $$__/     /$$$$$$$| $$| $$| $$$$$$$$| $$  \__/   /$$/
  6. //      | $$       /$$__  $$| $$| $$| $$_____/| $$        /$$/
  7. //      | $$      |  $$$$$$$| $$| $$|  $$$$$$$| $$       /$$$$$$$$
  8. //      |__/       \_______/|__/|__/ \_______/|__/      |________/
  9.  
  10. /*******************************************************************************
  11. *                  Digital Health & Armour [DHA] - by FailerZ                  *
  12. *                                  Copyright ©                                *
  13. *******************************************************************************/
  14.  
  15.  
  16. //================================ [Includes] ==================================
  17. #include          <a_samp>             //Credits to Kalcor/Kye
  18. //================================= [Script] ===================================
  19. //Variables & Arrays
  20. new Text:DigiHP[MAX_PLAYERS];
  21. new Text:DigiAP[MAX_PLAYERS];
  22. //------------------------------------------------------------------------------
  23. //CallBacks & Publics
  24. public OnFilterScriptInit()
  25. {
  26.     print("--------------------------------------");
  27.     print("| Digital Health & Armour by FailerZ |");
  28.     print("|             Loaded                 |");
  29.     print("--------------------------------------");
  30.     return 1;
  31. }
  32. //------------------------------------------------------------------------------
  33. public OnFilterScriptExit()
  34. {
  35.     print("--------------------------------------");
  36.     print("| Digital Health & Armour by FailerZ |");
  37.     print("|             Unloaded               |");
  38.     print("--------------------------------------");
  39.    
  40.     for(new i; i<GetMaxPlayers(); i++)
  41.     {
  42.         if(IsPlayerConnected(i))
  43.         {
  44.             TextDrawDestroy(DigiHP[i]);
  45.             TextDrawDestroy(DigiAP[i]);
  46.         }
  47.     }
  48.     return 1;
  49. }
  50. //------------------------------------------------------------------------------
  51. public OnPlayerConnect(playerid)
  52. {
  53.     DigiHP[playerid] = TextDrawCreate(566.000000, 67.000000, "100");
  54.     TextDrawBackgroundColor(DigiHP[playerid], 255);
  55.     TextDrawFont(DigiHP[playerid], 1);
  56.     TextDrawLetterSize(DigiHP[playerid], 0.340000, 0.799998);
  57.     TextDrawColor(DigiHP[playerid], -6291201);
  58.     TextDrawSetOutline(DigiHP[playerid], 1);
  59.     TextDrawSetProportional(DigiHP[playerid], 1);
  60.  
  61.     DigiAP[playerid] = TextDrawCreate(566.000000, 45.000000, "100");
  62.     TextDrawBackgroundColor(DigiAP[playerid], 255);
  63.     TextDrawFont(DigiAP[playerid], 1);
  64.     TextDrawLetterSize(DigiAP[playerid], 0.340000, 0.799998);
  65.     TextDrawColor(DigiAP[playerid], 1778319615);
  66.     TextDrawSetOutline(DigiAP[playerid], 1);
  67.     TextDrawSetProportional(DigiAP[playerid], 1);
  68.     return 1;
  69. }
  70. //------------------------------------------------------------------------------
  71. public OnPlayerDisconnect(playerid, reason)
  72. {
  73.     TextDrawDestroy(DigiHP[playerid]);
  74.     TextDrawDestroy(DigiAP[playerid]);
  75.     return 1;
  76. }
  77. //------------------------------------------------------------------------------
  78. public OnPlayerSpawn(playerid)
  79. {
  80.     TextDrawShowForPlayer(playerid, DigiHP[playerid]);
  81.    
  82.     new Float:Armour;
  83.     GetPlayerArmour(playerid, Armour);
  84.     if(Armour >= 1) TextDrawShowForPlayer(playerid, DigiAP[playerid]);
  85.     else TextDrawHideForPlayer(playerid, DigiAP[playerid]);
  86.     return 1;
  87. }
  88. //------------------------------------------------------------------------------
  89. public OnPlayerUpdate(playerid)
  90. {
  91.     new Float:Health;
  92.     new HealthNum[15];
  93.     GetPlayerHealth(playerid, Health);
  94.     format(HealthNum, sizeof(HealthNum), "%.0f", Health);
  95.     TextDrawSetString(DigiHP[playerid], HealthNum);
  96.     TextDrawShowForPlayer(playerid, DigiHP[playerid]);
  97.  
  98.     new Float:Armour;
  99.     GetPlayerArmour(playerid, Armour);
  100.     if(Armour >= 1)
  101.     {
  102.         new ArmourNum[15];
  103.         format(ArmourNum, 15, "%.0f", Armour);
  104.         TextDrawSetString(DigiAP[playerid], ArmourNum);
  105.         TextDrawShowForPlayer(playerid, DigiAP[playerid]);
  106.     }
  107.     else
  108.     {
  109.         TextDrawHideForPlayer(playerid, DigiAP[playerid]);
  110.     }
  111.     return 1;
  112. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement