搜索
查看: 5055|回复: 4

谁能把新刀,O3,O4,O5刀战插件改为CS1.5版本的,谢谢

[复制链接]
发表于 2008-12-25 13:01:54 | 显示全部楼层 |阅读模式 来自 中国–四川–凉山彝族自治州–西昌市
/*
  刀、O3、O4、O5、C4及手枪战插件,主要有如下特点:
  1、可自定义;
  2、禁止使用的武器装备不允许购买,防止浪费钱;
  3、可以定义任意一局可以使用的武器。
  参数及命令介绍:
  amx_delaygivegrenade <time> 无限雷时,延迟多长时间给玩家雷,单位为秒,默认 0.1 秒
  amx_clear_restwpns 清除已经有的关于限制武器局数据
  amx_add_restwpns [<flags> [<round> [n]]] 增加一限制武器局, round 代表是第几局, 其最大值为512,
如果省略 round, 则为当前定义的最大局数的下一局
n 表示从第 round 局开始,有 n 局使用此模式
    flags 可以是以下字母的组合:
    a: 可以使用闪光弹
    b: 可以使用高爆手雷
    c: 可以使用烟雾弹
    d: 可以放C4
    e: 可以使用手枪
    f: 可以使用闪光弹,并且无限补给闪光弹
    g: 可以使用高爆手雷,并且无限补给高爆手雷
    h: 可以使用烟雾弹,并且无限补给烟雾弹
    i: 可以使用手枪,并且无限补给子弹

如果使用了"f",就不必使用"a";如果使用了"g",就不必使用"b";
如果使用了"h",就不必使用"c";如果使用了"i",就不必使用"e"。

为了表达清楚,建议不要省略参数 round 和 n

    例如:
    只能用刀:          amx_add_restwpns
    只能用刀和放C4:       amx_add_restwpns "d"
    只能用刀、雷和放C4      amx_add_restwpns "abcd"
    只能用刀、无限雷和放C4    amx_add_restwpns "dfgh"
    只能用刀、手枪无限子弹和放C4 amx_add_restwpns "di"
  完整例子:
  你只需在 amxx.cfg 里加上如下命令:
  amx_clear_restwpns
  amx_add_restwpns
  amx_add_restwpns "abcd"
  amx_add_restwpns "di"
  amx_add_restwpns "" 25
  amx_add_restwpns "d"
  amx_add_restwpns "di"
  则第一局只能用刀,第二局只能用刀、雷和放C4,第三局只能用刀、手枪(无限子弹)和放C4,第4局到第24局正常,
  第25局只能用刀, 第26局只能用刀和放C4, 第27局只能用刀、手枪(无限子弹)和放C4, 第28局后正常。
  需要开启的模块: cstrike、engine、fun
  注意,如果无限雷无效,可能是与其他插件有冲突,如彩色对讲机、炸弹对讲机之类的,
  需在 configs\plugins.ini 中将此插件移到那些插件的前面,不防将此插件放到所有第三方(非官方)插件的前面。
*/
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#define MAX_REST_ROUND_COUNT 512
#define FLAG_A 1 //闪光弹
#define FLAG_B 2 //高爆手雷
#define FLAG_C 4 //烟雾弹
#define FLAG_D 8 //C4
#define FLAG_E 16 //手枪
#define FLAG_F 32 //无限闪光弹
#define FLAG_G 64 //无限高爆手雷
#define FLAG_H 128 //无限烟雾弹
#define FLAG_I 256 //无限手枪子弹
#define FLAG_Z 0x2000000 //正常局
new g_RestRoundCounter = 0 //限制局局数计数器(当战斗还没开始时,与真正的局数计数器不一定相等)
new g_RestrictCount = 0 //限制局数
new g_weaponflags[MAX_REST_ROUND_COUNT]
new g_MaxGunBPAmmo[] = {0,52,0,90,1,32,1,100,90,1,120,100,100,90,90,90,100,120,30,120,200,32,90,120,90,2,35,90,90,0,100}
new bool:g_restart_attempt[33]
new g_Restart = 0
new g_HintMsg[256]
new g_Pistols[11][]={ //购买手枪使用的命令
"usp",
"glock",
"deagle",
"p228",
"fn57",
"km45",
"9x19mm",
"nighthawk",
"228compact",
"elites",
"fiveseven"
}
new g_OtherGuns[32][]={
"m3", //购买霰弹枪使用的命令
"xm1014",
"12gauge",
"autoshotgun",
"mp5", //购买冲锋枪使用的命令
"tmp",
"p90",
"mac10",
"ump45",
"smg",
"mp",
"c90",
"ak47", //购买自动步枪使用的命令
"galil",
"famas",
"sg552",
"m4a1",
"aug",
"scout",
"awp",
"g3sg1",
"sg550",
"cv47",
"defender",
"clarion",
"krieg552",
"bullpup",
"magnum",
"d3au1",
"krieg550",
"m249", //购买轻机枪使用的命令

"shield" //购买战术盾牌使用的命令
}
public plugin_init()
{
register_plugin("Restrict Weapons Fight", "1.2", "Rulzy")
register_menucmd(register_menuid("#Buy", 1), 511, "menuBuy")
register_menucmd(register_menuid("BuyItem", 1), 511, "menuItem")
register_event("TextMsg", "Game_Commencing", "ac", "2&#Game_Commencing")
register_concmd("amx_clear_restwpns", "cmdClearRestrictWeapons", ADMIN_LEVEL_A, "<n> <flags> - set restrict weapons")
register_concmd("amx_add_restwpns", "cmdAddRestrictWeapons", ADMIN_LEVEL_A, "<flags> - set restrict weapons")
register_cvar("amx_delaygivegrenade", "0.1")
register_event("CurWeapon","eWeaponChange","be", "1=1")
register_event("HLTV", "eNewRound", "a", "1=0", "2=0")
register_clcmd("fullupdate", "cmd_fullupdate")
register_event("ResetHUD", "eResetHUD", "be")
register_event("TextMsg", "eRestart", "a", "2=#Game_will_restart_in")
register_event("AmmoX", "eAmmoX", "be")
g_RestrictCount = 0
for(new i=0;i<MAX_REST_ROUND_COUNT;i++)
g_weaponflags = FLAG_Z
}
public eNewRound()
{
if(g_Restart==1)
{
g_Restart = 0
g_RestRoundCounter = 0
}
g_RestRoundCounter++
if(g_RestRoundCounter>g_RestrictCount||g_weaponflags[g_RestRoundCounter-1]&FLAG_Z) return
new iLen = format(g_HintMsg, 255, "注意,本局可用武器:^n刀, ")
if(g_weaponflags[g_RestRoundCounter-1]&FLAG_D)
iLen += format(g_HintMsg[iLen], 255-iLen, "C4, ")
if(g_weaponflags[g_RestRoundCounter-1]&FLAG_F)
iLen += format(g_HintMsg[iLen], 255-iLen, "闪光弹(无限), ")
else if(g_weaponflags[g_RestRoundCounter-1]&FLAG_A)
iLen += format(g_HintMsg[iLen], 255-iLen, "闪光弹, ")
if(g_weaponflags[g_RestRoundCounter-1]&FLAG_G)
iLen += format(g_HintMsg[iLen], 255-iLen, "高爆手雷(无限), ")
else if(g_weaponflags[g_RestRoundCounter-1]&FLAG_B)
iLen += format(g_HintMsg[iLen], 255-iLen, "高爆手雷, ")
if(g_weaponflags[g_RestRoundCounter-1]&FLAG_H)
iLen += format(g_HintMsg[iLen], 255-iLen, "烟雾弹(无限), ")
else if(g_weaponflags[g_RestRoundCounter-1]&FLAG_C)
iLen += format(g_HintMsg[iLen], 255-iLen, "烟雾弹, ")
if(g_weaponflags[g_RestRoundCounter-1]&FLAG_I)
iLen += format(g_HintMsg[iLen], 255-iLen, "手枪(子弹无限), ")
else if(g_weaponflags[g_RestRoundCounter-1]&FLAG_E)
iLen += format(g_HintMsg[iLen], 255-iLen, "手枪, ")
g_HintMsg[strlen(g_HintMsg)-2] = 0
}
public Game_Commencing()
{
g_Restart = 1
return PLUGIN_CONTINUE
}
public eRestart()
{
g_Restart = 1
new players[32], num
get_players(players, num, "a")
for (new i; i < num; ++i)
g_restart_attempt[players] = true
return PLUGIN_CONTINUE
}
public cmd_fullupdate()
{
return PLUGIN_HANDLED
}
public eResetHUD(id)
{
if (g_restart_attempt[id])
{
g_restart_attempt[id] = false
return PLUGIN_CONTINUE
}

ePlayerSpawn(id)
return PLUGIN_CONTINUE
}
public show_hint(id)
{
set_hudmessage(255, 128, 255, -1.0, 0.55, 0, 6.0, 2.5,_,_,1)
show_hudmessage(id, g_HintMsg)
}
public ePlayerSpawn(id)
{
if(g_RestRoundCounter==0) eNewRound()
if(g_RestRoundCounter>g_RestrictCount||g_weaponflags[g_RestRoundCounter-1]&FLAG_Z) return
show_hint(id)
set_task(1.5, "show_hint", id,_,_,"a",4)
set_task(0.1, "changeto_knife", id)
new ammo, clip
if(g_weaponflags[g_RestRoundCounter-1]&FLAG_F)
{
get_user_ammo(id, CSW_FLASHBANG, ammo, clip)
if(ammo<2)
set_task(0.1, "give_flashbang", id)
if(ammo<1)
set_task(0.1, "give_flashbang", id)
}
if(g_weaponflags[g_RestRoundCounter-1]&FLAG_G)
{
get_user_ammo(id, CSW_FLASHBANG, ammo, clip)
if(ammo<1)
set_task(0.1, "give_hegrenade", id)
}
if(g_weaponflags[g_RestRoundCounter-1]&FLAG_H)
{
get_user_ammo(id, CSW_FLASHBANG, ammo, clip)
if(ammo<1)
set_task(0.1, "give_smokegrenade", id)
}
}
public changeto_knife(id)
{
engclient_cmd(id, "weapon_knife")
}
public cmdClearRestrictWeapons(id, level, cid)
{
g_RestrictCount = 0
for(new i=0;i<MAX_REST_ROUND_COUNT;i++)
g_weaponflags = FLAG_Z
return PLUGIN_HANDLED
}
public cmdAddRestrictWeapons(id, level, cid)
{
if(!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
new sflags[32], s[5], round
read_argv(1, sflags, 31)
read_argv(2, s, 4)
if(s[0])
round = str_to_num(s)-1
else
round = g_RestrictCount
if(round<0) round = 0
if(round>=MAX_REST_ROUND_COUNT)
{
if(id==0)
server_print("Max Restrict Count Reached")
else
client_print(id, print_console, "Max Restrict Count Reached")
return PLUGIN_HANDLED
}
read_argv(3, s, 4)
new num
if(s[0])
num = str_to_num(s)
else
num = 1
if((round+num)>=MAX_REST_ROUND_COUNT)
{
num = MAX_REST_ROUND_COUNT - round
}
new flags = read_flags(sflags)
for(new i=round;i<round+num;i++)
g_weaponflags = flags
if(round+num>g_RestrictCount) g_RestrictCount= round+num
return PLUGIN_HANDLED
}
public client_command(id)
{
if(g_RestRoundCounter>g_RestrictCount||g_RestRoundCounter==0||g_weaponflags[g_RestRoundCounter-1]&FLAG_Z) return PLUGIN_CONTINUE
new arg[13]
if(read_argv(0, arg, 12)>11) return PLUGIN_CONTINUE
if(equali(arg, "lastinv"))
{
if(g_RestRoundCounter==1)
{
set_hudmessage(248, 26, 174, -1.0, 0.57, 0, 6.0, 3.0)
show_hudmessage(id, "注意,本局为刀战模式")
}else if(g_RestRoundCounter==2)
{
set_hudmessage(248, 26, 174, -1.0, 0.57, 0, 6.0, 3.0)
show_hudmessage(id, "注意,本局为手雷模式")
}
return PLUGIN_CONTINUE
}
for(new i=0;i<11;i++)
{
if(equali(arg, g_Pistols))
{
if(g_weaponflags[g_RestRoundCounter-1]&(FLAG_E|FLAG_I))
return PLUGIN_CONTINUE
client_print(id, print_center, "此局不能购买此武器")
return PLUGIN_HANDLED
}
}
for(new i=0;i<32;i++)
{
if(equali(arg, g_OtherGuns))
{
client_print(id, print_center, "此局不能购买此武器")
return PLUGIN_HANDLED
}
}
if(equali(arg, "primammo")||equali(arg, "buyammo1"))
{
client_print(id, print_center, "此局不能购买主武器弹药")
return PLUGIN_HANDLED
}
if(equali(arg, "secammo")||equali(arg, "buyammo2"))
{
if(g_weaponflags[g_RestRoundCounter-1]&FLAG_E)
return PLUGIN_CONTINUE
else if(g_weaponflags[g_RestRoundCounter-1]&FLAG_I)
client_print(id, print_center, "此局手枪子弹无限,不用购买手枪子弹")
else
client_print(id, print_center, "此局不能购买手枪子弹")
return PLUGIN_HANDLED
}
if(equali(arg, "flash"))
{
if(g_weaponflags[g_RestRoundCounter-1]&FLAG_A)
return PLUGIN_CONTINUE
else if(g_weaponflags[g_RestRoundCounter-1]&FLAG_F)
client_print(id, print_center, "此局闪光弹无限,并自动赠与,不需购买")
else
client_print(id, print_center, "此局不能购买闪光弹")
return PLUGIN_HANDLED
}
if(equali(arg, "hegren"))
{
if(g_weaponflags[g_RestRoundCounter-1]&FLAG_B)
return PLUGIN_CONTINUE
else if(g_weaponflags[g_RestRoundCounter-1]&FLAG_G)
client_print(id, print_center, "此局高爆手雷无限,并自动赠与,不需购买")
else
client_print(id, print_center, "此局不能购买高爆手雷")
return PLUGIN_HANDLED
}
if(equali(arg, "sgren"))
{
if(g_weaponflags[g_RestRoundCounter-1]&FLAG_C)
return PLUGIN_CONTINUE
else if(g_weaponflags[g_RestRoundCounter-1]&FLAG_H)
client_print(id, print_center, "此局烟雾弹无限,并自动赠与,不需购买")
else
client_print(id, print_center, "此局不能购买烟雾弹")
return PLUGIN_HANDLED
}
if(equali(arg, "defuser"))
{
if(g_weaponflags[g_RestRoundCounter-1]&FLAG_D)
return PLUGIN_CONTINUE
if(get_user_team(id)==2)
client_print(id, print_center, "此局禁放C4,不需购买拆弹器")
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public menuBuy(id, key)
{
if(g_RestRoundCounter>g_RestrictCount||g_weaponflags[g_RestRoundCounter-1]&FLAG_Z) return PLUGIN_CONTINUE
if(key==0)
{
if(g_weaponflags[g_RestRoundCounter-1]&(FLAG_E|FLAG_I))
return PLUGIN_CONTINUE
client_print(id, print_center, "此局不能购买手枪")
return PLUGIN_HANDLED
}
if(key==1)
{
client_print(id, print_center, "此局不能购买霰弹枪")
return PLUGIN_HANDLED
}
if(key==2)
{
client_print(id, print_center, "此局不能购买冲锋枪")
return PLUGIN_HANDLED
}
if(key==3)
{
client_print(id, print_center, "此局不能购买自动步枪")
return PLUGIN_HANDLED
}
if(key==4)
{
client_print(id, print_center, "此局不能购买轻型机枪")
return PLUGIN_HANDLED
}
if(key==5)
{
client_print(id, print_center, "此局不能购买主武器弹药")
return PLUGIN_HANDLED
}
if(key==6)
{
if(g_weaponflags[g_RestRoundCounter-1]&FLAG_E)
return PLUGIN_CONTINUE
else if(g_weaponflags[g_RestRoundCounter-1]&FLAG_I)
client_print(id, print_center, "此局手枪子弹无限,不用购买手枪子弹")
else
client_print(id, print_center, "此局不能购买手枪子弹")
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public menuItem(id, key)
{
if(g_RestRoundCounter>g_RestrictCount||g_weaponflags[g_RestRoundCounter-1]&FLAG_Z) return PLUGIN_CONTINUE
if(key==2)
{
if(g_weaponflags[g_RestRoundCounter-1]&FLAG_A)
return PLUGIN_CONTINUE
else if(g_weaponflags[g_RestRoundCounter-1]&FLAG_F)
client_print(id, print_center, "此局闪光弹无限,并自动赠与,不需购买")
else
client_print(id, print_center, "此局不能购买闪光弹")
return PLUGIN_HANDLED
}
if(key==3)
{
if(g_weaponflags[g_RestRoundCounter-1]&FLAG_B)
return PLUGIN_CONTINUE
else if(g_weaponflags[g_RestRoundCounter-1]&FLAG_G)
client_print(id, print_center, "此局高爆手雷无限,并自动赠与,不需购买")
else
client_print(id, print_center, "此局不能购买高爆手雷")
return PLUGIN_HANDLED
}
if(key==4)
{
if(g_weaponflags[g_RestRoundCounter-1]&FLAG_C)
return PLUGIN_CONTINUE
else if(g_weaponflags[g_RestRoundCounter-1]&FLAG_H)
client_print(id, print_center, "此局烟雾弹无限,并自动赠与,不需购买")
else
client_print(id, print_center, "此局不能购买烟雾弹")
return PLUGIN_HANDLED
}
if(key==6) //拆弹器
{
if(g_weaponflags[g_RestRoundCounter-1]&FLAG_D)
return PLUGIN_CONTINUE
client_print(id, print_center, "此局禁放C4,不需购买拆弹器")
return PLUGIN_HANDLED
}
if(key==7) //战术盾牌
{
client_print(id, print_center, "此局不能购买此武器")
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public eAmmoX(id)
{
if(g_RestRoundCounter>g_RestrictCount||g_weaponflags[g_RestRoundCounter-1]&FLAG_Z) return
new clip, ammo
new wpnid = get_user_weapon(id, clip, ammo)
new Float:delaytime = get_cvar_float("amx_delaygivegrenade")
switch(wpnid)
{
case CSW_FLASHBANG:
{
if(g_weaponflags[g_RestRoundCounter-1]&FLAG_F&&ammo<2)
set_task(delaytime, "give_flashbang", id)
}
case CSW_HEGRENADE:
{
if(g_weaponflags[g_RestRoundCounter-1]&FLAG_G&&ammo<1)
set_task(delaytime, "give_hegrenade", id)
}
case CSW_SMOKEGRENADE:
{
if(g_weaponflags[g_RestRoundCounter-1]&FLAG_H&&ammo<1)
set_task(delaytime, "give_smokegrenade", id)
}
}
}
public give_flashbang(id)
{
if(is_user_connected(id)&&is_user_alive(id))
give_item(id, "weapon_flashbang")
}
public give_hegrenade(id)
{
if(is_user_connected(id)&&is_user_alive(id))
give_item(id, "weapon_hegrenade")
}
public give_smokegrenade(id)
{
if(is_user_connected(id)&&is_user_alive(id))
give_item(id, "weapon_smokegrenade")
}
public eWeaponChange(id)
{
if(g_RestRoundCounter>g_RestrictCount||g_weaponflags[g_RestRoundCounter-1]&FLAG_Z) return
new wpnid = read_data(2)
if(wpnid==CSW_KNIFE) return
switch(wpnid)
{
case CSW_USP,CSW_GLOCK18,CSW_DEAGLE,CSW_P228,CSW_ELITE,CSW_FIVESEVEN:
{
if(g_weaponflags[g_RestRoundCounter-1]&FLAG_I)
{
if(cs_get_user_bpammo(id, wpnid)<g_MaxGunBPAmmo[wpnid])
cs_set_user_bpammo(id, wpnid, g_MaxGunBPAmmo[wpnid])
}else if(g_weaponflags[g_RestRoundCounter-1]&FLAG_E==0){
engclient_cmd(id, "weapon_knife")
}
}
case CSW_FLASHBANG:
{
if(g_weaponflags[g_RestRoundCounter-1]&(FLAG_A|FLAG_F)==0)
engclient_cmd(id, "weapon_knife")
}
case CSW_HEGRENADE:
{
if(g_weaponflags[g_RestRoundCounter-1]&(FLAG_B|FLAG_G)==0)
engclient_cmd(id, "weapon_knife")
}
case CSW_SMOKEGRENADE:
{
if(g_weaponflags[g_RestRoundCounter-1]&(FLAG_C|FLAG_H)==0)
engclient_cmd(id, "weapon_knife")
}
case CSW_C4:
{
if(g_weaponflags[g_RestRoundCounter-1]&FLAG_D==0)
engclient_cmd(id, "weapon_knife")
}
default:
{
engclient_cmd(id, "weapon_knife")
}
}
}
/* UTF-8 func by www.DT-Club.net */





这个只能在1.6里用,谁能改成1.5的呀
发表于 2013-8-14 13:31:17 | 显示全部楼层 来自 中国–上海–上海
register_event("HLTV", "eNewRound", "a", "1=0", "2=0")
这句改掉就能用了
回复

使用道具 举报

发表于 2013-11-12 22:31:56 | 显示全部楼层 来自 中国–辽宁–鞍山
不错,支持一下。多多学习。
回复

使用道具 举报

发表于 2014-6-21 06:42:01 | 显示全部楼层 来自 中国–河南–郑州
hackroad 发表于 2013-8-14 13:31
register_event("HLTV", "eNewRound", "a", "1=0", "2=0")
这句改掉就能用了

改成什么额?还是去掉就行了呀?
回复

使用道具 举报

发表于 2014-6-27 09:31:10 | 显示全部楼层 来自 中国–河北–石家庄
(22:21:06) 发表于 2014-6-21 06:42
改成什么额?还是去掉就行了呀?

register_event("NewRound","eNewRound", "a")
您输入的汉字小于5个,被评定为灌水!
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表