|
发表于 2006-11-21 11:36:16
|
显示全部楼层
来自 中国–广东–深圳–罗湖区
回复: 【求助】求第一局用刀,第二局只使用手枪和o3o4的插件
很谢谢你的回复!我现在测试一下,我把第2局刀局屏蔽了,现在的效果是第一局用刀,第2局手枪跟O3O4,第3局以后正常使用武器,我说的是第2局以后偶然会自动换出刀来。下面是我改的代码。#include <amxmodx>
#include <amxmisc>
#define PLUGIN "Test"
#define VERSION "1.0"
#define AUTHOR "Jim"
new current_round = 0
new const weapon_banned[7] = {CSW_USP, CSW_GLOCK18, CSW_DEAGLE, CSW_ELITE, CSW_FIVESEVEN, CSW_P228, CSW_HEGRENADE}
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_logevent("round_count", 2, "1=Round_Start")
register_event("TextMsg", "round_restart", "a", "2=#Game_Commencing", "2=#Game_will_restart_in")
register_event("CurWeapon", "hook_weapon", "b", "2!29")
}
public round_count()
{
current_round ++
}
public round_restart()
{
current_round = 0
}
public hook_weapon(id)
{
if(current_round >2)
return PLUGIN_CONTINUE
new wpid = read_data(2)
if(current_round == 1)
engclient_cmd(id, "weapon_knife")
//else if(current_round == 2 && wpid != CSW_HEGRENADE)
//engclient_cmd(id, "weapon_knife")
else if(current_round == 2 && !IsValidWeapon(wpid))
engclient_cmd(id, "weapon_knife")
return PLUGIN_CONTINUE
}
bool:IsValidWeapon(wpid)
{
for(new i=0; i<7; i++)
{
if(wpid == weapon_banned)
return true
}
return false
} |
|