hlmod.hu
https://hlmod.hu/

bomba lerakása magátol
https://hlmod.hu/viewtopic.php?f=9&t=8522
Oldal: 1 / 1

Szerző:  Pele [2013.05.16. 21:17 ]
Hozzászólás témája:  bomba lerakása magátol

Sziasztok.
Egy olyan kérdéssel fordulok hozzátok hogy meg-e lehet oldani hogy a BOMBÁT ne a T -nek kelljen lerakni hanem magátol lerakja és pl 35 (amenyire be van alitva) felrobban és vége a körnek?

Szerző:  crazy` [2013.05.16. 21:20 ]
Hozzászólás témája:  Re: bomba lerakása magátol

SMA Forráskód: [ Mindet kijelol ]
  1. /* Formatright © 2011, 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 <fakemeta>
  20. #include <hamsandwich>
  21.  
  22. #define VERSION "0.0.1"
  23. #define PLUGIN "Auto Plant Bomb At Round Start"
  24.  
  25. // "player" offsets
  26. #define m_iUserState 193 // don't name this offset OFFSET_DEFUSE_PLANT since (1<<0) is wheter player wants or not to hear radios
  27. const hasC4 = (1<<8)
  28. #define m_fClientMapZone 235 // m_fMapZone ??
  29. #define m_rgpPlayerItems_Slot5 372
  30. #define m_pActiveItem 373
  31.  
  32. // "weapon_***" offsets
  33. #define XO_WEAPON 4
  34. // "weapon_c4" specific offsets
  35. #define m_fBombState 78
  36. const C4_STARTED_ARMING = 1<<0
  37.  
  38. new Array:g_aBombSites, g_iSitesCount
  39. new bool:g_bPlanted
  40.  
  41. public plugin_init()
  42. {
  43. register_plugin(PLUGIN, VERSION, "ConnorMcLeod")
  44.  
  45. static const CLASSNAME[] = "classname"
  46. new ent = FM_NULLENT, Float:origin[3]
  47. while( ( ent = engfunc(EngFunc_FindEntityByString, ent, CLASSNAME, "func_bomb_target") ) )
  48. {
  49. if( !g_aBombSites )
  50. {
  51. g_aBombSites = ArrayCreate(3, 2)
  52. }
  53. fm_get_brush_entity_origin(ent, origin)
  54. ArrayPushArray(g_aBombSites, origin)
  55. }
  56. ent = FM_NULLENT
  57. while( ( ent = engfunc(EngFunc_FindEntityByString, ent, CLASSNAME, "info_bomb_target") ) )
  58. {
  59. if( !g_aBombSites )
  60. {
  61. g_aBombSites = ArrayCreate(3, 2)
  62. }
  63. fm_get_brush_entity_origin(ent, origin)
  64. ArrayPushArray(g_aBombSites, origin)
  65. }
  66. if( g_aBombSites )
  67. {
  68. register_event("HLTV", "Event_HLTV_New_Round", "a", "1=0", "2=0")
  69. register_logevent("LogEvent_Spawned_With_The_Bomb", 3, "2=Spawned_With_The_Bomb")
  70. register_logevent("LogEvent_Planted_The_Bomb", 3, "2=Planted_The_Bomb")
  71. g_iSitesCount = ArraySize( g_aBombSites )
  72. }
  73. }
  74.  
  75. public LogEvent_Planted_The_Bomb()
  76. {
  77. g_bPlanted = true
  78. }
  79.  
  80. public Event_HLTV_New_Round()
  81. {
  82. g_bPlanted = false
  83. }
  84.  
  85. public LogEvent_Spawned_With_The_Bomb()
  86. {
  87. new szLogUser[80], szName[32]
  88. read_logargv(0, szLogUser, charsmax(szLogUser))
  89. parse_loguser(szLogUser, szName, charsmax(szName))
  90.  
  91. new id = get_user_index(szName)
  92. if( is_user_alive(id) )
  93. {
  94. new c4 = get_pdata_cbase(id, m_rgpPlayerItems_Slot5)
  95. if( c4 > 0 )
  96. {
  97. if( !g_bPlanted )
  98. {
  99. new flags = pev(id, pev_flags)
  100. set_pev(id, pev_flags, flags | FL_ONGROUND)
  101.  
  102. set_pdata_int(id, m_fClientMapZone, get_pdata_int(id, m_fClientMapZone) | (1<<1))
  103.  
  104. set_pdata_int(c4, m_fBombState, get_pdata_int(c4, m_fBombState, XO_WEAPON) | C4_STARTED_ARMING, XO_WEAPON)
  105.  
  106. new Float:origin[3], Float:siteOrigin[3]
  107. pev(id, pev_origin, origin)
  108. ArrayGetArray(g_aBombSites, random(g_iSitesCount), siteOrigin)
  109. set_pev(id, pev_origin, siteOrigin)
  110.  
  111. ExecuteHam(Ham_Weapon_PrimaryAttack, c4)
  112.  
  113. set_pev(id, pev_origin, origin)
  114. set_pev(id, pev_flags, flags)
  115. }
  116. else
  117. {
  118. if( get_pdata_cbase(id, m_pActiveItem) == c4 )
  119. {
  120. ExecuteHam(Ham_Weapon_RetireWeapon, c4)
  121. }
  122. if( ExecuteHam(Ham_RemovePlayerItem, id, c4) )
  123. {
  124. user_has_weapon(id, CSW_C4, 0)
  125. ExecuteHam(Ham_Item_Kill, c4)
  126. set_pev(id, pev_body, 0)
  127. set_pdata_int(id, m_iUserState, get_pdata_int(id, m_iUserState) & ~hasC4)
  128. }
  129. }
  130. }
  131. }
  132. }
  133.  
  134. fm_get_brush_entity_origin(index, Float:origin[3]) {
  135. new Float:mins[3], Float:maxs[3];
  136.  
  137. pev(index, pev_origin, origin); // this needed ???
  138. pev(index, pev_mins, mins);
  139. pev(index, pev_maxs, maxs);
  140.  
  141. origin[0] += (mins[0] + maxs[0]) * 0.5;
  142. origin[1] += (mins[1] + maxs[1]) * 0.5;
  143. origin[2] += (mins[2] + maxs[2]) * 0.5;
  144.  
  145. return 1;
  146. }

Szerző:  Pele [2013.05.16. 21:23 ]
Hozzászólás témája:  Re: bomba lerakása magátol

asszem mégis megérdemled a superadmint :)

Köszi :)

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