[以解決]切換武器問題
本帖最后由 jiunnwoei2629 于 2009-8-11 00:48 编辑有沒有辦法使用狙擊槍射殺敵人時,禁止立刻按下Q切換小槍(其他武器)?
#include <amxmodx>
#define PLUGIN "Test"
#define AUTHOR "Jim"
#define VERSION "1.0"
new Float:g_lastkilltime
new g_cantQ
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("lastinv", "cmd_lastinv")
register_event("DeathMsg", "event_death", "a", "4=awp")
register_event("CurWeapon", "event_curweapon", "be", "2=18", "3=0")
}
public client_connect(id)
{
g_cantQ = 0
g_lastkilltime = 0.0
}
public event_death()
{
new id = read_data(1)
if(is_user_connected(id))
g_lastkilltime = get_gametime()
}
public event_curweapon(id)
{
g_cantQ = (get_gametime() - g_lastkilltime < 2.0)
}
public cmd_lastinv(id)
{
return g_cantQ
}
没测试,用awp杀人后两秒内不能用q键 測試結果 還是殺人的時候可以按Q切槍 請各位幫個忙
蠻需要這個插件 各位幫幫忙阿
我需要此插件的幫忙 #include <amxmodx>
new Float:g_lastawpkilltime
public plugin_init()
{
register_plugin("AWP Kill Test", "1.0", "Rulzy")
register_clcmd("lastinv", "cmd_lastinv")
register_event("DeathMsg", "event_death", "a", "4=awp")
register_event("CurWeapon", "event_curweapon", "be", "2!18", "1=1")
}
public client_connect(id)
{
g_lastawpkilltime = 0.0
}
public event_death()
{
new id = read_data(1)
if(is_user_connected(id))
g_lastawpkilltime = get_gametime()
}
public cmd_lastinv(id)
{
if(get_gametime()-g_lastawpkilltime>1.0)
return PLUGIN_CONTINUE;
return PLUGIN_HANDLE;
}
public event_curweapon(id)
{
g_lastawpkilltime = 0.0
}一秒钟内按Q键无效,但可以按1、2、3、4等键切换武器。 OK 立刻測試 會給回報 register_event("CurWeapon", "event_curweapon", "be", "2=18", "3=0")
我的代码这个地方写错了,应该是
register_event("CurWeapon", "event_curweapon", "be", "1=0", "2=18") #include
new Float:g_lastawpkilltime
public plugin_init()
{
register_plugin("AWP Kill Test", "1.0", "Rulzy")
register_clcmd("lastinv", "cmd_lastinv")
register_event("Death ...
Rulzy 发表于 2009-8-10 13:09 http://www.dt-club.net/forum/images/common/back.gif
你的PLUGIN_HANDLE寫錯摟
應該是PLUGIN_HANDLED
不過測試結果還是一樣可以案Q換槍
還是說 他是測試殺人的時候
不能按Q
我是在無人狀態測試的
register_event("CurWeapon", "event_curweapon", "be", "2=18", "3=0")
我的代码这个地方写错了,应该是
register_event("CurWeapon", "event_curweapon", "be", "1=0", "2=18")
jim_yang 发表于 2009-8-10 13:25 http://www.dt-club.net/forum/images/common/back.gif
OK 現在測試看看 晕倒,你是说用AWP杀人之后不能马上按Q键切枪,并不是说AWP开枪之后。
页:
[1]
2