搜索
查看: 4888|回复: 18

大家帮帮忙一下...这原码....(请jim_yang版主进来一下)

[复制链接]
发表于 2008-3-24 10:13:38 | 显示全部楼层 |阅读模式 来自 中国–广西–百色–右江区
这原码想有功能:1.一局内累计打中队友两次没收武器.2.一局内累计伤队友4次处死.3.开局后重新记数.
现在它人多时记数不正确,一局结束也不清0,请谁帮改一下..



#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fun>
#include <csx>
new tk[33]
public plugin_init(){
register_plugin("tk", "1.0", "zwfgdlc");
}
public client_damage(attacker, victim, damage, wpnindex, hitplace, TA)
{
if(TA)
++tk[attacker]

if(tk[attacker]>=4)
{
new msg[64]
user_kill(attacker)
tk[attacker]=0
format(msg,63,"你4次重伤队友,只能对不住了!")
set_hudmessage(248, 248, 255, 0.01, 0.4, 2, 3.0, 4.0, 0.1, 1.0, -1)
show_hudmessage(attacker, msg)
{
if(tk[attacker]>=2){
strip_user_weapons( attacker )
}
}
}
}
public client_connected(id)
{
tk[id]=0
}
发表于 2008-3-24 11:30:56 | 显示全部楼层 来自 中国–北京–北京–海淀区

回复: 大家帮帮忙一下...这原码....

如果一局内伤两次就没收武器还怎么伤四次呢?
回复

使用道具 举报

 楼主| 发表于 2008-3-24 16:01:57 | 显示全部楼层 来自 中国–广西–百色–右江区

回复: 大家帮帮忙一下...这原码....

Post by jim_yang
如果一局内伤两次就没收武器还怎么伤四次呢?
他还是可以检到死人的武器啊......
回复

使用道具 举报

发表于 2008-3-24 16:12:57 | 显示全部楼层 来自 中国–北京–北京–海淀区

回复: 大家帮帮忙一下...这原码....

  1. #include <amxmodx>
  2. #include <fun>
  3. #include <csx>
  4. #define PLUGIN "Test"
  5. #define AUTHOR "Jim"
  6. #define VERSION "1.0"
  7. new g_ta[33]
  8. public plugin_init()
  9. {
  10. register_plugin(PLUGIN, VERSION, AUTHOR)
  11. register_logevent("round_start", 2, "1=Round_Start")
  12. }
  13. public round_start()
  14. {
  15. for(new i = 0; i < 33; i++)
  16.   g_ta[i] = 0
  17. }
  18. public client_damage(attacker, victim, dmg, wpid, hit, ta)
  19. {
  20. if(ta == 1)
  21. {
  22.   g_ta[attacker]++
  23.   if(g_ta[attacker] == 2 && is_user_alive(attacker))
  24.    strip_user_weapons(attacker)
  25.   if(g_ta[attacker] == 4)
  26.   {
  27.    new msg[64]
  28.    user_kill(attacker)
  29.    format(msg,63,"你4次重伤队友,只能对不住了!")
  30.    set_hudmessage(248, 248, 255, 0.01, 0.4, 2, 3.0, 4.0, 0.1, 1.0, -1)
  31.    show_hudmessage(attacker, msg)
  32.   }
  33. }
  34. }
复制代码
回复

使用道具 举报

 楼主| 发表于 2008-3-24 16:40:14 | 显示全部楼层 来自 中国–广西–百色–右江区

回复: 大家帮帮忙一下...这原码....

谢谢.....先去测试,看效果反馈.....
回复

使用道具 举报

 楼主| 发表于 2008-3-30 00:32:24 | 显示全部楼层 来自 中国–广西–百色–田东县

回复: 大家帮帮忙一下...这原码....

能否请您再加个功能:
一.就是如果无意中一枪刚好打中生命少的队友造成他死了,给被杀死了的队友两个键选择:1.原谅杀你的人一次.2.直接处死杀你的人.
二.这样插件可能就完美无缺了,不再需要其它友军火控插件了...
回复

