回复: 大家帮帮忙一下...这原码....
Post by jim_yang这个二维数组是看攻击者对被攻击着的攻击次数,设置为==1是因为他可能是偶然打到这个队友而致其死亡,但之前并没有打到过他。如果==2或者3,就是说明他朝这个队友不止开了一枪而致其死亡,就不是你说的那个意思了,不过还是看你想要什么效果了。
这个数组耗费很多内存,还不如简单点:
如果打中自己人,就在屏幕上提示一下打中自己人了(打一枪就提示,不用存储太多),限制说3枪,4枪我觉得没什么意义,有本事打死队友,哈哈:spiderman 。
如果打死队友了,就弹出菜单提示处罚队友的菜单。
回复: 大家帮帮忙一下...这原码....
打中队友本身自己就带提示,我看也能省了。否则打一次就提示一次,发多少消息到客户端啊,这都是耗费资源。最省事就是杀了队友的同时自己马上死,基本不费什么资源。做服务器还是稳定为主,反正这类的插件我是不会用的。又要开互杀,打着还要处理,我的机器可没这么好。我的机器上就运行一个插件,整合了我要用的所有东西,2000来行也就,我机器amd2500+, 内存DDR512M,显卡9200,带宽512K,古董啊全是。但是运行起来照样顺畅,还是listenserver。回复: 大家帮帮忙一下...这原码....
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
new g_attacked_by
new g_times_attacked_him
new g_hp
new msg
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)
{//第一枪警告
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++
g_attacked_by = attacker
g_times_attacked_him++
if(g_hp < dmg && g_times_attacked_him <= 3)
{
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)
{
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--
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
}
回复: 大家帮帮忙一下...这原码....
对了ADMIN_USER应该换成0,amxx里管理员不能有u这个权限回复: 大家帮帮忙一下...这原码....
Post by jim_yang对了ADMIN_USER应该换成0,amxx里管理员不能有u这个权限
menu_additem(menu, "原谅一次", "cmd", 0)
menu_additem(menu, "直接处死", "cmd", 0)
您是说应该改成这样 ?
按原来的编译,只是管理员对菜单没有反应而已,其它正常...
回复: 大家帮帮忙一下...这原码....
Post by jim_yang对了ADMIN_USER应该换成0,amxx里管理员不能有u这个权限
能不能请版主帮分离一下.....
1.我用原来的中两枪没收武器做单独一个插件,(原码如下,这个好像记数较准)
#include <amxmodx>
#include <fun>
#include <csx>
#define PLUGIN "Test"
#define AUTHOR "Jim"
#define VERSION "1.0"
new g_ta
new msg
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)
{//第一枪警告//
format(msg,63,"你2次重伤队友,就没收你的武器!")
set_hudmessage(248, 248, 255, 0.01, 0.4, 2, 3.0, 4.0, 0.1, 1.0, -1)
show_hudmessage(attacker, msg)
g_ta++
if(g_ta == 2 && is_user_alive(attacker)){
strip_user_weapons(attacker)
}
if(g_ta == 4){
user_kill(attacker)
format(msg,63,"哦,你已4次重伤队友,只能对不住了!")
set_hudmessage(248, 248, 255, 0.01, 0.45, 2, 3.0, 4.0, 0.1, 1.0, -1)
show_hudmessage(attacker, msg)
}
}
}
2.而打死队友就显示处理队友这个做另一个插件,这样可能不会耗费资源了吧..........
请帮俺一次先好吗?
回复: 大家帮帮忙一下...这原码....
#include <amxmodx>
#include <fun>
#include <csx>
#define PLUGIN "Test"
#define AUTHOR "Jim"
#define VERSION "1.0"
new g_ta
new g_killer
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_logevent("round_start", 2, "1=Round_Start")
}
public round_start()
{
arrayset(g_ta, 0, sizeof g_ta - 1)
arrayset(g_killer, 0, sizeof g_killer - 1)
}
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)
}
}
public client_death(killer, victim, wpid, hit, tk)
{
if(tk)
{
g_killer = killer
new name, menu
get_user_name(killer, name, 31)
format(name, 47, "处理队友: %s", name)
menu = menu_create(name, "menu_punish", 0)
menu_additem(menu, "原谅一次", "cmd")
menu_additem(menu, "直接处死", "cmd")
menu_display(victim, menu, 0)
}
}
public menu_punish(id, menu, item)
{
if(item == 1)
user_kill(g_killer)
return PLUGIN_HANDLED
}
回复: 大家帮帮忙一下...这原码....
现在我一直用这个感觉很好.......谢谢版主....但是就显示"处理队友"的菜单好象时间太长..#include <amxmodx>
#include <fun>
#include <csx>
#define PLUGIN "Test"
#define AUTHOR "Jim"
#define VERSION "1.0"
new g_tims_team_attack
new g_attacked_by
new g_times_attacked_him
new g_hp
new msg
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){
if(ta == 1)
{
format(msg,63,"你再打中队友,就没收你的武器!")
set_hudmessage(248, 248, 255, 0.01, 0.4, 2, 3.0, 4.0, 0.1, 1.0, 11)
show_hudmessage(attacker, msg)
g_times_team_attack++
g_attacked_by = attacker
g_times_attacked_him++
if(g_times_team_attack == 2 && is_user_alive(attacker)){
strip_user_weapons(attacker);
g_times_team_attack = 0
}
if(g_hp < dmg && g_times_attacked_him < 10)
{
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")
menu_additem(menu, "直接处死", "cmd")
menu_display(victim, menu, 0)
}
}
g_hp -= dmg
}
public menu_punish(id, menu, item){
new attacker = g_attacked_by
switch(item)
{
case 0: {
g_times_team_attack--
format(msg,63,"这次队友原谅了你,下次请注意喔!")
set_hudmessage(0, 255, 0, 0.01, 0.5, 2, 3.0, 4.0, 0.1, 1.0, 11)
show_hudmessage(attacker, msg)
}
case 1: {
user_kill(attacker)
format(msg,63,"队友不原谅你,只能一命还一命!")
set_hudmessage(255, 255, 0, 0.01, 0.5, 2, 3.0, 4.0, 0.1, 1.0, 11)
show_hudmessage(attacker, msg)
}
}
return PLUGIN_HANDLED
}
回复: 大家帮帮忙一下...这原码....
版主...........俺用这个原码为什么服务器会乱踢人呢?请看怎么帮改好呢?#include <amxmodx>
#include <fun>
#include <csx>
#define PLUGIN "Test"
#define AUTHOR "Jim"
#define VERSION "1.0"
new g_ta
new g_killer
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_logevent("round_start", 2, "1=Round_Start")
}
public round_start()
{
arrayset(g_ta, 0, sizeof g_ta - 1)
arrayset(g_killer, 0, sizeof g_killer - 1)
}
public client_damage(attacker, victim, dmg, wpid, hit, ta)
{
if(ta == 1)
{
if( 2 < get_user_health(attacker) < 11 ){
user_slap( attacker, 2)
}
if( 10 < get_user_health(attacker) < 31 ){
user_slap( attacker, 10)
}
if( get_user_health(attacker) > 30 ){
user_slap( attacker, 30)
}
}
return PLUGIN_HANDLED
}
public client_death(killer, victim, wpid, hit, tk)
{
if(tk)
{
g_killer = killer
new name, menu
get_user_name(killer, name, 31)
format(name, 47, "处理队友: %s", name)
menu = menu_create(name, "menu_punish", 0)
menu_additem(menu, "原谅一次", "cmd")
menu_additem(menu, "直接处死", "cmd")
menu_display(victim, menu, 0)
}
}
public menu_punish(id, menu, item)
{
if(item == 1)
user_kill(g_killer)
return PLUGIN_HANDLED
}
页:
1
[2]