hlmod.hu
https://hlmod.hu/

HUD + DHUD
https://hlmod.hu/viewtopic.php?f=9&t=10722
Oldal: 1 / 1

Szerző:  ChaspeR [2013.09.05. 12:57 ]
Hozzászólás témája:  HUD + DHUD

http://forums.alliedmods.net/showthread.php?t=225419
Meglehetne itt oldani ,hogy a specbe lévő az hud legyen a másik DHUD?! Ha igen valaki esetleg bírna segíteni?

Szerző:  pixxa112 [2013.09.05. 14:19 ]
Hozzászólás témája:  Re: HUD + DHUD

ChaspeR írta:
http://forums.alliedmods.net/showthread.php?t=225419
Meglehetne itt oldani ,hogy a specbe lévő az hud legyen a másik DHUD?! Ha igen valaki esetleg bírna segíteni?


Nem tudom, hogy így jó-e lesz.

De nem próbáld meg ezzel a huddal még sose foglalkoztam:
SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <fun>
  3. #include <cstrike>
  4. #include <fakemeta>
  5. #include <zp50_class_human>
  6. #include <zp50_class_zombie>
  7. #define LIBRARY_NEMESIS "zp50_class_nemesis"
  8. #include <zp50_class_nemesis>
  9. #define LIBRARY_SURVIVOR "zp50_class_survivor"
  10. #include <zp50_class_survivor>
  11. #define LIBRARY_AMMOPACKS "zp50_ammopacks"
  12. #include <zp50_ammopacks>
  13. #include <dhudmessage>
  14.  
  15. const Float:HUD_SPECT_X = 0.6
  16. const Float:HUD_SPECT_Y = 0.8
  17. const Float:HUD_STATS_X = 0.02
  18. const Float:HUD_STATS_Y = 0.9
  19.  
  20. const HUD_STATS_ZOMBIE_R = 200
  21. const HUD_STATS_ZOMBIE_G = 250
  22. const HUD_STATS_ZOMBIE_B = 0
  23.  
  24. const HUD_STATS_HUMAN_R = 0
  25. const HUD_STATS_HUMAN_G = 200
  26. const HUD_STATS_HUMAN_B = 250
  27.  
  28. const HUD_STATS_SPEC_R = 255
  29. const HUD_STATS_SPEC_G = 255
  30. const HUD_STATS_SPEC_B = 255
  31.  
  32. #define TASK_SHOWHUD 100
  33. #define ID_SHOWHUD (taskid - TASK_SHOWHUD)
  34.  
  35. const PEV_SPEC_TARGET = pev_iuser2
  36.  
  37. new g_MsgSync
  38.  
  39. public plugin_init()
  40. {
  41. register_plugin("[ZP] HUD Information", ZP_VERSION_STRING, "ZP Dev Team")
  42.  
  43. g_MsgSync = CreateHudSyncObj()
  44. }
  45.  
  46. public plugin_natives()
  47. {
  48. set_module_filter("module_filter")
  49. set_native_filter("native_filter")
  50. }
  51. public module_filter(const module[])
  52. {
  53. if (equal(module, LIBRARY_NEMESIS) || equal(module, LIBRARY_SURVIVOR) || equal(module, LIBRARY_AMMOPACKS))
  54. return PLUGIN_HANDLED;
  55.  
  56. return PLUGIN_CONTINUE;
  57. }
  58. public native_filter(const name[], index, trap)
  59. {
  60. if (!trap)
  61. return PLUGIN_HANDLED;
  62.  
  63. return PLUGIN_CONTINUE;
  64. }
  65.  
  66. public client_putinserver(id)
  67. {
  68. if (!is_user_bot(id))
  69. {
  70. // Set the custom HUD display task
  71. set_task(1.0, "ShowHUD", id+TASK_SHOWHUD, _, _, "b")
  72. }
  73. }
  74.  
  75. public client_disconnect(id)
  76. {
  77. remove_task(id+TASK_SHOWHUD)
  78. }
  79.  
  80. // Show HUD Task
  81. public ShowHUD(taskid)
  82. {
  83. new player = ID_SHOWHUD
  84.  
  85. // Player dead?
  86. if (!is_user_alive(player))
  87. {
  88. // Get spectating target
  89. player = pev(player, PEV_SPEC_TARGET)
  90.  
  91. // Target not alive
  92. if (!is_user_alive(player))
  93. return;
  94. }
  95.  
  96. // Format classname
  97. static class_name[32], transkey[64]
  98. new red, green, blue
  99.  
  100. if (zp_core_is_zombie(player)) // zombies
  101. {
  102. red = HUD_STATS_ZOMBIE_R
  103. green = HUD_STATS_ZOMBIE_G
  104. blue = HUD_STATS_ZOMBIE_B
  105.  
  106. // Nemesis Class loaded?
  107. if (LibraryExists(LIBRARY_NEMESIS, LibType_Library) && zp_class_nemesis_get(player))
  108. formatex(class_name, charsmax(class_name), "%L", ID_SHOWHUD, "CLASS_NEMESIS")
  109. else
  110. {
  111. zp_class_zombie_get_name(zp_class_zombie_get_current(player), class_name, charsmax(class_name))
  112.  
  113. // ML support for class name
  114. formatex(transkey, charsmax(transkey), "ZOMBIENAME %s", class_name)
  115. if (GetLangTransKey(transkey) != TransKey_Bad) formatex(class_name, charsmax(class_name), "%L", ID_SHOWHUD, transkey)
  116. }
  117. }
  118. else // humans
  119. {
  120. red = HUD_STATS_HUMAN_R
  121. green = HUD_STATS_HUMAN_G
  122. blue = HUD_STATS_HUMAN_B
  123.  
  124. // Survivor Class loaded?
  125. if (LibraryExists(LIBRARY_NEMESIS, LibType_Library) && zp_class_survivor_get(player))
  126. formatex(class_name, charsmax(class_name), "%L", ID_SHOWHUD, "CLASS_SURVIVOR")
  127. else
  128. {
  129. zp_class_human_get_name(zp_class_human_get_current(player), class_name, charsmax(class_name))
  130.  
  131. // ML support for class name
  132. formatex(transkey, charsmax(transkey), "HUMANNAME %s", class_name)
  133. if (GetLangTransKey(transkey) != TransKey_Bad) formatex(class_name, charsmax(class_name), "%L", ID_SHOWHUD, transkey)
  134. }
  135. }
  136.  
  137. // Spectating someone else?
  138. if (player != ID_SHOWHUD)
  139. {
  140. new player_name[32]
  141. get_user_name(player, player_name, charsmax(player_name))
  142.  
  143. // Show name, health, class, and money
  144. 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)
  145.  
  146. if (LibraryExists(LIBRARY_AMMOPACKS, LibType_Library))
  147. show_dhudmessage(0, "Nezve: %s^nElet: %d - Tipus %s - LCS %d", player_name, get_user_health(player), class_name, zp_ammopacks_get(player))
  148. else
  149. show_dhudmessage(0, "Nezve: %s^nElet: %d - Tipus %s - Penz $ %d", player_name, get_user_health(player), class_name, cs_get_user_money(player))
  150. }
  151. else
  152. {
  153. // Show health, class
  154. set_hudmessage(red, green, blue, HUD_STATS_X, HUD_STATS_Y, 0, 6.0, 1.1, 0.0, 0.0, -1)
  155.  
  156. if (LibraryExists(LIBRARY_AMMOPACKS, LibType_Library))
  157. ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync, "Elet: %d - Tipus %s - LCS %d", get_user_health(ID_SHOWHUD), ID_SHOWHUD, "CLASS_CLASS", class_name, ID_SHOWHUD, "AMMO_PACKS1", zp_ammopacks_get(ID_SHOWHUD))
  158. else
  159. ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync, "Elet: %d - Tipus %s", get_user_health(ID_SHOWHUD), ID_SHOWHUD, "CLASS_CLASS", class_name)
  160. }
  161. }
  162.  

Szerző:  ChaspeR [2013.09.05. 21:27 ]
Hozzászólás témája:  Re: HUD + DHUD

szerintem nem jó így ránézésre:S nagyon keveredik minden. de holnap tesztelem , lefordítja?

Szerző:  pixxa112 [2013.09.05. 21:30 ]
Hozzászólás témája:  Re: HUD + DHUD

ChaspeR írta:
szerintem nem jó így ránézésre:S nagyon keveredik minden. de holnap tesztelem , lefordítja?


Oké. Igen lefordítja :)

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