Advertisement
Jstylezzz

[Include] - jBlood - Bloodscreen

Feb 5th, 2014
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.67 KB | None | 0 0
  1.  /************************************************
  2.  *              Blood effect v1.0b               *
  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. forward ShowBloodScreen(playerid,Float:amount);
  22. forward jb_getBloodColor(playerid);
  23.  
  24. //=== PUBLICS ===//
  25.  
  26. public ShowBloodScreen(playerid,Float:amount)
  27. {
  28.         CheckbDraw(playerid);
  29.         KillTimer(jb_bloodtimer[playerid]);
  30.         TextDrawHideForPlayer(playerid,jb_BloodDraw[playerid]);
  31.         jb_BloodCount[playerid] = floatround(amount);
  32.         new newhex[128],endhex;
  33.         if(jb_BloodCount[playerid] < 10)
  34.         {
  35.             format(newhex,128,"0xFF00000%d",jb_BloodCount[playerid]);
  36.         }
  37.         if(jb_BloodCount[playerid] > 10)
  38.         {
  39.             format(newhex,128,"0xFF0000%d",jb_BloodCount[playerid]);
  40.         }
  41.         sscanf(newhex, "x", endhex);
  42.         TextDrawBoxColor(jb_BloodDraw[playerid],endhex);
  43.         TextDrawShowForPlayer(playerid,jb_BloodDraw[playerid]);
  44.         jb_bloodtimer[playerid] = SetTimerEx("jb_getBloodColor",100,1,"i",playerid);
  45. }
  46.  
  47. public jb_getBloodColor(playerid)
  48. {
  49.     TextDrawHideForPlayer(playerid,jb_BloodDraw[playerid]);
  50.     new newhex[128],endhex;
  51.     if(jb_BloodCount[playerid] < 10)
  52.     {
  53.         format(newhex,128,"0xFF00000%d",jb_BloodCount[playerid]);
  54.     }
  55.     if(jb_BloodCount[playerid] > 10)
  56.     {
  57.         format(newhex,128,"0xFF0000%d",jb_BloodCount[playerid]);
  58.     }
  59.     sscanf(newhex, "x", endhex);
  60.     TextDrawBoxColor(jb_BloodDraw[playerid],endhex);
  61.     jb_BloodCount[playerid]--;
  62.     TextDrawShowForPlayer(playerid,jb_BloodDraw[playerid]);
  63.     if(jb_BloodCount[playerid]== 0) {KillTimer(jb_bloodtimer[playerid]); TextDrawHideForPlayer(playerid,jb_BloodDraw[playerid]);}
  64.     return 1;
  65. }
  66.  
  67. //=== STOCKS ===//
  68.  
  69. stock CheckbDraw(playerid) //Check if the textdraw is created, if not, create it
  70. {
  71.     if(bDrawCreated[playerid] == 0)
  72.     {
  73.         jb_BloodDraw[playerid] = TextDrawCreate(643.000000, 1.500000, "usebox");
  74.         TextDrawLetterSize(jb_BloodDraw[playerid], 0.000000, 49.396297);
  75.         TextDrawTextSize(jb_BloodDraw[playerid], -2.000000, 0.000000);
  76.         TextDrawAlignment(jb_BloodDraw[playerid], 1);
  77.         TextDrawColor(jb_BloodDraw[playerid], 0);
  78.         TextDrawUseBox(jb_BloodDraw[playerid], true);
  79.         TextDrawBoxColor(jb_BloodDraw[playerid], -16777166);
  80.         TextDrawSetShadow(jb_BloodDraw[playerid], 0);
  81.         TextDrawSetOutline(jb_BloodDraw[playerid], 0);
  82.         TextDrawFont(jb_BloodDraw[playerid], 0);
  83.         bDrawCreated[playerid] = 1;
  84.     }
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement