請問怎取得玩家血量低於某血量?謝謝大大們

Home Home
引用 | 編輯 [NiGhT]-妖
2014-10-08 04:06
樓主
推文 x0
請問怎取得玩家血量低於某血量?謝謝大大們

獻花 x0
引用 | 編輯 弒血
2014-10-08 05:07
1樓
  
下面是引用 [NiGhT]-妖 於 2014-10-08 04:06 發表的 請問怎取得玩家血量低於某血量?謝謝大大們: 到引言文
請問怎取得玩家血量低於某血量?謝謝大大們



static health; health = get_user_health(id);


if (health <= xxx)
{
......
}

獻花 x0
引用 | 編輯 [NiGhT]-妖
2014-10-08 07:02
2樓
  
#include <amxmodx>
#include <fakemeta>


public plugin_init()
{
register_plugin("heary", "0.4", "clester993@gmail.com")
}


public plugin_precache()
{
precache_sound("player/heartbeat1.wav")
}


public playsound(id)
{
static health; health = get_user_health(id);
if (health <= 20)
{
engfunc(EngFunc_EmitSound, id, CHAN_WEAPON, "player/heartbeat1.wav", 1.0, 0.4, 0, PITCH_NORM)
}
}


寫錯了什麼?

獻花 x0
引用 | 編輯 弒血
2014-10-08 17:48
3樓
  
下面是引用 [NiGhT]-妖 於 2014-10-08 07:02 發表的 : 到引言文
#include <amxmodx>
#include <fakemeta>


public plugin_init()
{
register_plugin("heary", "0.4", "clester993@gmail.com")
}


public plugin_precache()
{
precache_sound("player/heartbeat1.wav")
}


public playsound(id)
{
static health; health = get_user_health(id);
if (health <= 20)
{
engfunc(EngFunc_EmitSound, id, CHAN_WEAPON, "player/heartbeat1.wav", 1.0, 0.4, 0, PITCH_NORM)
}
}


以上沒有寫錯..不過playsound沒有呼叫使用


寫錯了什麼?


獻花 x0
引用 | 編輯 [NiGhT]-妖
2014-10-08 18:13
4樓
  
#include <amxmodx>
#include <fakemeta>


public plugin_init()
{
register_plugin("heary", "0.4", "clester993@gmail.com")
register_message(get_user_msgid("Health"), "message_Health")
}


public plugin_precache()
{
precache_sound("player/heartbeat1.wav")
}


public message_Health(msg_id, msg_dest, msg_entity)
{
new Float:fHealth
pev(msg_id, pev_health, fHealth)
if (Health < 20)
playsound(msg_id)
}


public playsound(msg_id)
{
engfunc(EngFunc_EmitSound, msg_id, CHAN_WEAPON, "player/heartbeat1.wav", 1.0, 0.4, 0, PITCH_NORM)
}

獻花 x0