HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2. #include <cstrike>
  3. #include <engine>
  4. #include <csx>
  5. #include <xs>
  6.  
  7. #define MAX_PLAYERS 32
  8.  
  9. new DEFUSING_SOUND[] = "weapons/c4_click.wav"
  10.  
  11. new g_NumberID = 0
  12. new g_iRandomNumbers[11]
  13.  
  14. new g_Defusing[MAX_PLAYERS+1]
  15. new Float:g_fDelay[MAX_PLAYERS+1]
  16.  
  17. new cvar_restrict, cvar_numbers, cvar_wallplant
  18.  
  19.  
  20. static const PLUGIN_NAME[] = "Silly C4"
  21. static const PLUGIN_AUTHOR[] = "Cheap_Suit"
  22. static const PLUGIN_VERSION[] = "1.1"
  23.  
  24. public plugin_init()
  25. {
  26. register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
  27. register_cvar(PLUGIN_NAME, PLUGIN_VERSION, FCVAR_SPONLY|FCVAR_SERVER)
  28. register_event("BarTime", "Event_BarTime", "b", "1=0")
  29.  
  30. cvar_numbers = register_cvar("amx_sc_rannumber", "1")
  31. cvar_restrict = register_cvar("amx_sc_removeres", "1")
  32. cvar_wallplant = register_cvar("amx_sc_wallplant", "1")
  33. }
  34.  
  35. public plugin_precache()
  36. precache_sound(DEFUSING_SOUND)
  37.  
  38. public Event_BarTime(id) if(g_Defusing[id])
  39. {
  40. g_NumberID = 0
  41. g_Defusing[id] = 0
  42. }
  43.  
  44. public bomb_defused(id)
  45. {
  46. g_NumberID = 0
  47. g_Defusing[id] = 0
  48. }
  49.  
  50. public bomb_defusing(id)
  51. {
  52. if(get_pcvar_num(cvar_restrict))
  53. entity_set_float(id, EV_FL_maxspeed, 240.0)
  54.  
  55. g_Defusing[id] = 1
  56. }
  57.  
  58. public bomb_planting(id) if(get_pcvar_num(cvar_restrict))
  59. entity_set_float(id, EV_FL_maxspeed, 240.0)
  60.  
  61. public bomb_planted(id)
  62. {
  63. if(!get_pcvar_num(cvar_wallplant))
  64. return
  65.  
  66. g_NumberID = 0
  67. for(new i = 0; i < 11; ++i)
  68. g_iRandomNumbers[i] = rn()
  69.  
  70. new Float:fOrigin[3]
  71. entity_get_vector(id, EV_VEC_origin, fOrigin)
  72.  
  73. new Float:fVelocity[3]
  74. VelocityByAim(id, 54, fVelocity)
  75.  
  76. if(fVelocity[2] < -28.0)
  77. return
  78.  
  79. new Float:fTraceEnd[3]
  80. xs_vec_add(fVelocity, fOrigin, fTraceEnd)
  81.  
  82. new Float:fTraceResult[3]
  83. trace_line(id, fOrigin, fTraceEnd, fTraceResult)
  84.  
  85. new Float:fNormal[3]
  86. if(trace_normal(id, fOrigin, fTraceEnd, fNormal) < 1)
  87. return
  88.  
  89. new c4 = -1
  90. while((c4 = find_ent_by_model(c4, "grenade", "models/w_c4.mdl")))
  91. {
  92. if(entity_get_int(c4, EV_INT_movetype) == MOVETYPE_FLY
  93. || (get_entity_flags(c4) & FL_ONGROUND))
  94. continue
  95.  
  96. entity_set_int(c4, EV_INT_movetype, MOVETYPE_FLY)
  97.  
  98. new Float:fNewOrigin[3]
  99. fNewOrigin[0] = fTraceResult[0] + (fNormal[0] * -0.01)
  100. fNewOrigin[1] = fTraceResult[1] + (fNormal[1] * -0.01)
  101. fNewOrigin[2] = fTraceResult[2] + fNormal[2] + 8.000
  102.  
  103. entity_set_origin(c4, fNewOrigin)
  104.  
  105. new Float:fAngles[3]
  106. vector_to_angle(fNormal, fAngles)
  107. fAngles[0] -= 180.0, fAngles[1] -= 90.0, fAngles[2] -= 90.0
  108. entity_set_vector(c4, EV_VEC_angles, fAngles)
  109. }
  110. }
  111.  
  112. public client_PreThink(id)
  113. {
  114. if(!get_pcvar_num(cvar_numbers) || !is_user_alive(id) || !g_Defusing[id])
  115. return PLUGIN_CONTINUE
  116.  
  117. if(g_fDelay[id] + get_delay(id) < get_gametime())
  118. {
  119. g_NumberID += 1
  120. client_cmd(id, "spk %s", DEFUSING_SOUND)
  121. g_fDelay[id] = get_gametime()
  122. }
  123.  
  124. set_hudmessage(255, 255, 255, -1.0, 0.4, 0, 0.0, 10.0, 0.0, 0.0, 2)
  125. switch(g_NumberID)
  126. {
  127. case 1: show_hudmessage(id, "%d%d%d%d%d%d%d%d%d%d%d", n(0), rn(), rn(), rn(), rn(), rn(), rn(), rn(), rn(), rn(), rn())
  128. case 2: show_hudmessage(id, "%d%d%d%d%d%d%d%d%d%d%d", n(0), n(1), rn(), rn(), rn(), rn(), rn(), rn(), rn(), rn(), rn())
  129. case 3: show_hudmessage(id, "%d%d%d%d%d%d%d%d%d%d%d", n(0), n(1), n(2), rn(), rn(), rn(), rn(), rn(), rn(), rn(), rn())
  130. case 4: show_hudmessage(id, "%d%d%d%d%d%d%d%d%d%d%d", n(0), n(1), n(2), n(3), rn(), rn(), rn(), rn(), rn(), rn(), rn())
  131. case 5: show_hudmessage(id, "%d%d%d%d%d%d%d%d%d%d%d", n(0), n(1), n(2), n(3), n(4), rn(), rn(), rn(), rn(), rn(), rn())
  132. case 6: show_hudmessage(id, "%d%d%d%d%d%d%d%d%d%d%d", n(0), n(1), n(2), n(3), n(4), n(5), rn(), rn(), rn(), rn(), rn())
  133. case 7: show_hudmessage(id, "%d%d%d%d%d%d%d%d%d%d%d", n(0), n(1), n(2), n(3), n(4), n(5), n(6), rn(), rn(), rn(), rn())
  134. case 8: show_hudmessage(id, "%d%d%d%d%d%d%d%d%d%d%d", n(0), n(1), n(2), n(3), n(4), n(5), n(6), n(7), rn(), rn(), rn())
  135. case 9: show_hudmessage(id, "%d%d%d%d%d%d%d%d%d%d%d", n(0), n(1), n(2), n(3), n(4), n(5), n(6), n(7), n(8), rn(), rn())
  136. case 10:show_hudmessage(id, "%d%d%d%d%d%d%d%d%d%d%d", n(0), n(1), n(2), n(3), n(4), n(5), n(6), n(7), n(8), n(9), rn())
  137. case 11:show_hudmessage(id, "%d%d%d%d%d%d%d%d%d%d%d", n(0), n(1), n(2), n(3), n(4), n(5), n(6), n(7), n(8), n(9),n(10))
  138. default:show_hudmessage(id, "%d%d%d%d%d%d%d%d%d%d%d", n(0), n(1), n(2), n(3), n(4), n(5), n(6), n(7), n(8), n(9),n(10))
  139. }
  140. return PLUGIN_CONTINUE
  141. }
  142.  
  143. stock rn() return random_num(0, 9)
  144. stock n(value) return g_iRandomNumbers[value]
  145. stock Float:get_delay(id) return cs_get_user_defuse(id) ? 0.4999 : 0.9999
  146. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  147. *{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0\\ deflang1033{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
  148. *