搜索
查看: 11043|回复: 13

[AMXX 无源码] 【插件分享】仿真手雷插件(转自Moddev)

[复制链接]
发表于 2011-12-18 07:00:41 | 显示全部楼层 |阅读模式 来自 中国–湖南–长沙
别看这插件功能小,也是花了点心血的.以前CS的手雷爆炸效果,是一张NC的SPR.如果俯视的话就更悲剧.所以我把爆炸的效果和谐掉,再制作一个新的爆炸效果.不只是一张SPR那么简单了,爆炸时附近地面产生震动,然后会有烟.爆炸时在空中和地面的爆炸效果都不一样,在地面爆炸,手雷周围会有滚滚灰尘.还会飞出一些碎片和碎石(这些可是MDL不是SPR).立体感非常足,带震撼的感觉(起码比原版的好),尽管把威力改成原来的一样,也会感觉比原版的手雷厉害. 这插件的灵感来源与CS零点行动的单人任务版里面的手雷(它那效果灰长好)
在伤害方面也做了点修改,爆炸时会有击退,被炸中屏幕会瞬间变红,屏幕震动.爆炸伤害和手雷爆炸范围,还有手雷爆炸时间,都能自己设置.

使用方法
直接覆盖到CS里
以下是属性命令,在控制台输入或保存在cstrike\addons\amxmodx\configs的amxx.cfg里即可
grenade_explode_time 2.0 //手雷爆炸的时间
grenade_explode_damagerange 350.0 //手雷爆炸的影响范围
grenade_explode_damage 2.0 //手雷爆炸的伤害倍数(原来的伤害*伤害倍数)
grenade_explode_knock 500.0 //手雷爆炸的击退
grenade_explode_shakerange 700.0 //手雷爆炸引起震动的范围
grenade_explode_punchagele 30.0 //被手雷伤害时的屏幕震动幅度
grenade_explode_hitshowred 1 //被手雷炸中是否红屏
grenade_explode_mdltime 5 //爆炸碎片存在的时间(秒)

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注个册吧

×
 楼主| 发表于 2011-12-18 07:01:31 | 显示全部楼层 来自 中国–湖南–长沙
就是 没源码   可惜
回复

使用道具 举报

 楼主| 发表于 2011-12-18 07:33:21 | 显示全部楼层 来自 中国–湖南–长沙
鄙视 只看帖  不回帖
回复

使用道具 举报

发表于 2011-12-18 15:32:31 | 显示全部楼层 来自 中国–内蒙古–呼和浩特
1# 673734294


谢谢分享!只是可惜没有源码
回复

使用道具 举报

发表于 2011-12-18 21:52:28 | 显示全部楼层 来自 中国–上海–上海
可惜没源码··
回复

使用道具 举报

发表于 2011-12-19 12:12:35 | 显示全部楼层 来自 中国–河南–郑州
顶一个、、、
回复

使用道具 举报

发表于 2011-12-21 17:17:35 | 显示全部楼层 来自 中国–广东–广州
6# 小猫咪


