搜索
查看: 5073|回复: 11

如何如何设没攻击力 但有效果

[复制链接]
发表于 2011-3-13 17:02:20 | 显示全部楼层 |阅读模式 来自 香港
  1. //#define USE_AMX

  2. #if defined USE_AMX
  3. #include <amxmod>
  4. #include <VexdUM>
  5. #else
  6. #include <amxmodx>
  7. #include <engine>
  8. #endif

  9. new gMsgScreenShake , gMsgScreenFade;

  10. #define CVAR_STATUS "he_damage_effect"

  11. public plugin_init() {
  12.   register_plugin("HE damage effect" , "0.2" , "v3x");
  13.   register_event("Damage" , "event_Damage" , "b" , "2>0");
  14.   register_cvar(CVAR_STATUS , "1");
  15.   gMsgScreenShake = get_user_msgid("ScreenShake");
  16.   gMsgScreenFade = get_user_msgid("ScreenFade");
  17. }

  18. #if defined USE_AMX
  19. #define DEFAULT_VOLUME 0.8
  20. #endif

  21. #define PA_LOW  25.0
  22. #define PA_HIGH 50.0

  23. #if !defined USE_AMX
  24. new Float:gVolume[33];

  25. public client_connect(id) {
  26.   if(!is_user_bot(id)) {
  27.     query_client_cvar(id , "volume" , "cvar_result");
  28.   }
  29. }

  30. public cvar_result(id, const cvar[] , const value[]) {
  31.   gVolume[id] = str_to_float(value);
  32. }
  33. #endif

  34. public event_Damage(id) {
  35.   if(get_cvar_num(CVAR_STATUS) <= 0
  36.   || !is_user_connected(id)
  37.   || !is_user_alive(id)
  38.   || is_user_bot(id)) return;
  39.   new iWeapID, attacker = get_user_attacker(id , iWeapID);
  40.   if(!is_user_connected(attacker)) return;
  41.   if(iWeapID == 4) {
  42.     client_cmd(id , "volume 0");
  43.     set_task(0.5 , "volume_up_1" , id);
  44.     new Float:fVec[3];
  45.     fVec[0] = random_float(PA_LOW , PA_HIGH);
  46.     fVec[1] = random_float(PA_LOW , PA_HIGH);
  47.     fVec[2] = random_float(PA_LOW , PA_HIGH);
  48.     entity_set_vector(id , EV_VEC_punchangle , fVec);
  49.     message_begin(MSG_ONE , gMsgScreenShake , {0,0,0} ,id)
  50.     write_short( 1<<14 );
  51.     write_short( 1<<14 );
  52.     write_short( 1<<14 );
  53.     message_end();

  54.     message_begin(MSG_ONE_UNRELIABLE , gMsgScreenFade , {0,0,0} , id);
  55.     write_short( 1<<10 );
  56.     write_short( 1<<10 );
  57.     write_short( 1<<12 );
  58.     write_byte( 225 );
  59.     write_byte( 0 );
  60.     write_byte( 0 );
  61.     write_byte( 125 );
  62.     message_end();
  63.   }
  64. }

  65. public volume_up_1(id) {
  66.   client_cmd(id , "volume 0.1");
  67.   set_task(0.2 , "volume_up_2" , id);
  68. }

  69. public volume_up_2(id) {
  70.   client_cmd(id , "volume 0.2");
  71.   set_task(0.2 , "volume_up_3" , id);
  72. }

  73. public volume_up_3(id) {
  74.   client_cmd(id , "volume 0.3");
  75.   set_task(0.2 , "volume_up_4" , id);
  76. }

  77. public volume_up_4(id) {
  78.   client_cmd(id , "volume 0.4");
  79.   set_task(0.2 , "volume_up_5" , id);
  80. }

  81. public volume_up_5(id) {
  82.   client_cmd(id , "volume 0.5");
  83.   set_task(0.2 , "volume_up_6" , id);
  84. }

  85. public volume_up_6(id) {
  86.   client_cmd(id , "volume 0.6");
  87.   set_task(0.2 , "volume_up_7" , id);
  88. }

  89. public volume_up_7(id) {
  90.   client_cmd(id , "volume 0.7");
  91.   set_task(0.2 , "volume_up_8" , id);
  92. }

  93. public volume_up_8(id) {
  94.   #if !defined USE_AMX
  95.    client_cmd(id , "volume %f" , gVolume[id]);
  96.   #else
  97.    client_cmd(id , "volume %f" , float(DEFAULT_VOLUME));
  98.   #endif
  99. }
复制代码
发表于 2011-3-13 23:52:38 | 显示全部楼层 来自 广东广州
没攻击力 但有效果?不理解
回复

使用道具 举报

发表于 2011-3-13 23:56:37 | 显示全部楼层 来自 广东广州
一般控制伤害都使用这段函数

本帖子中包含更多资源

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

×
回复

使用道具 举报

 楼主| 发表于 2011-3-14 14:55:52 | 显示全部楼层 来自 香港
是这样
  不会扣别人血 但会有眩晕效果
回复

使用道具 举报

发表于 2011-3-14 18:51:57 | 显示全部楼层 来自 广东广州
4# 20061234


那插件正是
回复

使用道具 举报

 楼主| 发表于 2011-3-14 21:18:53 | 显示全部楼层 来自 香港
5# rsdtt



怎么用的阿
回复

使用道具 举报

发表于 2011-3-14 21:31:05 | 显示全部楼层 来自 广东广州
那里不是有说明了吗
回复

使用道具 举报

 楼主| 发表于 2011-3-14 23:46:39 | 显示全部楼层 来自 香港
7# rsdtt



看不懂内容  晕 不知怎加
回复

使用道具 举报

 楼主| 发表于 2011-3-15 00:23:13 | 显示全部楼层 来自 香港
#include <amxmodx>

#include <amxmisc>

#include <hamsandwich>



#define PLUGIN_NAME        "New Plug-In"

#define PLUGIN_VERSION        "0.1"

#define PLUGIN_AUTHOR        "zwfgdlc"



#define DAMAGEBIT_HEGRENADE                1<<24



public plugin_init()

{

        register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);

        RegisterHam(Ham_TakeDamage,"player","fwd_TakeDamage_pre")



}



public fwd_TakeDamage_pre(id, idinflictor, idattacker, Float:damage, damagebits)

{

        if(damagebits == DAMAGEBIT_HEGRENADE)

        {

                SetHamParamFloat(4, 0.0);

        }

        

        return HAM_IGNORED;

}



这代码会使眩晕效果也除去
只有自己不会扣血,没什么伤害
怎么改
回复

使用道具 举报

 楼主| 发表于 2011-3-15 00:26:05 | 显示全部楼层 来自 香港
#include <amxmodx>

#include <amxmisc>

#include <hamsandwich>



#define PLUGIN_NAME        "New Plug-In"

#define PLUGIN_VERSION        "0.1"

#define PLUGIN_AUTHOR        "zwfgdlc"



#define DAMAGEBIT_HEGRENADE                1<<24



public plugin_init()

{

        register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);

        RegisterHam(Ham_TakeDamage,"player","fwd_TakeDamage_pre")



}



public fwd_TakeDamage_pre(id, idinflictor, idattacker, Float:damage, damagebits)

{

        if(damagebits == DAMAGEBIT_HEGRENADE)

        {

                SetHamParamFloat(4, 0.0);

        }

        

        return HAM_IGNORED;

}



这代码会使眩晕效果也除去
只有自己不会扣血,没什么伤害
怎么改
回复

使用道具 举报

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

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