大家帮帮忙一下...这原码....(请jim_yang版主进来一下)
这原码想有功能:1.一局内累计打中队友两次没收武器.2.一局内累计伤队友4次处死.3.开局后重新记数.现在它人多时记数不正确,一局结束也不清0,请谁帮改一下..
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fun>
#include <csx>
new tk
public plugin_init(){
register_plugin("tk", "1.0", "zwfgdlc");
}
public client_damage(attacker, victim, damage, wpnindex, hitplace, TA)
{
if(TA)
++tk
if(tk>=4)
{
new msg
user_kill(attacker)
tk=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>=2){
strip_user_weapons( attacker )
}
}
}
}
public client_connected(id)
{
tk=0
}
回复: 大家帮帮忙一下...这原码....
如果一局内伤两次就没收武器还怎么伤四次呢?回复: 大家帮帮忙一下...这原码....
Post by jim_yang如果一局内伤两次就没收武器还怎么伤四次呢?
他还是可以检到死人的武器啊......
回复: 大家帮帮忙一下...这原码....
#include <amxmodx>
#include <fun>
#include <csx>
#define PLUGIN "Test"
#define AUTHOR "Jim"
#define VERSION "1.0"
new g_ta
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_ta = 0
}
public client_damage(attacker, victim, dmg, wpid, hit, ta)
{
if(ta == 1)
{
g_ta++
if(g_ta == 2 && is_user_alive(attacker))
strip_user_weapons(attacker)
if(g_ta == 4)
{
new msg
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)
}
}
}
回复: 大家帮帮忙一下...这原码....
谢谢.....先去测试,看效果反馈.....回复: 大家帮帮忙一下...这原码....
能否请您再加个功能:一.就是如果无意中一枪刚好打中生命少的队友造成他死了,给被杀死了的队友两个键选择:1.原谅杀你的人一次.2.直接处死杀你的人.
二.这样插件可能就完美无缺了,不再需要其它友军火控插件了...
回复: 大家帮帮忙一下...这原码....
血少是多少,有具体数吗还有,如果这个人之前朝队友打过一枪,造成队友少血状态,后来又无意中打了这个队友一下怎么算
#include <amxmodx>
#include <fun>
#include <csx>
#define PLUGIN "Test"
#define AUTHOR "Jim"
#define VERSION "1.0"
new g_times_team_attack
new g_attacked_by
new g_times_attacked_him
new g_hp
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 = 0
}
}
public client_damage(attacker, victim, dmg, wpid, hit, ta)
{
static tag
if(ta == 1)
{
tag = 0
g_times_team_attack++
g_attacked_by = attacker
g_times_attacked_him++
if(g_hp < dmg && g_times_attacked_him == 1)
{
new name, 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 == 2 && is_user_alive(attacker))
strip_user_weapons(attacker)
if(g_times_team_attack == 4 && tag != 1)
{
new msg
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 -= dmg
}
public menu_punish(id, menu, item)
{
new attacker = g_attacked_by
switch(item)
{
case 0: g_times_team_attack--
case 1: user_kill(attacker)
}
return PLUGIN_HANDLED
}
先试试这个吧,不知道成不成,说一句,插件效率不太高,因为damage这个事件发生频率太高了
回复: 大家帮帮忙一下...这原码....
一.就是如果无意中一枪刚好打中生命少的队友造成他死了,给被杀死了的队友两个键选择:1.原谅杀你的人一次.2.直接处死杀你的人.呵呵~ 不太好区分这个killer到底是恶意的还是无意的,而且我估计玩家被K死后,多半是不会“原谅一次”杀人者的,往往都是暴怒之下“直接处死”。
回复: 大家帮帮忙一下...这原码....
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
new g_attacked_by
new g_times_attacked_him
new g_hp
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 = 0
}
}
public client_damage(attacker, victim, dmg, wpid, hit, ta)
{
static tag
if(ta == 1)
{
tag = 0
g_times_team_attack++
g_attacked_by = attacker
g_times_attacked_him++
if(g_hp < dmg && g_times_attacked_him == 1)
{
new name, 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 == 2 && is_user_alive(attacker))
strip_user_weapons(attacker)
if(g_times_team_attack == 4 && tag != 1)
{
new msg
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 -= dmg
}
public menu_punish(id, menu, item)
{
new attacker = g_attacked_by
switch(item)
{
case 0: g_times_team_attack--
case 1: user_kill(attacker)
}
return PLUGIN_HANDLED
}
先试试这个吧,不知道成不成,说一句,插件效率不太高,因为damage这个事件发生频率太高了
应该是血少过25才可以一枪打死吧......
上面的原码我测试了....但三枪打死队友时没显示选择,是否要改这成:
if(g_hp < dmg && g_times_attacked_him <= 3)
?
测试成功,希望在服务器上不会乱记数.............
回复: 大家帮帮忙一下...这原码....
这个二维数组是看攻击者对被攻击着的攻击次数,设置为==1是因为他可能是偶然打到这个队友而致其死亡,但之前并没有打到过他。如果==2或者3,就是说明他朝这个队友不止开了一枪而致其死亡,就不是你说的那个意思了,不过还是看你想要什么效果了。
页:
[1]
2