hlmod.hu
https://hlmod.hu/

KÉSZ! Spectator, mintha "élnél" + sebzéskiírás
https://hlmod.hu/viewtopic.php?f=29&t=21614
Oldal: 2 / 2

Szerző:  mforce [ 2015.09.01. 13:31 ]
Hozzászólás témája:  Re: SPECTATOR update

Újfajta Sebzés kijelző/kiíró

Bullet_Show_Spec 1 cvar

Szerző:  ZiT3K [ 2015.09.01. 13:35 ]
Hozzászólás témája:  Re: SPECTATOR update

pff minden plugint megnéztem már a pluginok menüpontból, de valamiért nem leltem rá.... köszi!

2.: Utsó dolog lenne, hogy ki lehet e venni a speces pluginból azt, hogy ne írja HUD-ban a hp-t? mert az alapból mutatja ugye

Szerző:  mforce [ 2015.09.01. 14:03 ]
Hozzászólás témája:  Re: SPECTATOR update

SMA Forráskód: [ Mindet kijelol ]
  1. /* Formatright © 2010, ConnorMcLeod
  2.  
  3. This plugin is free software;
  4. you can redistribute it and/or modify it under the terms of the
  5. GNU General Public License as published by the Free Software Foundation.
  6.  
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11.  
  12. You should have received a copy of the GNU General Public License
  13. along with this plugin; if not, write to the
  14. Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  15. Boston, MA 02111-1307, USA.
  16. */
  17.  
  18. #include <amxmodx>
  19. #include <engine>
  20.  
  21. #define VERSION "0.0.1"
  22. #define PLUGIN "Spectator Hud Informations"
  23.  
  24. #define MAX_PLAYERS 32
  25. #define FIRST_PERSON_VIEW 4
  26.  
  27. new const g_iWeaponIdToAmmoId[] = {
  28. 0, 9, 0, 2, 12, 5, 14, 6, 4, 13, 10, 7, 6, 4, 4, 4, 6, 10, 1, 10, 3, 5, 4, 10, 2, 11, 8, 4, 2, 0, 7}
  29.  
  30. new g_iArmor[MAX_PLAYERS+1]
  31. new g_iMoney[MAX_PLAYERS+1]
  32. new g_iCurWeapon[MAX_PLAYERS+1]
  33. new g_iAmmo[MAX_PLAYERS+1]
  34. new g_iBpAmmo[MAX_PLAYERS+1][15]
  35.  
  36. new g_dhud_color
  37.  
  38. public plugin_init()
  39. {
  40. register_plugin(PLUGIN, VERSION, "ConnorMcLeod")
  41.  
  42. register_cvar("amx_spec_hud_color", "250 250 250")
  43.  
  44. register_event("Money", "Event_Money", "b")
  45. register_event("CurWeapon", "Event_CurWeapon", "b", "1=1")
  46. register_event("Battery", "Event_Battery", "b")
  47. register_event("AmmoX", "Event_AmmoX", "b", "1<15")
  48.  
  49. new szColor[12], szRed[4], szGreen[4], szBlue[4], r, g, b
  50. get_cvar_string("amx_spec_hud_color", szColor, charsmax(szColor))
  51. parse(szColor, szRed, charsmax(szRed), szGreen, charsmax(szGreen), szBlue, charsmax(szBlue))
  52. r = clamp( str_to_num(szRed), 0, 255)
  53. g = clamp( str_to_num(szGreen), 0, 255)
  54. b = clamp( str_to_num(szBlue), 0, 255)
  55. g_dhud_color = b + ( g << 8 ) + ( r << 16 )
  56.  
  57. new iEnt = create_entity("info_target")
  58. if( iEnt )
  59. {
  60. entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + 0.1)
  61. entity_set_string(iEnt, EV_SZ_classname, "_hud_spec")
  62. register_think("_hud_spec", "UpdateSpecHud")
  63. }
  64. else
  65. {
  66. set_task(0.1, "UpdateSpecHud", .flags="b")
  67. }
  68. }
  69.  
  70. public UpdateSpecHud( iEnt )
  71. {
  72. if( iEnt )
  73. {
  74. entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + 0.1)
  75. }
  76. static iAlivePlayers[32], iDeadPlayers[32], iAliveCount, iDeadCount, iAlivePlayer, iDeadPlayer, i
  77. static iAmmo
  78. static bool:bRetrievedValues, szMessage1[128], szMessage2[128], iLen1, iLen2
  79. get_players(iAlivePlayers, iAliveCount, "a")
  80. if( !iAliveCount )
  81. {
  82. return
  83. }
  84. get_players(iDeadPlayers, iDeadCount, "bch")
  85. if( !iDeadCount )
  86. {
  87. return
  88. }
  89.  
  90. for(--iAliveCount; iAliveCount>=0; iAliveCount--)
  91. {
  92. bRetrievedValues = false
  93. iAlivePlayer = iAlivePlayers[iAliveCount]
  94. for(i=0; i<iDeadCount; i++)
  95. {
  96. iDeadPlayer = iDeadPlayers[i]
  97. if( entity_get_int(iDeadPlayer, EV_INT_iuser2) == iAlivePlayer && entity_get_int(iDeadPlayer, EV_INT_iuser1) == FIRST_PERSON_VIEW )
  98. {
  99. if( !bRetrievedValues )
  100. {
  101. iLen1 = 31+ formatex(szMessage1, charsmax(szMessage1), "^t^t^t%3d AP", g_iArmor[iAlivePlayer])
  102. iAmmo = g_iAmmo[iAlivePlayer]
  103. if( iAmmo != -1 )
  104. {
  105. iLen2 = 31 + formatex(
  106. szMessage2, charsmax(szMessage2),
  107. "$ %5d^n%3d|%3d",
  108. g_iMoney[iAlivePlayer], iAmmo, g_iBpAmmo[iAlivePlayer][ g_iWeaponIdToAmmoId[ g_iCurWeapon[iAlivePlayer] ] ]
  109. )
  110. }
  111. else
  112. {
  113. iLen2 = 31 + formatex(szMessage2, charsmax(szMessage2), "$ %5d^n", g_iMoney[iAlivePlayer])
  114. }
  115. bRetrievedValues = true
  116. }
  117.  
  118. __show__dhudmessage(iDeadPlayer, szMessage1, iLen1, _:0.01, _:0.98)
  119. __show__dhudmessage(iDeadPlayer, szMessage2, iLen2, _:0.92, _:0.93)
  120.  
  121. iDeadPlayers[i--] = iDeadPlayers[--iDeadCount]
  122. if( !iDeadCount )
  123. {
  124. return
  125. }
  126. }
  127. }
  128. }
  129. }
  130.  
  131. public Event_Money( id )
  132. {
  133. g_iMoney[id] = read_data(1)
  134. }
  135.  
  136. public Event_CurWeapon(id)
  137. {
  138. g_iCurWeapon[id] = read_data(2)
  139. g_iAmmo[id] = read_data(3)
  140. }
  141.  
  142. public Event_AmmoX(id)
  143. {
  144. g_iBpAmmo[id][read_data(1)] = read_data(2)
  145. }
  146.  
  147.  
  148. public Event_Battery(id)
  149. {
  150. g_iArmor[id] = read_data(1)
  151. }
  152.  
  153. // code extracted from Director Hud Message include file
  154. __show__dhudmessage(id, const szMessage[], iLen, x, y)
  155. {
  156. message_begin( MSG_ONE_UNRELIABLE , SVC_DIRECTOR, .player=id )
  157. {
  158. write_byte( iLen )
  159. write_byte( DRC_CMD_MESSAGE )
  160. write_byte( 0 )
  161. write_long( g_dhud_color )
  162. write_long( x )
  163. write_long( y )
  164. write_long( 0x38D1B717 )
  165. write_long( 0x38D1B717 )
  166. write_long( 0x3DF5C28F )
  167. write_long( 0 )
  168. write_string( szMessage )
  169. }
  170. message_end()
  171. }

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