Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.38 KB | None | 0 0
  1. /*================================================================================
  2.  
  3. ----------------------------
  4. -*- [ZP] HUD Information -*-
  5. ----------------------------
  6.  
  7. This plugin is part of Zombie Plague Mod and is distributed under the
  8. terms of the GNU General Public License. Check ZP_ReadMe.txt for details.
  9.  
  10. ================================================================================*/
  11.  
  12. #include <amxmodx>
  13. #include <fun>
  14. #include <mod>
  15. #include <nvault>
  16. #include <engine>
  17. #include <cstrike>
  18. #include <amxmisc>
  19. #include <fakemeta>
  20. #include <hamsandwich>
  21. #include <zp50_class_human>
  22. #include <zp50_class_zombie>
  23. #define LIBRARY_NEMESIS "zp50_class_nemesis"
  24. #include <zp50_class_nemesis>
  25. #define LIBRARY_ASSASSIN "zp50_class_assassin"
  26. #include <zp50_class_assassin>
  27. #define LIBRARY_SURVIVOR "zp50_class_survivor"
  28. #include <zp50_class_survivor>
  29. #define LIBRARY_SNIPER "zp50_class_sniper"
  30. #include <zp50_class_sniper>
  31. #define LIBRARY_AMMOPACKS "zp50_ammopacks"
  32. #include <zp50_ammopacks>
  33.  
  34. const Float:HUD_SPECT_X = 0.6
  35. const Float:HUD_SPECT_Y = 0.1
  36. const Float:HUD_STATS_X = 0.12
  37. const Float:HUD_STATS_Y = 0.07
  38.  
  39. const HUD_STATS_ZOMBIE_R = 200
  40. const HUD_STATS_ZOMBIE_G = 250
  41. const HUD_STATS_ZOMBIE_B = 0
  42.  
  43. const HUD_STATS_HUMAN_R = 0
  44. const HUD_STATS_HUMAN_G = 180
  45. const HUD_STATS_HUMAN_B = 255
  46.  
  47. const HUD_STATS_SPEC_R = 255
  48. const HUD_STATS_SPEC_G = 255
  49. const HUD_STATS_SPEC_B = 255
  50.  
  51. #define TASK_SHOWHUD 100
  52. #define ID_SHOWHUD (taskid - TASK_SHOWHUD)
  53. #define Player_Hud 1994
  54.  
  55. const PEV_SPEC_TARGET = pev_iuser2
  56.  
  57. new g_MsgSync
  58.  
  59. public plugin_init()
  60. {
  61. register_plugin("[ZP] HUD Information", ZP_VERSION_STRING, "ZP Dev Team")
  62.  
  63. g_MsgSync = CreateHudSyncObj()
  64. }
  65.  
  66. public plugin_natives()
  67. {
  68. set_module_filter("module_filter")
  69. set_native_filter("native_filter")
  70. }
  71.  
  72. public module_filter(const module[])
  73. {
  74. if (equal(module, LIBRARY_NEMESIS) || equal(module, LIBRARY_ASSASSIN) || equal(module, LIBRARY_SURVIVOR) || equal(module, LIBRARY_SNIPER) || equal(module, LIBRARY_AMMOPACKS))
  75. return PLUGIN_HANDLED;
  76.  
  77. return PLUGIN_CONTINUE;
  78. }
  79.  
  80. public native_filter(const name[], index, trap)
  81. {
  82. if (!trap)
  83. return PLUGIN_HANDLED;
  84.  
  85. return PLUGIN_CONTINUE;
  86. }
  87.  
  88. public client_putinserver(id)
  89. {
  90. if (!is_user_bot(id))
  91. {
  92. // Set the custom HUD display task
  93. set_task(1.0, "ShowHUD", id+TASK_SHOWHUD, _, _, "b")
  94. }
  95. }
  96.  
  97. // Show HUD Task
  98. public ShowHUD(taskid)
  99. {
  100. new player = ID_SHOWHUD
  101.  
  102. // Player dead?
  103. if (!is_user_alive(player))
  104. {
  105. // Get spectating target
  106. player = pev(player, PEV_SPEC_TARGET)
  107.  
  108. // Target not alive
  109. if (!is_user_alive(player))
  110. return;
  111. }
  112.  
  113. // Format classname
  114. static class_name[32], transkey[64]
  115. new red, green, blue
  116.  
  117. if (zp_core_is_zombie(player)) // zombies
  118. {
  119. red = HUD_STATS_ZOMBIE_R
  120. green = HUD_STATS_ZOMBIE_G
  121. blue = HUD_STATS_ZOMBIE_B
  122.  
  123. // Nemesis Class loaded?
  124. if (LibraryExists(LIBRARY_NEMESIS, LibType_Library) && zp_class_nemesis_get(player))
  125. formatex(class_name, charsmax(class_name), "%L", ID_SHOWHUD, "CLASS_NEMESIS")
  126.  
  127. // Assassin Class loaded?
  128. else if (LibraryExists(LIBRARY_ASSASSIN, LibType_Library) && zp_class_assassin_get(player))
  129. formatex(class_name, charsmax(class_name), "%L", ID_SHOWHUD, "CLASS_ASSASSIN")
  130. else
  131. {
  132. zp_class_zombie_get_name(zp_class_zombie_get_current(player), class_name, charsmax(class_name))
  133.  
  134. // ML support for class name
  135. formatex(transkey, charsmax(transkey), "ZOMBIENAME %s", class_name)
  136. if (GetLangTransKey(transkey) != TransKey_Bad) formatex(class_name, charsmax(class_name), "%L", ID_SHOWHUD, transkey)
  137. }
  138. }
  139. else // humans
  140. {
  141. red = HUD_STATS_HUMAN_R
  142. green = HUD_STATS_HUMAN_G
  143. blue = HUD_STATS_HUMAN_B
  144.  
  145. // Survivor Class loaded?
  146. if (LibraryExists(LIBRARY_SURVIVOR, LibType_Library) && zp_class_survivor_get(player))
  147. formatex(class_name, charsmax(class_name), "%L", ID_SHOWHUD, "CLASS_SURVIVOR")
  148.  
  149. // Sniper Class loaded?
  150. else if (LibraryExists(LIBRARY_SNIPER, LibType_Library) && zp_class_sniper_get(player))
  151. formatex(class_name, charsmax(class_name), "%L", ID_SHOWHUD, "CLASS_SNIPER")
  152. else
  153. {
  154. zp_class_human_get_name(zp_class_human_get_current(player), class_name, charsmax(class_name))
  155.  
  156. // ML support for class name
  157. formatex(transkey, charsmax(transkey), "HUMANNAME %s", class_name)
  158. if (GetLangTransKey(transkey) != TransKey_Bad) formatex(class_name, charsmax(class_name), "%L", ID_SHOWHUD, transkey)
  159. }
  160. }
  161.  
  162. // Spectating someone else?
  163. if (player != ID_SHOWHUD)
  164. {
  165. new player_name[32]
  166. get_user_name(player, player_name, charsmax(player_name))
  167.  
  168. // Show name, health, class, and money
  169. set_hudmessage(HUD_STATS_SPEC_R, HUD_STATS_SPEC_G, HUD_STATS_SPEC_B, HUD_SPECT_X, HUD_SPECT_Y, 0, 6.0, 1.1, 0.0, 0.0, -1)
  170.  
  171. if (LibraryExists(LIBRARY_AMMOPACKS, LibType_Library))
  172. ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync, "**//--------------------------------\\^n**|| [%L: %s]^n**|| [Health: %d]^n**|| [%L %s]^n**|| [%L %d]^n**|| [Level: %i]^n**|| [Exp: %i]^n**|| [Points: %i]^nThis is an ugly line^nAnothor ugly line^n**\\--------------------------------//**", ID_SHOWHUD, "SPECTATING", player_name, get_user_health(player), ID_SHOWHUD, "CLASS_CLASS", class_name, ID_SHOWHUD, "AMMO_PACKS1", zp_ammopacks_get(player), get_user_level(player), get_user_xp(player), get_user_point(player))
  173. else
  174. ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync, "%L: %s^nHP: %d - %L %s - %L $ %d", ID_SHOWHUD, "SPECTATING", player_name, get_user_health(player), ID_SHOWHUD, "CLASS_CLASS", class_name, ID_SHOWHUD, "MONEY1", cs_get_user_money(player))
  175. }
  176. else
  177. {
  178. // Show health, class
  179. set_hudmessage(red, green, blue, HUD_STATS_X, HUD_STATS_Y, 0, 6.0, 1.1, 0.0, 0.0, -1)
  180.  
  181. if (LibraryExists(LIBRARY_AMMOPACKS, LibType_Library))
  182. ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync, "**//--------------------------------\\**^n**|| [Buxna PalanKus]^n**|| [Health: %d]^n**|| [%L %s]^n**|| [%L %d]^n**|| [Level: %i]^n**|| [Exp: %i]^n**|| [Points: %i]^nThis is an ugly line^nAnothor ugly line^n**\\--------------------------------//**", get_user_health(ID_SHOWHUD), ID_SHOWHUD, "CLASS_CLASS",
  183. class_name, ID_SHOWHUD, "AMMO_PACKS1", zp_ammopacks_get(ID_SHOWHUD), get_user_level(ID_SHOWHUD), get_user_xp(ID_SHOWHUD), get_user_point(ID_SHOWHUD))
  184. else
  185. ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync, "HP: %d - %L %s", get_user_health(ID_SHOWHUD), ID_SHOWHUD, "CLASS_CLASS", class_name)
  186. }
  187. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement