搜索
查看: 3288|回复: 4

【求助】求大神帮忙把这个代码修改能用在CS1.5上

[复制链接]
发表于 2015-3-29 12:00:26 | 显示全部楼层 |阅读模式 来自 中国–黑龙江–双鸭山
小弟感激不尽

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注个册吧

×
 楼主| 发表于 2015-3-29 12:02:51 | 显示全部楼层 来自 中国–黑龙江–双鸭山
*/
#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("NewRound","eNewRound", "a")
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, "Zhu Yi:Ben Ju Ke Yong Wu Qi^nXiao Dao, ")
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, "Shan Guang Dan(Wu Xian), ")
else if(g_weaponflags[g_RestRoundCounter-1]&FLAG_A)
iLen += format(g_HintMsg[iLen], 255-iLen, "Shan Guang Dan, ")
if(g_weaponflags[g_RestRoundCounter-1]&FLAG_G)
iLen += format(g_HintMsg[iLen], 255-iLen, "Shou Lei(Wu Xian), ")
else if(g_weaponflags[g_RestRoundCounter-1]&FLAG_B)
iLen += format(g_HintMsg[iLen], 255-iLen, "Shou Lei, ")
if(g_weaponflags[g_RestRoundCounter-1]&FLAG_H)
iLen += format(g_HintMsg[iLen], 255-iLen, "Yan Wu Dan(Wu Xian), ")
else if(g_weaponflags[g_RestRoundCounter-1]&FLAG_C)
iLen += format(g_HintMsg[iLen], 255-iLen, "Yan Wu Dan, ")
if(g_weaponflags[g_RestRoundCounter-1]&FLAG_I)
iLen += format(g_HintMsg[iLen], 255-iLen, "Shou Qiang(Zi Dan Wu Xian), ")
else if(g_weaponflags[g_RestRoundCounter-1]&FLAG_E)
iLen += format(g_HintMsg[iLen], 255-iLen, "Shou Qiang, ")
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, "Zhu Yi :Ben Ju Wei Dao Zhan Mo Shi")
}else if(g_RestRoundCounter==2)
{
set_hudmessage(248, 26, 174, -1.0, 0.57, 0, 6.0, 3.0)
show_hudmessage(id, "Zhu Yi :Ben Ju Wei Shou Lei Mo Shi")
}
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, "Ci Ju Bu Neng Gou Mai Wu Qi")
return PLUGIN_HANDLED
}
}
for(new i=0;i<32;i++)
{
if(equali(arg, g_OtherGuns))
{
client_print(id, print_center, "Ci Ju Bu Neng Gou Mai Wu Qi")
return PLUGIN_HANDLED
}
}
if(equali(arg, "primammo")||equali(arg, "buyammo1"))
{
client_print(id, print_center, "Ci Ju Bu Neng Gou Mai Zhu Wu Qi Dan Yao")
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, "Shou Qiang Zi Dan Wu Xian ,Wu Xu Gou Mai")
else
client_print(id, print_center, "Ci Ju Bu Neng Gou Mai SHou Qiang Zi Dan")
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, "Shan Guang Dan Wu Xian, Wu Xu Gou Mai")
else
client_print(id, print_center, "Bu Neng Gou Mai Shan Guang Dan")
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, "Wu Xian Shou Lei")
else
client_print(id, print_center, "Bu Neng Gou Mai Shou Lei")
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, "Yan Wu Dan Wu Xian")
else
client_print(id, print_center, "Bu Neng Gou Mai Yan Wu Dan")
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, "Jin Yong C4,Wu Xu ChaiDanQi")
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, "Bu Neng Gou Mai Shou Qiang")
return PLUGIN_HANDLED
}
if(key==1)
{
回复

使用道具 举报

 楼主| 发表于 2015-3-29 12:03:39 | 显示全部楼层 来自 中国–黑龙江–双鸭山
client_print(id, print_center, "Bu Neng Gou Mai SanDanQiang")
return PLUGIN_HANDLED
}
if(key==2)
{
client_print(id, print_center, "Bu Neng Gou Mai ChongFengQiang")
return PLUGIN_HANDLED
}
if(key==3)
{
client_print(id, print_center, "Bu Neng Gou Mai ZiDongBuQiang")
return PLUGIN_HANDLED
}
if(key==4)
{
client_print(id, print_center, "Bu Neng Gou Mai QingJiQiang")
return PLUGIN_HANDLED
}
if(key==5)
{
client_print(id, print_center, "Bu Neng Gou Mai Zhu Wuqi Danyao")
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, "Shou Qiang Zi Dan Wu Xian")
else
client_print(id, print_center, "Bu Neng Gou Mai ShouQiang Zi Dan")
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, "Shan Guang Dan Wu Xian")
else
client_print(id, print_center, "Bu Neng Gou Mai ShanGuangDan")
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, "Shou Lei Wu Xian")
else
client_print(id, print_center, "Bu Neng Gou Mai Shou Lei")
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, "Yan Wu Dan Wu Xian")
else
client_print(id, print_center, "Bu Neng Gou Mai Yan Wu Dan")
return PLUGIN_HANDLED
}
if(key==6) //拆弹器
{
if(g_weaponflags[g_RestRoundCounter-1]&FLAG_D)
return PLUGIN_CONTINUE
client_print(id, print_center, "Jin Yong C4,Wu Xu ChaiDanQi")
return PLUGIN_HANDLED
}
if(key==7) //战术盾牌
{
client_print(id, print_center, "Bu Neng Gou Mai Ciwuqi")
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 */
回复

使用道具 举报

发表于 2015-3-31 13:19:29 | 显示全部楼层 来自 中国–陕西–西安
1.5哇。欢迎欢迎
回复

使用道具 举报

发表于 2015-10-22 13:00:40 | 显示全部楼层 来自 中国–四川–成都–双流区
什么问题导致的?
回复

使用道具 举报

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

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