BDGAME

GiveDamage and TakeDamage with TextDraw and Sound

May 26th, 2014
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define LGreenColor   0x00FF04FF
  4. #define RedColor      0xE81010FF
  5.  
  6. new Text:GiveDamage[MAX_PLAYERS];
  7. new Text:TakeDamage[MAX_PLAYERS];
  8.  
  9. public OnGameModeInit()
  10. {
  11.     for(new i; i < MAX_PLAYERS; ++i)
  12.     {
  13.     GiveDamage[i] = TextDrawCreate(171.000000, 388.000000, " ");
  14.     TextDrawAlignment(GiveDamage[i], 2);
  15.     TextDrawBackgroundColor(GiveDamage[i], 255);
  16.     TextDrawFont(GiveDamage[i], 2);
  17.     TextDrawLetterSize(GiveDamage[i], 0.160000, 0.599999);
  18.     TextDrawColor(GiveDamage[i], 0x00FF04FF);
  19.     TextDrawSetOutline(GiveDamage[i], 1);
  20.     TextDrawSetProportional(GiveDamage[i], 1);
  21.     }
  22.  
  23.     for(new i; i < MAX_PLAYERS; ++i)
  24.     {
  25.     TakeDamage[i] = TextDrawCreate(440.000000,388.000000, " ");
  26.     TextDrawAlignment(TakeDamage[i], 2);
  27.     TextDrawBackgroundColor(TakeDamage[i], 255);
  28.     TextDrawFont(TakeDamage[i], 2);
  29.     TextDrawLetterSize(TakeDamage[i], 0.160000, 0.599999);
  30.     TextDrawColor(TakeDamage[i], 0xE81010FF);
  31.     TextDrawSetOutline(TakeDamage[i], 1);
  32.     TextDrawSetProportional(TakeDamage[i], 1);
  33.     }
  34.     return 1;
  35. }
  36.  
  37. forward OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid);
  38. public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
  39. {
  40.     new s[20];
  41.     format(s, 20, "+Damage %.0f", amount);
  42.     TextDrawSetString(GiveDamage[playerid], s);
  43.     TextDrawShowForPlayer(playerid, GiveDamage[playerid]);
  44.     PlayerPlaySound(playerid,17802,0.0,0.0,0.0);
  45.     SetTimerEx("DestruirTextoDraw", 1000, false, "i", playerid);
  46.     return 1;
  47. }
  48.  
  49. forward OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid);
  50. public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
  51. {
  52.     new s[20];
  53.     format(s, 20, "-Damage %.0f", amount);
  54.     TextDrawSetString(TakeDamage[playerid], s);
  55.     TextDrawShowForPlayer(playerid, TakeDamage[playerid]);
  56.     SetTimerEx("DestruirTextoDraw", 1000, false, "i", playerid);
  57.     return 1;
  58. }
  59.  
  60. forward DestruirTextoDraw(playerid);
  61. public DestruirTextoDraw(playerid)
  62. {
  63.     TextDrawHideForPlayer(playerid, GiveDamage[playerid]);
  64.     TextDrawHideForPlayer(playerid, TakeDamage[playerid]);
  65.     return 1;
  66. }
Advertisement
Add Comment
Please, Sign In to add comment