|
楼主 |
发表于 2008-3-30 21:14:41
|
显示全部楼层
来自 中国–广西–百色
回复: 大家帮帮忙一下...这原码....
Post by jim_yang
血少是多少,有具体数吗
还有,如果这个人之前朝队友打过一枪,造成队友少血状态,后来又无意中打了这个队友一下怎么算- #include <amxmodx>
- #include <fun>
- #include <csx>
- #define PLUGIN "Test"
- #define AUTHOR "Jim"
- #define VERSION "1.0"
- new g_times_team_attack[33]
- new g_attacked_by[33]
- new g_times_attacked_him[33][33]
- new g_hp[33]
- public plugin_init()
- {
- register_plugin(PLUGIN, VERSION, AUTHOR)
- register_logevent("round_start", 2, "1=Round_Start")
- }
- public round_start()
- {
- for(new i = 0; i < 33; i++)
- {
- g_times_team_attack[i] = 0
- g_attacked_by[i] = 0
- g_hp[i] = get_user_health(i)
- for(new j = 0; j < 33; j++)
- g_times_attacked_him[i][j] = 0
- }
- }
- public client_damage(attacker, victim, dmg, wpid, hit, ta)
- {
- static tag
- if(ta == 1)
- {
- tag = 0
- g_times_team_attack[attacker]++
- g_attacked_by[victim] = attacker
- g_times_attacked_him[attacker][victim]++
-
- if(g_hp[victim] < dmg && g_times_attacked_him[attacker][victim] == 1)
- {
- new name[48], menu
- get_user_name(attacker, name, 31)
- format(name, 47, "处理队友: %s", name)
- menu = menu_create(name, "menu_punish", 0)
- menu_additem(menu, "原谅一次", "cmd", ADMIN_USER)
- menu_additem(menu, "直接处死", "cmd", ADMIN_USER)
- menu_display(victim, menu, 0)
- tag = 1
- }
- if(g_times_team_attack[attacker] == 2 && is_user_alive(attacker))
- strip_user_weapons(attacker)
- if(g_times_team_attack[attacker] == 4 && tag != 1)
- {
- new msg[64]
- user_kill(attacker)
- 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)
- }
- }
- g_hp[victim] -= dmg
- }
- public menu_punish(id, menu, item)
- {
- new attacker = g_attacked_by[id]
- switch(item)
- {
- case 0: g_times_team_attack[attacker]--
- case 1: user_kill(attacker)
- }
- return PLUGIN_HANDLED
- }
复制代码 先试试这个吧,不知道成不成,说一句,插件效率不太高,因为damage这个事件发生频率太高了 应该是血少过25才可以一枪打死吧......
上面的原码我测试了....但三枪打死队友时没显示选择,是否要改这成:
if(g_hp[victim] < dmg && g_times_attacked_him[attacker][victim] <= 3)
?
测试成功,希望在服务器上不会乱记数............. |
|