hlmod.hu
https://hlmod.hu/

Sebzés kiíro
https://hlmod.hu/viewtopic.php?f=9&t=16855
Oldal: 1 / 1

Szerző:  MeSter [2014.08.07. 18:05 ]
Hozzászólás témája:  Sebzés kiíro

Nekem olyan plugin kel amikor sebzel zoldel irja amikor sebeznek pirosal

Szerző:  golden15 [2014.08.07. 18:34 ]
Hozzászólás témája:  Re: Sebzés kiíro

SMA Forráskód: [ Mindet kijelol ]
  1. /*
  2. Damage displayer by Lulu the hero(M_Lajos@hotmail.com)
  3.  
  4. A more detailed damage displayer then advanced bullet damage(abd)
  5.  
  6. Colors are being displayed around the cursor accordingly:
  7.   yellow - friendly fire
  8.   red - damage taken
  9.   blue - inflicted harm
  10.   green - self harm
  11.   white - objects( eg. bomb explosion or fire )
  12.  
  13. Version history:
  14.   1.4 - fixed team indication in cstrike
  15.   1.3 - removed team coloring to make plugin applyable to mods other then cs
  16.   turned back to switches to increase sourcecode's readability
  17.   1.22 - removed some variables to reduce resource usage
  18.   1.21 - added team specific colors( T = red, CT = blue, OTHER = magenta ) in both harm and damage
  19.   1.2 - turned switches into ?: statements and clearing out a few variables this way
  20.   1.11 - more optimalization and extracting datas, restructuring if cases, turning them to switches
  21.   1.1 - optimazed code, added friendly fire coloring in damage, plus damage HARM non players
  22.   1.0 - started project: indicating friendly fire(yellow), normal fire(blue) and damage(red)
  23.  
  24. Future developements:
  25.   - Indicating damage done on/recieve from objects, such as breakable things or monstermod monsters.
  26.  
  27. Topic link:
  28. */
  29.  
  30. //comment this line out if you aren't using this plugin in cstrike or czero
  31. #define FOR_CSTRIKE
  32.  
  33. #include <amxmodx>
  34.  
  35. #if defined FOR_CSTRIKE
  36. #include <cstrike>
  37. #define get_team(%1) cs_get_user_team(%1)
  38. #else
  39. #define get_team(%1) get_user_team(%1)
  40. #endif
  41.  
  42. #define NOT_PLAYER_TEAM_ID -1
  43.  
  44. // r , g , b
  45. #define COLOR_ATTACK_TEAMMATE { 127,127, 0 }
  46. #define COLOR_ATTACK_ENEMY { 0, 0,127 }
  47.  
  48. #define COLOR_DAMAGE_TEAMMATE { 127,127, 0 }
  49. #define COLOR_DAMAGE_ENEMY { 127, 0, 0 }
  50. #define COLOR_DAMAGE_OBJECT { 127,127,127 }
  51. #define COLOR_DAMAGE_SELF { 0,127, 0 }
  52.  
  53. #define DAMAGE_ENEMY 0
  54. #define DAMAGE_TEAMMATE 1
  55. #define DAMAGE_OBJECT 2
  56. #define DAMAGE_SELF 3
  57.  
  58. new attack_hud, damage_hud;
  59.  
  60. public plugin_init(){
  61. register_plugin( "Damage displayer", "1.4", "Lulu the hero" );
  62.  
  63. //hook a damage event
  64. register_event( "Damage", "damage_event", "b", "2!0" );
  65.  
  66. attack_hud = CreateHudSyncObj();
  67. damage_hud = CreateHudSyncObj();
  68. }
  69.  
  70. public damage_event(victim){
  71. static damage, attacker, attacker_team, victim_team, is_attacker_player, color[3], damage_type;
  72.  
  73. //if victim is not a player then return
  74. if(!is_user_connected(victim)) return PLUGIN_CONTINUE;
  75.  
  76. //if no damage then return
  77. damage = read_data(2);
  78. if(!damage) return PLUGIN_CONTINUE;
  79.  
  80. //get the attacker
  81. attacker = get_user_attacker(victim);
  82. is_attacker_player = is_user_connected(attacker);
  83.  
  84. //if attacker is not a player, then mark that
  85. //this way, if an entity hurts the player, then we can still indicate that
  86. attacker_team = is_attacker_player ? (_:get_team(attacker)) : NOT_PLAYER_TEAM_ID;
  87.  
  88. //precache the victim's team
  89. victim_team = _:get_team(victim);
  90.  
  91. //displaying inflicted damage to attacker
  92. if(!is_user_bot(attacker) && is_attacker_player && attacker != victim){
  93. //get the nature of the damage
  94. damage_type = victim_team == attacker_team ? DAMAGE_TEAMMATE : DAMAGE_ENEMY;
  95. //set the color according to damage type
  96. switch(damage_type){
  97. case DAMAGE_TEAMMATE : color = COLOR_ATTACK_TEAMMATE;
  98. case DAMAGE_ENEMY : color = COLOR_ATTACK_ENEMY;
  99. }
  100. set_hudmessage( color[0], color[1], color[2], -1.0, 0.55, 0, 2.0, 2.0, 0.1, 1.0, -1 );
  101. ShowSyncHudMsg( attacker, attack_hud, "%d", damage);
  102. }
  103.  
  104. //displaying damage to victim
  105. if(!is_user_bot(victim)){
  106. //get the nature of the damage
  107. damage_type = attacker == victim ? DAMAGE_SELF : victim_team == attacker_team ? DAMAGE_TEAMMATE : attacker_team == NOT_PLAYER_TEAM_ID ? DAMAGE_OBJECT : DAMAGE_ENEMY;
  108. //set the color according to damage type
  109. switch(damage_type){
  110. case DAMAGE_TEAMMATE : color = COLOR_DAMAGE_TEAMMATE;
  111. case DAMAGE_ENEMY : color = COLOR_DAMAGE_ENEMY;
  112. case DAMAGE_OBJECT : color = COLOR_DAMAGE_OBJECT;
  113. case DAMAGE_SELF : color = COLOR_DAMAGE_SELF;
  114. }
  115. set_hudmessage( color[0], color[1], color[2], 0.45, -1.0, 0, 2.0, 2.0, 0.1, 1.0, -1 );
  116. ShowSyncHudMsg( victim, damage_hud, "%d", damage );
  117. }
  118.  
  119. return PLUGIN_HANDLED;
  120. }
  121.  

Tessék ,ha nem jó szólj és átírom ,amilyenre csak szeretnéd!:)

Oldal: 1 / 1 Minden időpont UTC+02:00 időzóna szerinti
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/