使用道具 举报

发表于 2008-3-30 16:29:55 | 显示全部楼层 来自 中国–北京–北京–海淀区

回复: 大家帮帮忙一下...这原码....

血少是多少,有具体数吗
还有,如果这个人之前朝队友打过一枪,造成队友少血状态,后来又无意中打了这个队友一下怎么算
  1. #include <amxmodx>
  2. #include <fun>
  3. #include <csx>
  4. #define PLUGIN "Test"
  5. #define AUTHOR "Jim"
  6. #define VERSION "1.0"
  7. new g_times_team_attack[33]
  8. new g_attacked_by[33]
  9. new g_times_attacked_him[33][33]
  10. new g_hp[33]
  11. public plugin_init()
  12. {
  13. register_plugin(PLUGIN, VERSION, AUTHOR)
  14. register_logevent("round_start", 2, "1=Round_Start")
  15. }
  16. public round_start()
  17. {
  18. for(new i = 0; i < 33; i++)
  19. {
  20.   g_times_team_attack[i] = 0
  21.   g_attacked_by[i] = 0
  22.   g_hp[i] = get_user_health(i)
  23.   for(new j = 0; j < 33; j++)
  24.    g_times_attacked_him[i][j] = 0
  25. }
  26. }
  27. public client_damage(attacker, victim, dmg, wpid, hit, ta)
  28. {
  29. static tag
  30. if(ta == 1)
  31. {
  32.   tag = 0
  33.   g_times_team_attack[attacker]++
  34.   g_attacked_by[victim] = attacker
  35.   g_times_attacked_him[attacker][victim]++
  36.   
  37.   if(g_hp[victim] < dmg && g_times_attacked_him[attacker][victim] == 1)
  38.   {
  39.    new name[48], menu
  40.    get_user_name(attacker, name, 31)
  41.    format(name, 47, "处理队友: %s", name)
  42.    menu = menu_create(name, "menu_punish", 0)
  43.    menu_additem(menu, "原谅一次", "cmd", ADMIN_USER)
  44.    menu_additem(menu, "直接处死", "cmd", ADMIN_USER)
  45.    menu_display(victim, menu, 0)
  46.    tag = 1
  47.   }
  48.   if(g_times_team_attack[attacker] == 2 && is_user_alive(attacker))
  49.    strip_user_weapons(attacker)
  50.   if(g_times_team_attack[attacker] == 4 && tag != 1)
  51.   {
  52.    new msg[64]
  53.    user_kill(attacker)
  54.    format(msg,63,"你4次重伤队友,只能对不住了!")
  55.    set_hudmessage(248, 248, 255, 0.01, 0.4, 2, 3.0, 4.0, 0.1, 1.0, -1)
  56.    show_hudmessage(attacker, msg)
  57.   }
  58. }
  59. g_hp[victim] -= dmg
  60. }
  61. public menu_punish(id, menu, item)
  62. {
  63. new attacker = g_attacked_by[id]
  64. switch(item)
  65. {
  66.   case 0: g_times_team_attack[attacker]--
  67.   case 1: user_kill(attacker)
  68. }
  69. return PLUGIN_HANDLED
  70. }
复制代码
先试试这个吧,不知道成不成,说一句,插件效率不太高,因为damage这个事件发生频率太高了
回复

使用道具 举报

发表于 2008-3-30 17:07:13 | 显示全部楼层 来自 中国–甘肃–兰州

回复: 大家帮帮忙一下...这原码....

一.就是如果无意中一枪刚好打中生命少的队友造成他死了,给被杀死了的队友两个键选择:1.原谅杀你的人一次.2.直接处死杀你的人.
呵呵~ 不太好区分这个killer到底是恶意的还是无意的,而且我估计玩家被K死后,多半是不会“原谅一次”杀人者的,往往都是暴怒之下“直接处死”。
回复

使用道具 举报

 楼主| 发表于 2008-3-30 21:14:41 | 显示全部楼层 来自 中国–广西–百色

