關於按鍵開啟技能 (以解決)

Home Home
引用 | 編輯 a23107971a
2016-05-07 22:39
樓主
推文 x0
是這樣的學插件到一半
突然懊惱著要如何讓新增好的代數能夠用按鍵,開啟技能
例如:按G自爆 . 按{ } 然後出捨麼是((  ))這樣
有誰會的能教我一下嗎表情 (拜託

獻花 x0
引用 | 編輯 z2352671213
2016-05-08 15:15
1樓
  
複製程式


...
#include <fakemeta>
#include <hamsandwich>
...

public plugin_init()
{
...
    register_forward(FM_PlayerPostThink, "fw_PlayerPostThink", 1)
...
}

...
public fw_PlayerPostThink(id)
{

    new button, oldbutton
    button = pev(id, pev_button)
    oldbutton = pev(id, pev_oldbuttons)
    
    if ((button & IN_USE) && (oldbutton & IN_USE))//這是E鍵,這兩個一起用就是檢測長按
    {
        //做某事//或者自爆什麼的功能////寫在這裡

    }

}





以下是按鍵常數



pev(entity, pev_button) or pev(entity, pev_oldbuttons) values
#

#define IN_ATTACK                 (1<<0)
#define IN_JUMP                 (1<<1)
#define IN_DUCK                 (1<<2)
#define IN_FORWARD               (1<<3)
#define IN_BACK                 (1<<4)
#define IN_USE                   (1<<5)
#define IN_CANCEL                 (1<<6)
#define IN_LEFT                 (1<<7)
#define IN_RIGHT                 (1<<8)
#define IN_MOVELEFT               (1<<9)
#define IN_MOVERIGHT               (1<<10)
#define IN_ATTACK2               (1<<11)
#define IN_RUN                   (1<<12)
#define IN_RELOAD                 (1<<13)
#define IN_ALT1                 (1<<14)
#define IN_SCORE                 (1<<15)  


至於你那個G鍵,直接註冊一個drop命令不就好了。

獻花 x0
引用 | 編輯 a23107971a
2016-05-08 16:04
2樓
  
下面是引用 z2352671213 於 2016-05-08 15:15 發表的 : 到引言文
[code]
...
#include <fakemeta>
#include <hamsandwich>
.......



お、ありがとう
喔,  謝謝你


遇到高人
不知為捨有些指令在數位找不到表情
目前找到的有
http://bbs-mychat.com/reads.php?tid=828620
http://bbs-mychat.com/reads.php?tid=832252
http://bbs-mychat.com/reads.php?tid=978337

獻花 x0