寫插件求救....

Home Home
引用 | 編輯 crazy4ever
2011-08-27 13:02
樓主
推文 x0
小弟第一次寫...完全不懂 做插件 ...但又想做個 "血量少 減速插件"不知有無大大可以幫助我 ??



#include <amxmodx>#include <amxmisc>

#define PLUGIN "血量少 減速插件"   #define low_speed#define VERSION "0.1"#define AUTHOR "ccs"

public plugin_init() {   register_plugin(PLUGIN, VERSION, AUTHOR)   register_cvar (zp_human_speed)}



public speed(id) {if (hp<5000  , zp_human_speed=180)}
if (hp<3000 , zp_human_speed=150)}

#the end 

獻花 x0
引用 | 編輯 ChaosX
2011-08-27 14:14
1樓
  
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "血量少 減速插件"  
#define low_speed     <---這幹嘛的?
#define VERSION "0.1"
#define AUTHOR "ccs"

public plugin_init()
{  
register_plugin(PLUGIN, VERSION, AUTHOR)  
register_cvar (zp_human_speed) <---這= =
}
public speed(id) {
if (hp<5000 , zp_human_speed=180) <---看就知道錯了
}                    
if (hp<3000 , zp_human_speed=150) <---這也是錯了
} <---和它相對的"{"跑哪去了?
#the end <--意義不明

幫你指出問題點了...
自己慢慢改

獻花 x0
引用 | 編輯 crazy4ever
2011-08-27 15:03
2樓
  
哈 .. 本人寫插件真爛 ...
我再找找教學吧


那 正確嗎 ?

#include <amxmodx>

#include <zombieplague>

#define PLUGIN "血量少 減速插件"   

#define VERSION "0.1"

#define AUTHOR "ccs"

public plugin_init(){   register_plugin(PLUGIN, VERSION, AUTHOR)   }

public speed(id) 

{  

new zhp = get_user_health(id)  

 if ( zhp < 5000  )         

 fm_set_user_maxspeed = 180

if ( zhp < 3000 )  

 fm_set_user_maxspeed = 150



獻花 x0
引用 | 編輯 文♂
2011-08-27 15:42
3樓
  
複製程式
#include <amxmodx> //主要的
#include <fakemeta> //讀取fakemeta語法
#include <zombieplague> //讀取zombieplague語法

#define PLUGIN "血量少 減速插件"
#define VERSION "0.1"
#define AUTHOR "ccs"

public plugin_init()
{
       register_plugin(PLUGIN, VERSION, AUTHOR)
       register_forward(FM_PlayerPreThink, "speed") //不斷重復該動作"speed"
}

public speed(id)
{
       if (zp_get_user_zombie(id)) //如果目標是僵屍
       {
              new zhp = pev(id, pev_health) // 獲得僵屍的hp(小數)
       
              if (zhp < 5000)      //如果小於5000血
                     set_pev(id, pev_maxspeed, 180.0) //設定速度上限為180.0
              else if (zhp < 3000) //否則 如果小於3000血
                     set_pev(id, pev_maxspeed, 150.0) //設定速度上限為180.0
       }
} 

你懂的表情

獻花 x1
引用 | 編輯 Abcdzxc555
2011-08-27 15:45
4樓
  
下面是引用 crazy4ever 於 2011-08-27 15:03 發表的 : 到引言文
哈 .. 本人寫插件真爛 ...
我再找找教學吧


那 正確嗎 ?

#include <amxmodx>

#include <zombieplague>

#define PLUGIN "血量少 減速插件"   

#define VERSION "0.1"

#define AUTHOR "ccs"

public plugin_init(){   register_plugin(PLUGIN, VERSION, AUTHOR)   }

public speed(id) 

{  

new zhp = get_user_health(id)  

 if ( zhp < 5000  )         

 fm_set_user_maxspeed = 180

if ( zhp < 3000 )  

 fm_set_user_maxspeed = 150


複製程式
#include <amxmodx>
#include <fakemeta_util>

public plugin_init()
{
          register_forward(FM_PlayerPreThink, "fw_playerprethink")
}

public fw_playerprethink(id)
{
          if (get_user_health(id) < 10000)
                    fm_set_user_speed(id, 150.0)
}


獻花 x1
引用 | 編輯 crazy4ever
2011-08-27 15:48
5樓
  
謝謝你們的幫助 ^^ 我還是不太懂 -0-
你所打的已經是完成作品? -0-

獻花 x0
引用 | 編輯 ChaosX
2011-08-27 15:58
6樓
  
下面是引用 crazy4ever 於 2011-08-27 15:48 發表的 : 到引言文
謝謝你們的幫助 ^^ 我還是不太懂 -0-
你所打的已經是完成作品? -0-
自己試一次不就知道了?

獻花 x0
引用 | 編輯 弒血
2011-09-21 13:45
7樓
  
恩阿
多試幾次 就會了 表情
如果想學快一點
插件區 有很多高手的插件 可以去參考 表情

獻花 x0