回复: 大家帮帮忙一下...这原码....

Post by jim_yang
血少是多少,有具体数吗
还有,如果这个人之前朝队友打过一枪,造成队友少血状态,后来又无意中打了这个队友一下怎么算
  1. #include <amxmodx>
  2. #include <fun>
  3. #include <csx>
  4. #define PLUGIN "Test"
  5. #define AUTHOR "Jim"
  6. #define VERSION "1.0"
  7. new g_times_team_attack[33]
  8. new g_attacked_by[33]
  9. new g_times_attacked_him[33][33]
  10. new g_hp[33]
  11. public plugin_init()
  12. {
  13. register_plugin(PLUGIN, VERSION, AUTHOR)
  14. register_logevent("round_start", 2, "1=Round_Start")
  15. }
  16. public round_start()
  17. {
  18. for(new i = 0; i < 33; i++)
  19. {
  20.   g_times_team_attack[i] = 0
  21.   g_attacked_by[i] = 0
  22.   g_hp[i] = get_user_health(i)
  23.   for(new j = 0; j < 33; j++)
  24.    g_times_attacked_him[i][j] = 0
  25. }
  26. }
  27. public client_damage(attacker, victim, dmg, wpid, hit, ta)
  28. {
  29. static tag
  30. if(ta == 1)
  31. {
  32.   tag = 0
  33.   g_times_team_attack[attacker]++
  34.   g_attacked_by[victim] = attacker
  35.   g_times_attacked_him[attacker][victim]++
  36.   if(g_hp[victim] < dmg && g_times_attacked_him[attacker][victim] == 1)
  37.   {
  38.    new name[48], menu
  39.    get_user_name(attacker, name, 31)
  40.    format(name, 47, "处理队友: %s", name)
  41.    menu = menu_create(name, "menu_punish", 0)
  42.    menu_additem(menu, "原谅一次", "cmd", ADMIN_USER)
  43.    menu_additem(menu, "直接处死", "cmd", ADMIN_USER)
  44.    menu_display(victim, menu, 0)
  45.    tag = 1
  46.   }
  47.   if(g_times_team_attack[attacker] == 2 && is_user_alive(attacker))
  48.    strip_user_weapons(attacker)
  49.   if(g_times_team_attack[attacker] == 4 && tag != 1)
  50.   {
  51.    new msg[64]
  52.    user_kill(attacker)
  53.    format(msg,63,"你4次重伤队友,只能对不住了!")
  54.    set_hudmessage(248, 248, 255, 0.01, 0.4, 2, 3.0, 4.0, 0.1, 1.0, -1)
  55.    show_hudmessage(attacker, msg)
  56.   }
  57. }
  58. g_hp[victim] -= dmg
  59. }
  60. public menu_punish(id, menu, item)
  61. {
  62. new attacker = g_attacked_by[id]
  63. switch(item)
  64. {
  65.   case 0: g_times_team_attack[attacker]--
  66.   case 1: user_kill(attacker)
  67. }
  68. return PLUGIN_HANDLED
  69. }
复制代码
先试试这个吧,不知道成不成,说一句,插件效率不太高,因为damage这个事件发生频率太高了
应该是血少过25才可以一枪打死吧......
上面的原码我测试了....但三枪打死队友时没显示选择,是否要改这成:

if(g_hp[victim] < dmg && g_times_attacked_him[attacker][victim] <= 3)
?

测试成功,希望在服务器上不会乱记数.............
回复

使用道具 举报

发表于 2008-3-31 15:53:58 | 显示全部楼层 来自 中国–北京–北京–海淀区

回复: 大家帮帮忙一下...这原码....

这个二维数组是看攻击者对被攻击着的攻击次数,设置为==1是因为他可能是偶然打到这个队友而致其死亡,但之前并没有打到过他。如果==2或者3,就是说明他朝这个队友不止开了一枪而致其死亡,就不是你说的那个意思了,不过还是看你想要什么效果了。
回复

使用道具 举报

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

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