fw_PlayerPreThink是什麼意思?

Home Home
引用 | 編輯 eric512
2013-07-22 22:29
樓主
推文 x0
fw_PlayerPreThink的PlayerPreThink是不是指玩家持續性插件?
fw是什麼?我參考了一些SMA,為什麼SMA裏的public fw_PlayerPreThink(id)裏,幾乎都是fm_xxxxxxxx
請大大解說
複製程式
public fw_PlayerPreThink(id)
{
    if (!is_user_alive(id))
        return FMRES_IGNORED;
    if (fm_cs_get_user_team(id) != 1)
        return FMRES_IGNORED;
    if (has_custom_weapons(id, PRIMARY_WEAPONS_BIT_SUM) || has_custom_weapons(id, SECONDARY_WEAPONS_BIT_SUM))
    {
        fm_strip_user_weapons(id)
        fm_give_item(id, "weapon_knife")
    }
    return FMRES_IGNORED;
}


獻花 x0
引用 | 編輯 ak47klo
2013-07-22 22:37
1樓
  
看你下面怎麼定義囉!

獻花 x0
引用 | 編輯 八云の橙貓
2013-07-22 23:16
2樓
  
fm_xxx_xxx 之類的函數 沒意外的話拉到底應該會有stock

fw_PlayerPreThink 意思上來說 是指玩家的思考 可以偵測出玩家在每0.0001秒中做的任何事情
比較常見的是拿來放置持續性hud之類的訊息


也可以拿來設定一些持續性的對象
像樓主上面放的函數應該是拿來偵測對象是否持有武器
不過偵測速度很快的關係 可以搭配
複製程式
new test[33]


...


if(get_gametime() - test[id] >= 某時間)
{
     //something
}


test[id] = get_gametime()



來做每次偵測的間隔

獻花 x0
引用 | 編輯 Gamesbrok
2013-07-22 23:18
3樓
  
PreThink 是依據玩家的 FPS 來計算,例如你有 60FPS,那每一秒會運行 60次。

fw_ 只是一個命名方式。

獻花 x0
引用 | 編輯 andyt0621
2013-07-23 10:58
4樓
  
FM_PlayerPreThink是個會不斷運行的forward(應該是這樣叫)
至於為什麼是fw_xxxxx..
純粹因為hook的時候人們用慣這名子..即:
register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
你喜歡的話..設成這也可以
register_forward(FM_PlayerPreThink, "abc")
public abc(id)
只是單單看這public會比較難清楚是FM_PlayerPreThink

獻花 x0
引用 | 編輯 eric512
2013-07-23 11:05
5樓
  
哦,我已明白了,謝謝各位大大的解說

獻花 x0