Advertisement
Guest User

Untitled

a guest
Jul 16th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.81 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <d2lod>
  3. #include <engine>
  4. #include <hamsandwich>
  5. #include <fakemeta>
  6.  
  7. new PLUGIN_NAME[] = "MonsterMod Addon"
  8. new PLUGIN_AUTHOR[] = "xbatista"
  9. new PLUGIN_VERSION[] = "1.0"
  10.  
  11. #define MAX_MONSTERS 14
  12.  
  13. #define COINS_CLASSNAME "CoinsMonster"
  14.  
  15. new const Monster_Models[MAX_MONSTERS][] =
  16. {
  17. "models/agrunt.mdl",
  18. "models/big_mom.mdl",
  19. "models/bullsquid.mdl",
  20. "models/controller.mdl",
  21. "models/garg.mdl",
  22. "models/headcrab.mdl",
  23. "models/houndeye.mdl",
  24. "models/islave.mdl",
  25. "models/w_squeak.mdl",
  26. "models/zombie.mdl",
  27. "models/hgrunt.mdl",
  28. "models/tentacle.mdl",
  29. "models/babygarg.mdl",
  30. "models/bigrat.mdl"
  31. }
  32. new const Monster_Xp[MAX_MONSTERS] =
  33. {
  34. 150,
  35. 600,
  36. 100,
  37. 120,
  38. 0,
  39. 50,
  40. 70, // Houndeye
  41. 120,
  42. 0,
  43. 80,
  44. 0,
  45. 0,
  46. 0,
  47. 0
  48. }
  49. new const Monster_Coins[MAX_MONSTERS] =
  50. {
  51. 20,
  52. 70,
  53. 10,
  54. 20,
  55. 0,
  56. 3,
  57. 10,
  58. 25,
  59. 0,
  60. 15,
  61. 0,
  62. 0,
  63. 0,
  64. 0
  65. }
  66. new const Monster_Names[MAX_MONSTERS][] =
  67. {
  68. "Alien Grunt",
  69. "Big Momma (Boss)",
  70. "Bull Squid",
  71. "Controller",
  72. "Gargantua (SUPER BOSS)",
  73. "Head Crab",
  74. "Hound Eye",
  75. "Slave",
  76. "Snark",
  77. "Zombie",
  78. "Human Grunt",
  79. "Tentacle",
  80. "Baby Garg (BOSS)",
  81. "Town Rat"
  82. }
  83.  
  84. new g_iMaxPlayers;
  85.  
  86. public plugin_init()
  87. {
  88. register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
  89.  
  90. RegisterHam(Ham_Killed, "func_wall", "Monster_Killed");
  91.  
  92. register_touch( COINS_CLASSNAME, "player", "Coins_Pickup")
  93.  
  94. register_logevent("Event_Round_End", 2, "1=Round_End");
  95.  
  96. g_iMaxPlayers = get_maxplayers();
  97. }
  98.  
  99. public Event_Round_End()
  100. {
  101. Remove_All_Coin_Ents();
  102. }
  103.  
  104. public Monster_Killed(this, idattacker, shouldgib)
  105. {
  106. if ( !( 1 <= idattacker <= g_iMaxPlayers ) || !is_valid_ent(this) || !get_player_logged(idattacker) )
  107. return HAM_IGNORED;
  108.  
  109. new MonsterMdl[32];
  110.  
  111. entity_get_string( this, EV_SZ_model, MonsterMdl, charsmax(MonsterMdl) );
  112.  
  113. for(new monsters = 0; monsters < MAX_MONSTERS; monsters++)
  114. {
  115. if( equal( MonsterMdl, Monster_Models[monsters] ) )
  116. {
  117. if ( Monster_Xp[monsters] > 0 )
  118. {
  119. set_p_xp( idattacker, get_p_xp(idattacker) + Monster_Xp[monsters]);
  120. client_print( idattacker, print_center, "You've killed %s +%d", Monster_Names[monsters], Monster_Xp[monsters]);
  121. }
  122.  
  123. if ( Monster_Coins[monsters] > 0 )
  124. drop_coins( this, COINS_CLASSNAME, Monster_Coins[monsters] + (get_p_level(idattacker) / 4) );
  125. }
  126. }
  127.  
  128. return HAM_IGNORED;
  129. }
  130.  
  131. // Touch, coins
  132. public Coins_Pickup(ptr, ptd)
  133. {
  134. if( is_user_alive(ptd) && pev_valid(ptr) )
  135. {
  136. new gold = entity_get_int(ptr , EV_INT_iuser1)
  137.  
  138. set_p_gold(ptd, get_p_gold(ptd) + gold)
  139.  
  140. remove_entity(ptr)
  141. }
  142. }
  143. public Remove_All_Coin_Ents()
  144. {
  145. new coin_ent = find_ent_by_class(-1, COINS_CLASSNAME)
  146.  
  147. while ( coin_ent )
  148. {
  149. remove_entity(coin_ent)
  150. coin_ent = find_ent_by_class(coin_ent, COINS_CLASSNAME)
  151. }
  152. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement