搜索
查看: 2252|回复: 3

[AMXX 带源码] 我这里有被手雷炸到会弹

[复制链接]
发表于 2010-9-30 18:35:08 | 显示全部楼层 |阅读模式 来自 中国–广西–桂林
我想加入VIP权限 B  不知道能不能 ···求各位大大了!!

本帖子中包含更多资源

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

×
 楼主| 发表于 2010-9-30 20:57:47 | 显示全部楼层 来自 中国–广西–桂林
源码:
  1. /* AMX Mod script.
  2. *
  3. * HE-CONC 1.0
  4. *  by ThantiK
  5. *
  6. *
  7. * Description:
  8. *  Remember CONC jumping in TFC? -- This adds the knockback to the HE 'nades
  9. *  its great to set higher or lower depending on your wants.  But definately
  10. *  adds some spunk to the game.
  11. *  
  12. * Commands:
  13. *  CVAR - he_push, set higher or lower depending on the effect you want.
  14. *
  15. * Special Thanks:
  16. *  JGHG for the help with setting velocity, and for the code on getting HE coords.
  17. *  Ryan (War3 Expansion guy) for the mathematics and velocity stocks.
  18. */

  19. #include <amxmodx>
  20. #include <amxmisc>
  21. #include <engine>

  22. #define SPEED 800.0

  23. public plugin_init() {
  24.     register_plugin("HE Knockback", "1.0", "ThantiK")
  25.     register_event("Damage", "hedamage_event", "b", "2!0", "4!0", "5!0", "6!0")
  26.     register_cvar("he_push","20.0")
  27. }

  28. stock get_velocity_from_origin( ent, Float:fOrigin[3], Float:fSpeed, Float:fVelocity[3] )
  29. {
  30.     new Float:fEntOrigin[3];
  31.     entity_get_vector( ent, EV_VEC_origin, fEntOrigin );

  32.     // Velocity = Distance / Time

  33.     new Float:fDistance[3];
  34.     fDistance[0] = fEntOrigin[0] - fOrigin[0];
  35.     fDistance[1] = fEntOrigin[1] - fOrigin[1];
  36.     fDistance[2] = fEntOrigin[2] - fOrigin[2];

  37.     new Float:fTime = ( vector_distance( fEntOrigin,fOrigin ) / fSpeed );

  38.     fVelocity[0] = fDistance[0] / fTime;
  39.     fVelocity[1] = fDistance[1] / fTime;
  40.     fVelocity[2] = fDistance[2] / fTime;

  41.     return ( fVelocity[0] && fVelocity[1] && fVelocity[2] );
  42. }


  43. // Sets velocity of an entity (ent) away from origin with speed (speed)

  44. stock set_velocity_from_origin( ent, Float:fOrigin[3], Float:fSpeed )
  45. {
  46.     new Float:fVelocity[3];
  47.     get_velocity_from_origin( ent, fOrigin, fSpeed, fVelocity )

  48.     entity_set_vector( ent, EV_VEC_velocity, fVelocity );

  49.     return ( 1 );
  50. }

  51. public hedamage_event(id) {
  52.     if(!is_user_connected(id))
  53.        return PLUGIN_CONTINUE
  54.     new MAXPLAYERS
  55.     MAXPLAYERS = get_maxplayers()

  56.     new inflictor = entity_get_edict(id, EV_ENT_dmg_inflictor)
  57.     if (inflictor <= MAXPLAYERS)
  58.         return PLUGIN_CONTINUE
  59.     if(!is_valid_ent(inflictor))
  60.        return PLUGIN_CONTINUE
  61.     new classname2[8]
  62.     entity_get_string(inflictor, EV_SZ_classname, classname2, 7)
  63.     if (!equal(classname2, "grenade"))
  64.         return PLUGIN_CONTINUE

  65.     new Float:upVector[3]
  66.     upVector[0] = float(read_data(4))
  67.     upVector[1] = float(read_data(5))
  68.     upVector[2] = float(read_data(6))

  69.     new damagerept = read_data(2)
  70.     set_velocity_from_origin(id, upVector, get_cvar_float("he_push")*damagerept)

  71.     return PLUGIN_CONTINUE
  72. }

复制代码
回复

使用道具 举报

 楼主| 发表于 2010-9-30 20:58:40 | 显示全部楼层 来自 中国–广西–桂林
请帮忙加速个权限谢谢了!!!!!!!!!
回复

使用道具 举报

发表于 2011-4-2 17:55:01 | 显示全部楼层 来自 中国–湖南–邵阳
收藏了 3q
回复

使用道具 举报

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

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