|
楼主 |
发表于 2008-3-31 16:42:42
|
显示全部楼层
来自 中国–广西–百色–那坡县
回复: 大家帮帮忙一下...这原码....
Post by jim_yang
这个二维数组是看攻击者对被攻击着的攻击次数,设置为==1是因为他可能是偶然打到这个队友而致其死亡,但之前并没有打到过他。如果==2或者3,就是说明他朝这个队友不止开了一枪而致其死亡,就不是你说的那个意思了,不过还是看你想要什么效果了。 #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]
new msg[64]
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 = 0
g_attacked_by = 0
g_hp = get_user_health(i)
for(new j = 0; j < 33; j++)
g_times_attacked_him[j] = 0
}
}
public client_damage(attacker, victim, dmg, wpid, hit, ta)
{
static tag
if(ta == 1)
{//第一枪警告
format(msg,63,"你2次重伤队友,就没收你的武器!")
set_hudmessage(248, 248, 255, 0.01, 0.35, 2, 3.0, 4.0, 0.1, 1.0, -1)
show_hudmessage(attacker, msg)
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] <= 3)
{
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)
{
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]--
format(msg,63,"这次队友原谅了你,下次请注意喔!")
set_hudmessage(248, 248, 255, 0.01, 0.5, 2, 3.0, 4.0, 0.1, 1.0, -1)
show_hudmessage(attacker, msg)
}
case 1: user_kill(attacker)
}
return PLUGIN_HANDLED
} |
|