搜索
查看: 4279|回复: 13

求插件:第一局刀,第二局刀和雷,第三局手枪,附一局也二局刀雷源码.

[复制链接]
发表于 2006-11-22 17:06:13 | 显示全部楼层 |阅读模式 来自 中国–广西–柳州
没好意思,不要告我浪费版块,标题也搞错了,第三局枪刀雷.希望版主更正一下,上一篇是第一局刀,第二局枪刀雷的,而我的有些不同,希望各位见谅,还请各位帮帮忙编译一下.谢谢了.
#define PLUGINNAME "Automatic knife duel"
#define VERSION "0.2"
#define AUTHOR "JGHG"
/*
Copyleft 2005
Plugin topic: http://www.amxmodx.org/forums/viewtopic.php?p=91239

AUTOMATIC KNIFE DUEL
====================
Where I come from, if you cut the wall repeteadly with your knife it means you're challenging your last opponent to a knife duel. ;-)
I decided to automate this process.
If only you and another person on the opposite team remain in the round, you can hit a wall (or another object) with your knife.
By this action you challenge your opponent to a knife duel. The person you challenge gets a menu where he can accept/decline your
challenge. The challenged person has 10 seconds to decide his mind, else the challenge is automatically declined, and the menu should be closed automatically.
Should a knife duel start, it works out pretty much like a round of Knife Arena: you can only use the knife (and the C4!).
As soon as the round ends the Knife Arena mode is turned off.
/JGHG

VERSIONS
========
050208 0.2 Fixed seconds display.
Bots should now respond correctly and a little human like. They will mostly accept challenges. ;-)
Small fixes here and there. :-)
050208 0.1 First version - largely untested
*/
#include <amxmodx>
#include <fakemeta>
#include <fun>
#define DEBUG
#if defined DEBUG
#include <amxmisc>
#endif // defined DEBUG
#define MENUSELECT1 0
#define MENUSELECT2 1
#define TASKID_CHALLENGING 2348923
#define TASKID_BOTTHINK 3242321
#define DECIDESECONDS 10
#define ALLOWED_WEAPONS 2
// Globals below
new g_allowedWeapons[ALLOWED_WEAPONS] = {CSW_KNIFE, CSW_C4}
new g_MAXPLAYERS
new bool:g_challenging = false
new bool:g_knifeArena = false
new bool:g_noChallengingForAWhile = false
new g_challengemenu
new g_challenger
new g_challenged
// Globals above
public plugin_modules()
{
require_module("fakemeta")
require_module("fun")
}
public forward_emitsound(const PIRATE, const Onceuponatimetherewasaverysmall, noise[], const Float:turtlewhoateabiggerturtleand, const Float:afterthatthesmallturtlegot, const veryveryverybig, const theend) {
if (g_noChallengingForAWhile || g_knifeArena || g_challenging || PIRATE < 1 || PIRATE > g_MAXPLAYERS || !is_user_alive(PIRATE) || !equal(noise, "weapons/knife_hitwall1.wav"))
return FMRES_IGNORED
new team = get_user_team(PIRATE), otherteam = 0, matchingOpponent = 0
// Make sure exactly one person on each team is alive.
for (new i = 1; i <= g_MAXPLAYERS; i++) {
if (!is_user_connected(i) || !is_user_alive(i) || PIRATE == i)
continue
if (get_user_team(i) == team) {
// No fun.
return FMRES_IGNORED
}
else {
if (++otherteam > 1) {
// No fun.
return FMRES_IGNORED
}
matchingOpponent = i
}
}
if (matchingOpponent == 0)
return FMRES_IGNORED
Challenge(PIRATE, matchingOpponent)
if (is_user_bot(matchingOpponent)) {
new Float:val = float(DECIDESECONDS)
if (val < 2.0)
val = 2.0
remove_task(TASKID_BOTTHINK)
set_task(random_float(1.0, float(DECIDESECONDS) - 1.0), "BotDecides", TASKID_BOTTHINK)
}
return FMRES_IGNORED
}
public BotDecides() {
if (!g_challenging)
return
if (random_num(0,9) > 0)
Accept()
else {
DeclineMsg()
}
g_challenging = false
remove_task(TASKID_CHALLENGING)
}
Challenge(challenger, challenged) {
g_challenger = challenger
g_challenged = challenged
g_challenging = true
new challenger_name[32], challenged_name[32]
get_user_name(challenger, challenger_name, 31)
get_user_name(challenged, challenged_name, 31)
client_print(challenger, print_chat, "浣?s涓嬩簡灏忓垁瀵规垬璐达紒 绛夊€欏洖澶嶈繕鍓?%d 绉?..", challenged_name, DECIDESECONDS)
new menu[1024], keys = MENU_KEY_1 | MENU_KEY_2
format(menu, 1023, "%s 涓㈢粰浣犱竴灏佸皬鍒€瀵规垬鎴樹功^n^n - 蹇偣搴旀垬锛佷綘鍙墿涓?%d 绉掕€冭檻锛乛n^n\y1\w. 杩囨潵锛屾垜鐢ㄥ皬鍒€鍓蹭綘鐨勮倝锛乛n\y2\w. 绠椾簡锛屾垜鏄椆閽燂紝涓嶄笌浣犳垬", challenger_name, DECIDESECONDS)
show_menu(challenged, keys, menu, -1, "themenutitle")
set_task(float(DECIDESECONDS), "timed_closemenu", TASKID_CHALLENGING)
}
public timed_closemenu() {
if (g_challenging) {
new challenger_name[32], challenged_name[32]
get_user_name(g_challenger, challenger_name, 31)
get_user_name(g_challenged, challenged_name, 31)
client_print(0, print_chat, "%s 浣犲洖搴?%s 鐨勫垁鎴樻垬涔﹀お鎱簡锛屽厔寮熶滑閮界瓑鍒拌姳鍎夸篃璋簡...", challenged_name, challenger_name)
CancelAll()
}
}
public challenged_menu(id, key) {
switch (key) {
case MENUSELECT1: {
// Accept
Accept()
}
case MENUSELECT2: {
// Decline
DeclineMsg()
}
}
g_challenging = false
remove_task(TASKID_CHALLENGING)
return PLUGIN_HANDLED
}
DeclineMsg() {
new challenger_name[32], challenged_name[32]
get_user_name(g_challenger, challenger_name, 31)
get_user_name(g_challenged, challenged_name, 31)
client_print(0, print_chat, "%s 瀵?%s 鍛靛懙閬擄細浣犺繖灏忔瘺瀛╋紝鍒颁竴杈规拻灏垮幓...", challenged_name, challenger_name)
}
Accept() {
new challenger_name[32], challenged_name[32]
get_user_name(g_challenger, challenger_name, 31)
get_user_name(g_challenged, challenged_name, 31)
client_print(0, print_chat, "%s 鎺ュ彈浜?%s 鐨勫垁鎴樿创", challenged_name, challenger_name)
g_knifeArena = true
give_item(g_challenger, "weapon_knife")
give_item(g_challenged, "weapon_knife")
engclient_cmd(g_challenger, "weapon_knife")
engclient_cmd(g_challenged, "weapon_knife")
}
public event_holdwpn(id) {
if (!g_knifeArena || !is_user_alive(id))
return PLUGIN_CONTINUE
new weaponType = read_data(2)
for (new i = 0; i < ALLOWED_WEAPONS; i++) {
if (weaponType == g_allowedWeapons)
return PLUGIN_CONTINUE
}
engclient_cmd(id, "weapon_knife")
return PLUGIN_CONTINUE
}
public event_roundend() {
if (g_challenging || g_knifeArena)
CancelAll()
g_noChallengingForAWhile = true
set_task(4.0, "NoChallengingForAWhileToFalse")
return PLUGIN_CONTINUE
}
public NoChallengingForAWhileToFalse() {
g_noChallengingForAWhile = false
}
CancelAll() {
if (g_challenging) {
g_challenging = false
// Close menu of challenged
new usermenu, userkeys
get_user_menu(g_challenged, usermenu, userkeys) // get user menu
if (usermenu == g_challengemenu) // Close it!
show_menu(g_challenged, 0, "") // show empty menu
}
if (g_knifeArena) {
g_knifeArena = false
}
remove_task(TASKID_BOTTHINK)
remove_task(TASKID_CHALLENGING)
}
public event_death() {
if (g_challenging || g_knifeArena)
CancelAll()
return PLUGIN_CONTINUE
}
#if defined DEBUG
public challengefn(id, level, cid) {
if (!cmd_access(id, level, cid, 3))
return PLUGIN_HANDLED
new challenger[64], challenged[64]
read_argv(1, challenger, 63)
read_argv(2, challenged, 63)
console_print(id, "鎸戞埌鑰咃細 %s锛岃鎸戞埌鑰咃細 %s", challenger, challenged)
new r = str_to_num(challenger)
new d = str_to_num(challenged)
Challenge(r, d)
if (is_user_bot(d))
Accept()
return PLUGIN_HANDLED
}
#endif // defined DEBUG
public plugin_init() {
register_plugin(PLUGINNAME, VERSION, AUTHOR)
register_event("CurWeapon", "event_holdwpn", "be", "1=1")
register_forward(FM_EmitSound, "forward_emitsound")
g_MAXPLAYERS = get_maxplayers()
g_challengemenu = register_menuid("themenutitle")
register_menucmd(g_challengemenu, 1023, "challenged_menu")
register_event("DeathMsg", "event_death", "a")
register_event("SendAudio", "event_roundend", "a", "2&%!MRAD_terwin")
register_event("SendAudio", "event_roundend", "a", "2&%!MRAD_ctwin")
register_event("SendAudio", "event_roundend", "a", "2&%!MRAD_rounddraw")
#if defined DEBUG
register_clcmd("0challenge", "challengefn", ADMIN_CFG, "<灏忓垁瀵规寫> <琚寫鎴樿€? - 寮€濮嬪崟鎸?)
#endif // defined DEBUG
}
发表于 2006-11-23 10:51:29 | 显示全部楼层 来自 中国–广东–深圳

回复: 求插件:第一局刀,第二局刀和雷,第三局手枪,附一局也二局刀雷源码.

附一局也二局刀雷源码

你贴的是刀局挑战....
回复

使用道具 举报

发表于 2006-11-23 12:46:09 | 显示全部楼层 来自 中国–山西–忻州

回复: 求插件:第一局刀,第二局刀和雷,第三局手枪,附一局也二局刀雷源码.

哇...............晕了..:cold:
回复

使用道具 举报

发表于 2006-11-23 12:47:26 | 显示全部楼层 来自 中国–黑龙江–大庆

回复: 求插件:第一局刀,第二局刀和雷,第三局手枪,附一局也二局刀雷源码.

真不知道这种插件有个毛意义```
回复

使用道具 举报

 楼主| 发表于 2006-11-25 00:06:53 | 显示全部楼层 来自 中国–广西–柳州–柳南区

回复: 求插件:第一局刀,第二局刀和雷,第三局手枪,附一局也二局刀雷源码.

娱乐服当然娱乐为主,没人回我来顶。
回复

使用道具 举报

 楼主| 发表于 2006-11-27 00:01:33 | 显示全部楼层 来自 中国–广西–来宾–武宣县

回复: 求插件:第一局刀,第二局刀和雷,第三局手枪,附一局也二局刀雷源码.

:confused: DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
回复

使用道具 举报

 楼主| 发表于 2006-11-29 04:22:22 | 显示全部楼层 来自 中国–广西–柳州–柳南区

回复: 求插件:第一局刀,第二局刀和雷,第三局手枪,附一局也二局刀雷源码.

再顶 :confused: :confused: :confused: :confused: :confused: :confused: :confused: :confused: :confused:
回复

使用道具 举报

发表于 2009-1-20 21:50:14 | 显示全部楼层 来自 中国–广东–云浮
第一局刀,第二局刀和雷,第三局手枪
回复

使用道具 举报

发表于 2009-12-23 11:34:58 | 显示全部楼层 来自 中国–湖南–长沙
希望楼主 能找到!!
回复

使用道具 举报

发表于 2009-12-23 19:41:09 | 显示全部楼层 来自 中国–湖南–株洲
刀、O3、O4、O5、C4及手枪战插件,主要有如下特点:

  1、可自定义;
  2、禁止使用的武器装备不允许购买,防止浪费钱;
  3、如果不允许放C4,则将C4没收掉;
  4、可以定义任意一局可以使用的武器。

  参数及命令介绍:
  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_delaygivegrenade "12"
amx_add_restwpns
amx_add_restwpns "g"
amx_add_restwpns "i"
amx_add_restwpns "" 25
amx_add_restwpns ""
amx_add_restwpns "g"
amx_add_restwpns "i"  

  则第一局只能用刀,第二局只能用刀、雷和放C4,第三局只能用刀、手枪(无限子弹)和放C4,第4局到第24局正常, 第25局只能用刀, 第26局只能用刀和放C4, 第27局只能用刀、手枪(无限子弹)和放C4, 第28局后正常。

  需要开启的模块: cstrike、engine、fun (原来使用 fakemeta 模块,有人报告说会使服务器当机,故改成使用 engine 模块)

  手雷无限处理方法已经更改,不会与彩色对讲机等插件发生冲突了,应该可以正常使用了。

  同时发布一个不没收C4的版本,如果你使用没收C4的版本会使服务器挂掉,可以使用此版本:restwpns_fight(donot_trip_c4).sma

  2006年12月20日更新:增加一参数,使之可以一次设置多个相同且连续的局。具体请查看前面的介绍。
  例如,如果你想每局都为无限手雷局,可以这样设置(假设一张地图中局数不超过512局):

代码:
amx_add_restwpns "g" 1 512

本帖子中包含更多资源

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

×
回复

使用道具 举报

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

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