Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2016
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. /*
  2. ===============================================================================
  3.  
  4. ARMOR
  5.  
  6. ===============================================================================
  7. */
  8.  
  9. void() armor_touch;
  10.  
  11. void() armor_touch =
  12. {
  13. local float type, value, bit;
  14.  
  15. if (other.health <= 0)
  16. return;
  17. if (other.classname != "player")
  18. return;
  19.  
  20. if (self.classname == "item_armor1")
  21. {
  22. type = 0.3;
  23. value = 100;
  24. bit = IT_ARMOR1;
  25. }
  26. if (self.classname == "item_armor2")
  27. {
  28. type = 0.6;
  29. value = 150;
  30. bit = IT_ARMOR2;
  31. }
  32. if (self.classname == "item_armorInv")
  33. {
  34. type = 0.8;
  35. value = 200;
  36. bit = IT_ARMOR3;
  37. }
  38. if (other.armortype*other.armorvalue >= type*value)
  39. return;
  40.  
  41. other.armortype = type;
  42. other.armorvalue = value;
  43. other.items = other.items - (other.items & (IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) + bit;
  44.  
  45. self.solid = SOLID_NOT;
  46. self.model = string_null;
  47. if (deathmatch == 1)
  48. self.nextthink = time + 20;
  49. self.think = SUB_regen;
  50.  
  51. sprint (other, "You got ");
  52. sprint (other, self.netname);
  53. sprint (other, "\n");
  54. // armor touch sound
  55. sound(other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
  56. stuffcmd (other, "bf\n");
  57.  
  58. activator = other;
  59. SUB_UseTargets(); // fire all targets / killtargets
  60. };
  61.  
  62.  
  63. /*QUAKED item_armor1 (0 .5 .8) (-16 -16 0) (16 16 32)
  64. */
  65.  
  66. void() item_armor1 =
  67. {
  68. self.touch = armor_touch;
  69. precache_model ("progs/armor.mdl");
  70. precache_sound ("items/armor1.wav");
  71. setmodel (self, "progs/armor.mdl");
  72. self.noise = "items/armor1.wav";
  73. self.skin = 0;
  74. setsize (self, '-16 -16 0', '16 16 56');
  75. self.netname = "the Light Armor";
  76. StartItem ();
  77. };
  78.  
  79. /*QUAKED item_armor2 (0 .5 .8) (-16 -16 0) (16 16 32)
  80. */
  81.  
  82. void() item_armor2 =
  83. {
  84. self.touch = armor_touch;
  85. precache_model ("progs/armor.mdl");
  86. precache_sound ("items/armor2.wav");
  87. setmodel (self, "progs/armor.mdl");
  88. self.noise = "items/armor2.wav";
  89. self.skin = 1;
  90. setsize (self, '-16 -16 0', '16 16 56');
  91. self.netname = "the Combat Armor";
  92. StartItem ();
  93. };
  94.  
  95. /*QUAKED item_armorInv (0 .5 .8) (-16 -16 0) (16 16 32)
  96. */
  97.  
  98. void() item_armorInv =
  99. {
  100. self.touch = armor_touch;
  101. precache_model ("progs/armor.mdl");
  102. precache_sound ("items/armor3.wav");
  103. setmodel (self, "progs/armor.mdl");
  104. self.noise = "items/armor3.wav";
  105. self.skin = 2;
  106. setsize (self, '-16 -16 0', '16 16 56');
  107. self.netname = "the Tank Armor";
  108. StartItem ();
  109. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement