daily pastebin goal
25%
SHARE
TWEET

[Include] - jBlood - Bloodscreen V1.1

Jstylezzz Feb 6th, 2014 683 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  /************************************************
  2.  *                              Blood effect v1.1                                *
  3.  *                                                                       *
  4.  *        (c) Copyright 2014, Jstylezzz          *
  5.  *              This file is provided as is.         *
  6.  *                                                                                               *
  7.  ************************************************/
  8.  
  9. #if defined _jblood_included
  10.   #endinput
  11. #endif
  12. #define _jblood_included
  13.  
  14. //=== NEW'S ===//
  15. new jb_bloodtimer[MAX_PLAYERS];
  16. new jb_BloodCount[MAX_PLAYERS];
  17. new Text:jb_BloodDraw[MAX_PLAYERS];
  18. new bDrawCreated[MAX_PLAYERS];
  19.  
  20. //=== FORWARDS ===//
  21.  
  22. forward jb_getBloodColor(playerid);
  23.  
  24. //=== PUBLICS ===//
  25.  
  26. public jb_getBloodColor(playerid)
  27. {
  28.     TextDrawHideForPlayer(playerid,jb_BloodDraw[playerid]);
  29.         new newhex[128],endhex;
  30.         if(jb_BloodCount[playerid] < 10)
  31.         {
  32.                 format(newhex,128,"0xFF00000%d",jb_BloodCount[playerid]);
  33.         }
  34.         if(jb_BloodCount[playerid] > 10)
  35.         {
  36.                 format(newhex,128,"0xFF0000%d",jb_BloodCount[playerid]);
  37.         }
  38.         sscanf(newhex, "x", endhex);
  39.         TextDrawBoxColor(jb_BloodDraw[playerid],endhex);
  40.         jb_BloodCount[playerid]--;
  41.         TextDrawShowForPlayer(playerid,jb_BloodDraw[playerid]);
  42.         if(jb_BloodCount[playerid]== 0) {KillTimer(jb_bloodtimer[playerid]); TextDrawHideForPlayer(playerid,jb_BloodDraw[playerid]);}
  43.         return 1;
  44. }
  45.  
  46. //=== STOCKS ===//
  47. stock ShowBloodScreen(playerid,Float:amount, shadetimer = 100)
  48. {
  49.                 CheckbDraw(playerid);
  50.                 KillTimer(jb_bloodtimer[playerid]);
  51.         TextDrawHideForPlayer(playerid,jb_BloodDraw[playerid]);
  52.                 jb_BloodCount[playerid] = floatround(amount);
  53.                 new newhex[128],endhex;
  54.                 if(jb_BloodCount[playerid] < 10)
  55.                 {
  56.                         format(newhex,128,"0xFF00000%d",jb_BloodCount[playerid]);
  57.                 }
  58.                 if(jb_BloodCount[playerid] > 10)
  59.                 {
  60.                         format(newhex,128,"0xFF0000%d",jb_BloodCount[playerid]);
  61.                 }
  62.                 sscanf(newhex, "x", endhex);
  63.                 TextDrawBoxColor(jb_BloodDraw[playerid],endhex);
  64.                 TextDrawShowForPlayer(playerid,jb_BloodDraw[playerid]);
  65.                 jb_bloodtimer[playerid] = SetTimerEx("jb_getBloodColor",shadetimer,1,"i",playerid);
  66. }
  67.  
  68. stock CheckbDraw(playerid) //Check if the textdraw is created, if not, create it
  69. {
  70.         if(bDrawCreated[playerid] == 0)
  71.         {
  72.                 jb_BloodDraw[playerid] = TextDrawCreate(643.000000, 1.500000, "usebox");
  73.                 TextDrawLetterSize(jb_BloodDraw[playerid], 0.000000, 49.396297);
  74.                 TextDrawTextSize(jb_BloodDraw[playerid], -2.000000, 0.000000);
  75.                 TextDrawAlignment(jb_BloodDraw[playerid], 1);
  76.                 TextDrawColor(jb_BloodDraw[playerid], 0);
  77.                 TextDrawUseBox(jb_BloodDraw[playerid], true);
  78.                 TextDrawBoxColor(jb_BloodDraw[playerid], -16777166);
  79.                 TextDrawSetShadow(jb_BloodDraw[playerid], 0);
  80.                 TextDrawSetOutline(jb_BloodDraw[playerid], 0);
  81.                 TextDrawFont(jb_BloodDraw[playerid], 0);
  82.                 bDrawCreated[playerid] = 1;
  83.         }
  84. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top