没源码吗.......我这有一个
作者:DS小弟弟
使用方法
直接覆盖到CS里
以下是属性命令,在控制台输入或保存在cstrike\addons\amxmodx\configs的amxx.cfg里即可
grenade_explode_time 2.0  //手雷爆炸的时间
grenade_explode_damagerange 350.0 //手雷爆炸的影响范围
grenade_explode_damage 2.0  //手雷爆炸的伤害倍数(原来的伤害*伤害倍数)
grenade_explode_knock 500.0  //手雷爆炸的击退
grenade_explode_shakerange 700.0 //手雷爆炸引起震动的范围
grenade_explode_punchagele 30.0  //被手雷伤害时的屏幕震动幅度
grenade_explode_hitshowred 1   //被手雷炸中是否红屏
grenade_explode_mdltime 5  //爆炸碎片存在的时间(秒)
  1. 02.#include <amxmodx>

  2. 03.#include <fakemeta>

  3. 04.#include <hamsandwich>

  4. 05.#define PLUGIN "Heexplode"

  5. 06.#define VERSION "1.0"

  6. 07.#define AUTHOR "DSHGFHDS"

  7. 08.#define HEEXPLODE 13679

  8. 09.#define HESHOWSPR 19752

  9. 10.#define MDLCOUNT 24 //爆炸碎片的数量

  10. 11.new const breakmodels[3][] = {"models/gibs_wallbrown.mdl", "models/gibs_woodplank.mdl", "models/gibs_brickred.mdl"}

  11. 12.new szbreakmodels[3]

  12. 13.new g_smokeSpr, g_smokeSpr2, grenadeexplodespr, g_lightspr

  13. 14.new cvar_damagerange, cvar_grenadetime, cvar_damage, cvar_knock, cvar_shakerange, cvar_punchagele, cvar_hitshowred, cvar_mdltime

  14. 15.new g_fwBotForwardRegister

  15. 16.const DMG_HEGRENADE = (1<<24)

  16. 17.public plugin_init()

  17. 18.{

  18. 19.register_plugin(PLUGIN, VERSION, AUTHOR)

  19. 20.register_forward(FM_SetModel, "fw_SetModel")

  20. 21.register_forward(FM_FindEntityInSphere, "fw_FindEntityInSphere")

  21. 22.register_message(SVC_TEMPENTITY, "Message_SVC_TEMP")

  22. 23.RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")

  23. 24.g_fwBotForwardRegister = register_forward(FM_PlayerPostThink, "fw_BotForwardRegister_Post", 1)

  24. 25.cvar_grenadetime = register_cvar("grenade_explode_time", "2.0") //手雷爆炸的时间

  25. 26.cvar_damagerange = register_cvar("grenade_explode_damagerange", "350.0") //手雷爆炸的影响范围

  26. 27.cvar_damage = register_cvar("grenade_explode_damage", "2.0") //手雷爆炸的伤害倍数(原来的伤害*伤害倍数)

  27. 28.cvar_knock = register_cvar("grenade_explode_knock", "500.0") //手雷爆炸的击退

  28. 29.cvar_shakerange = register_cvar("grenade_explode_shakerange", "700.0") //手雷爆炸引起震动的范围

  29. 30.cvar_punchagele = register_cvar("grenade_explode_punchagele", "30.0") //被手雷伤害时的屏幕震动幅度

  30. 31.cvar_hitshowred = register_cvar("grenade_explode_hitshowred", "1") //被炸中是否红屏

  31. 32.cvar_mdltime = register_cvar("grenade_explode_mdltime", "5") //爆炸碎片存在的时间(秒)

  32. 33.}

  33. 34.public plugin_precache()

  34. 35.{

  35. 36.g_smokeSpr = engfunc(EngFunc_PrecacheModel,"sprites/gas_smoke1.spr")

  36. 37.g_smokeSpr2 = engfunc(EngFunc_PrecacheModel,"sprites/exsmoke.spr")

  37. 38.g_lightspr = engfunc(EngFunc_PrecacheModel,"sprites/xflare1.spr")

  38. 39.grenadeexplodespr = engfunc(EngFunc_PrecacheModel,"sprites/zerog-frag1.spr")

  39. 40.for(new i = 0; i < sizeof breakmodels; i++) szbreakmodels[i] = engfunc(EngFunc_PrecacheModel,breakmodels[i])

  40. 41.}

  41. 42.public Message_SVC_TEMP(messageId, messageType, messageEntity)

  42. 43.{

  43. 44.if(messageType == MSG_PAS && get_msg_arg_int(1) == TE_EXPLOSION && get_msg_arg_int(6) == 25)

  44. 45.{

  45. 46.set_msg_arg_int(1, ARG_BYTE, 0)

  46. 47.set_pev(messageEntity, pev_iuser2, HESHOWSPR)

  47. 48.}

  48. 49.if(messageType == MSG_PVS && get_msg_arg_int(1) == TE_SMOKE && pev(messageEntity, pev_iuser2) == HESHOWSPR)

  49. 50.{

  50. 51.set_msg_arg_int(5, ARG_SHORT, 0)

  51. 52.set_pev(messageEntity, pev_iuser2, 0)

  52. 53.}

  53. 54.}

  54. 55.public fw_BotForwardRegister_Post(iPlayer)

  55. 56.{

  56. 57.if (is_user_bot(iPlayer))

  57. 58.{

  58. 59.  unregister_forward(FM_PlayerPostThink, g_fwBotForwardRegister, 1)

  59. 60.  RegisterHamFromEntity(Ham_TakeDamage, iPlayer, "fw_TakeDamage")

  60. 61.}

  61. 62.}

  62. 63.public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)

  63. 64.{

  64. 65.if(!is_user_connected(victim))

  65. 66.return HAM_IGNORED

  66. 67.

  67. 68.if(!(damage_type & DMG_HEGRENADE))

  68. 69.return HAM_IGNORED

  69. 70.

  70. 71.SetHamParamFloat(4, damage*get_pcvar_float(cvar_damage))

  71. 72.

  72. 73.new Float:punchangle[3]

  73. 74.pev(victim, pev_punchangle, punchangle)

  74. 75.punchangle[0] +=random_float(-get_pcvar_float(cvar_punchagele),get_pcvar_float(cvar_punchagele))

  75. 76.punchangle[1] +=random_float(-get_pcvar_float(cvar_punchagele),get_pcvar_float(cvar_punchagele))

  76. 77.punchangle[2] +=random_float(-get_pcvar_float(cvar_punchagele),get_pcvar_float(cvar_punchagele))

  77. 78.set_pev(victim, pev_punchangle, punchangle)

  78. 79.if(get_pcvar_num(cvar_hitshowred))

  79. 80.{

  80. 81.message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("ScreenFade"), {0,0,0}, victim)

  81. 82.write_short(1<<12)

  82. 83.write_short(1<<12)

  83. 84.write_short(0x0000)

  84. 85.write_byte(255)

  85. 86.write_byte(20)

  86. 87.write_byte(20)

  87. 88.write_byte(random_num(50, 200))

  88. 89.message_end()

  89. 90.}

  90. 91.return HAM_IGNORED

  91. 92.}

  92. 93.public fw_FindEntityInSphere(iEntity, Float:vecOrigin[3], Float:flRadius)

  93. 94.{

  94. 95.if(get_pcvar_float(cvar_damagerange) <= -1.0 || flRadius != 350.0) return FMRES_IGNORED

  95. 96.

  96. 97.new iResult = engfunc(EngFunc_FindEntityInSphere, iEntity, vecOrigin, get_pcvar_float(cvar_damagerange))

  97. 98.

  98. 99.if(pev(iEntity, pev_iuser1) == HEEXPLODE)

  99. 100.{

  100. 101.engfunc(EngFunc_MessageBegin, MSG_ALL, SVC_TEMPENTITY, vecOrigin, 0)

  101. 102.write_byte(TE_SPRITE)

  102. 103.engfunc(EngFunc_WriteCoord,vecOrigin[0])

  103. 104.engfunc(EngFunc_WriteCoord,vecOrigin[1])

  104. 105.engfunc(EngFunc_WriteCoord,vecOrigin[2])

  105. 106.write_short(g_lightspr)

  106. 107.write_byte(40)

  107. 108.write_byte(100)

  108. 109.message_end()

  109. 110.

  110. 111.engfunc(EngFunc_MessageBegin, MSG_ALL, SVC_TEMPENTITY, vecOrigin, 0)

  111. 112.write_byte(TE_SPRITE)

  112. 113.engfunc(EngFunc_WriteCoord,vecOrigin[0])

  113. 114.engfunc(EngFunc_WriteCoord,vecOrigin[1])

  114. 115.engfunc(EngFunc_WriteCoord,vecOrigin[2])

  115. 116.write_short(grenadeexplodespr)

  116. 117.write_byte(18)

  117. 118.write_byte(255)

  118. 119.message_end()

  119. 120.

  120. 121.engfunc(EngFunc_MessageBegin, MSG_ALL, SVC_TEMPENTITY, vecOrigin, 0)

  121. 122.write_byte(TE_EXPLOSION2)

  122. 123.engfunc(EngFunc_WriteCoord, vecOrigin[0])

  123. 124.engfunc(EngFunc_WriteCoord, vecOrigin[1])

  124. 125.engfunc(EngFunc_WriteCoord, vecOrigin[2])

  125. 126.write_byte(1)

  126. 127.write_byte(10)

  127. 128.message_end()

  128. 129.

  129. 130.engfunc(EngFunc_MessageBegin, MSG_ALL, SVC_TEMPENTITY, vecOrigin, 0)

  130. 131.write_byte(TE_DLIGHT)

  131. 132.engfunc(EngFunc_WriteCoord,vecOrigin[0])

  132. 133.engfunc(EngFunc_WriteCoord,vecOrigin[1])

  133. 134.engfunc(EngFunc_WriteCoord,vecOrigin[2])

  134. 135.write_byte(20)

  135. 136.write_byte(255)

  136. 137.write_byte(128)

  137. 138.write_byte(112)

  138. 139.write_byte(1)

  139. 140.write_byte(0)

  140. 141.message_end()

  141. 142.

  142. 143.for(new i = 1;i<33;i++)

  143. 144.{

  144. 145.new Float:origin[3]

  145. 146.pev(i, pev_origin, origin)

  146. 147.new Float:range = get_distance_f(origin, vecOrigin)

  147. 148.if(range < get_pcvar_float(cvar_damagerange))

  148. 149.{
  149. 296.}
复制代码
回复

使用道具 举报

发表于 2011-12-21 17:18:42 | 显示全部楼层 来自 中国–广东–广州
7# 点通粉丝
  1. 148.if(range < get_pcvar_float(cvar_damagerange))

  2. 149.{

  3. 150.new Float:explodeknock = get_pcvar_float(cvar_knock)*(get_pcvar_float(cvar_damagerange)-range)/get_pcvar_float(cvar_damagerange)

  4. 151.set_velocity_from_origin(i, vecOrigin, explodeknock)

  5. 152.}

  6. 153.if(range <= get_pcvar_float(cvar_shakerange) && is_user_alive(i))

  7. 154.{

  8. 155.message_begin(MSG_ONE,get_user_msgid("ScreenShake"),{0,0,0},i)

  9. 156.write_short(1<<12)

  10. 157.write_short(1<<12)

  11. 158.write_short(1<<12)

  12. 159.message_end()

  13. 160.}

  14. 161.}

  15. 162.

  16. 163.makesmoke(iEntity, vecOrigin)

  17. 164.set_pev(iEntity, pev_iuser1, 0)

  18. 165.}

  19. 166.forward_return(FMV_CELL, iResult)

  20. 167.

  21. 168.return FMRES_SUPERCEDE

  22. 169.}

  23. 170.public fw_SetModel(iEntity, szModel[])

  24. 171.{

  25. 172.if(strlen(szModel) < 8)

  26. 173.return FMRES_IGNORED

  27. 174.

  28. 175.if(szModel[7] != 'w' || szModel[8] != '_')

  29. 176.return FMRES_IGNORED

  30. 177.

  31. 178.if(szModel[9] == 'h' && szModel[10] == 'e')

  32. 179.{

  33. 180.new Float:dmgtime

  34. 181.pev(iEntity, pev_dmgtime, dmgtime)

  35. 182.set_pev(iEntity, pev_dmgtime, get_gametime()+get_pcvar_float(cvar_grenadetime))

  36. 183.set_pev(iEntity, pev_iuser1, HEEXPLODE)

  37. 184.}

  38. 185.

  39. 186.return FMRES_IGNORED

  40. 187.}

  41. 188.public makesmoke(iEntity, Float:position[3])

  42. 189.{

  43. 190.new Float:origin[8][3], Float:iorigin[12][3], Float:iposition[3]

  44. 191.

  45. 192.if(pev(iEntity, pev_flags) & FL_ONGROUND)

  46. 193.{

  47. 194.iposition[0]=position[0]

  48. 195.iposition[1]=position[1]

  49. 196.iposition[2]=position[2]

  50. 197.get_spherical_coord(iposition, 40.0, 0.0, -15.0, iorigin[0])

  51. 198.get_spherical_coord(iposition, 40.0, 90.0, -15.0, iorigin[1])

  52. 199.get_spherical_coord(iposition, 40.0, 180.0, -15.0, iorigin[2])

  53. 200.get_spherical_coord(iposition, 40.0, 270.0, -15.0, iorigin[3])

  54. 201.get_spherical_coord(iposition, 100.0, 0.0, -15.0, iorigin[4])

  55. 202.get_spherical_coord(iposition, 100.0, 45.0, -15.0, iorigin[5])

  56. 203.get_spherical_coord(iposition, 100.0, 90.0, -15.0, iorigin[6])

  57. 204.get_spherical_coord(iposition, 100.0, 135.0, -15.0, iorigin[7])

  58. 205.get_spherical_coord(iposition, 100.0, 180.0, -15.0, iorigin[8])

  59. 206.get_spherical_coord(iposition, 100.0, 225.0, -15.0, iorigin[9])

  60. 207.get_spherical_coord(iposition, 100.0, 270.0, -15.0, iorigin[10])

  61. 208.get_spherical_coord(iposition, 100.0, 315.0, -15.0, iorigin[11])

  62. 209.for(new i = 0; i < MDLCOUNT; i++)

  63. 210.{

  64. 211.new Float:velocity[MDLCOUNT][3]

  65. 212.velocity[i][0] = random_float(-500.0,500.0)

  66. 213.velocity[i][1] = random_float(-500.0,500.0)

  67. 214.velocity[i][2] = random_float(-300.0,300.0)

  68. 215.makebreakmodels(position, 1.0, 1.0, 1.0, velocity[i][0], velocity[i][1], velocity[i][2], szbreakmodels[random_num(0, sizeof szbreakmodels-1)], 1, get_pcvar_num(cvar_mdltime))

  69. 216.}

  70. 217.for(new e = 0; e < 12; e++) make_smoke(iorigin[e], g_smokeSpr2, 16, 100)

  71. 218.position[2]+=120.0

  72. 219.}

  73. 220.get_spherical_coord(position, 0.0, 0.0, 135.0, origin[0])

  74. 221.get_spherical_coord(position, 0.0, 80.0, 80.0, origin[1])

  75. 222.get_spherical_coord(position, 41.0, 43.0, 60.0, origin[2])

  76. 223.get_spherical_coord(position, 90.0, 90.0, 40.0, origin[3])

  77. 224.get_spherical_coord(position, 80.0, 25.0, 135.0, origin[4])

  78. 225.get_spherical_coord(position, 101.0, 100.0, 112.0, origin[5])

  79. 226.get_spherical_coord(position, 68.0, 35.0, 139.0, origin[6])

  80. 227.get_spherical_coord(position, 0.0, 95.0, 105.0, origin[7])

  81. 228.

  82. 229.for(new c = 0; c < 8; c++) make_smoke(origin[c], g_smokeSpr, 40, 30)

  83. 230.}

  84. 231.stock make_smoke(Float:position[3], sprite_index, size, light)

  85. 232.{

  86. 233.engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, position, 0)

  87. 234.write_byte(TE_SPRITE)

  88. 235.engfunc(EngFunc_WriteCoord, position[0])

  89. 236.engfunc(EngFunc_WriteCoord, position[1])

  90. 237.engfunc(EngFunc_WriteCoord, position[2])

  91. 238.write_short(sprite_index)

  92. 239.write_byte(size)

  93. 240.write_byte(light)

  94. 241.message_end()

  95. 242.}

  96. 243.stock makebreakmodels(Float:vecOrigin[3], Float:sizex, Float:sizey, Float:sizez, Float:velocityx, Float:velocityy, Float:velocityz, const models_index, count, livetime)

  97. 244.{

  98. 245.engfunc(EngFunc_MessageBegin, MSG_ALL, SVC_TEMPENTITY, vecOrigin, 0)

  99. 246.write_byte(TE_BREAKMODEL)

  100. 247.engfunc(EngFunc_WriteCoord, vecOrigin[0])

  101. 248.engfunc(EngFunc_WriteCoord, vecOrigin[1])

  102. 249.engfunc(EngFunc_WriteCoord, vecOrigin[2])

  103. 250.engfunc(EngFunc_WriteCoord, sizex)

  104. 251.engfunc(EngFunc_WriteCoord, sizey)

  105. 252.engfunc(EngFunc_WriteCoord, sizez)

  106. 253.engfunc(EngFunc_WriteCoord, velocityx)

  107. 254.engfunc(EngFunc_WriteCoord, velocityy)

  108. 255.engfunc(EngFunc_WriteCoord, velocityz)

  109. 256.write_byte(10)

  110. 257.write_short(models_index)

  111. 258.write_byte(count)

  112. 259.write_byte(livetime*10)

  113. 260.write_byte(0x40)

  114. 261.message_end()

  115. 262.}

  116. 263.stock get_velocity_from_origin( ent, Float:fOrigin[3], Float:fSpeed, Float:fVelocity[3] )

  117. 264.{

  118. 265.new Float:fEntOrigin[3]

  119. 266.pev( ent, pev_origin, fEntOrigin )

  120. 267.

  121. 268.new Float:fDistance[3]

  122. 269.fDistance[0] = fEntOrigin[0] - fOrigin[0]

  123. 270.fDistance[1] = fEntOrigin[1] - fOrigin[1]

  124. 271.fDistance[2] = fEntOrigin[2] - fOrigin[2]

  125. 272.

  126. 273.new Float:fTime = ( vector_distance( fEntOrigin,fOrigin ) / fSpeed )

  127. 274.

  128. 275.fVelocity[0] = fDistance[0] / fTime

  129. 276.fVelocity[1] = fDistance[1] / fTime

  130. 277.fVelocity[2] = fDistance[2] / fTime

  131. 278.

  132. 279.return ( fVelocity[0] && fVelocity[1] && fVelocity[2] )

  133. 280.}

  134. 281.stock set_velocity_from_origin(ent, Float:fOrigin[3], Float:fSpeed)

  135. 282.{

  136. 283.new Float:fVelocity[3]

  137. 284.get_velocity_from_origin(ent,fOrigin,fSpeed,fVelocity)

  138. 285.fVelocity[2]/=2

  139. 286.set_pev(ent,pev_velocity,fVelocity)

  140. 287.return 1

  141. 288.}

  142. 289.stock get_spherical_coord(const Float:ent_origin[3], Float:redius, Float:level_angle, Float:vertical_angle, Float:origin[3])

  143. 290.{

  144. 291.new Float:length

  145. 292.length=redius*floatcos(vertical_angle, degrees)

  146. 293.origin[0]=ent_origin[0]+length*floatcos(level_angle,degrees)

  147. 294.origin[1]=ent_origin[1]+length*floatsin(level_angle,degrees)

  148. 295.origin[2]=ent_origin[2]+redius*floatsin(vertical_angle,degrees)

  149. 296.}
复制代码
回复

使用道具 举报

 楼主| 发表于 2012-1-23 14:35:13 | 显示全部楼层 来自 中国–湖南–长沙
;P 谢谢
回复

使用道具 举报

 楼主| 发表于 2012-2-3 14:04:41 | 显示全部楼层 来自 中国–湖南–长沙
源码 来了
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表