R版主,又来麻烦你了,这个插件有点问题!
我的本意是想NOSXE玩家在几秒种内连杀几人就被服务器踢出,并给出踢出原因,以防止暴力作弊器!目的是达到了,NOSXE玩家确实连杀会被踢,但与此同时,服务器也会挂掉,我查不出来是什么原因,麻烦你给看看,谢谢了!本插件是参考别人写的连杀奖励插件!
#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <memhack>
stock get_name(id, name[], len)
{
new buffer = engfunc(EngFunc_GetInfoKeyBuffer, id)
new strtmp1
copy_infokey_buffer(buffer, strtmp1, 255)
new offset = contain(strtmp1, "\name\") + 6
new thischr
new i
for (;;i++)
{
thischr = memhack_get_char(buffer + offset + i, MEM_NULLBASE, MEMTYPE_DATA, MEM_SIGNED)
if (thischr == '\' || thischr == 0)
{
name = 0
break
}
else
{
name = thischr
}
}
name = 0
}
new p_lastkiller = 0
new p_lasttime = {0,...}
//new p_lasths = {0,...}
new p_count = 0
public plugin_init() {
register_plugin("KillInseconds", "1.0", "Marshall")
register_event("DeathMsg", "hook_death", "a")
register_logevent("hook_roundstart",2,"0=World triggered","1=Round_Start")
}
public hook_death(){
new killer = read_data(1)
//new headshot = read_data(3)
new name
get_name( killer , name , 31 )
if((killer == p_lastkiller) && (contain(name, "") != -1)){
p_count++
move_data()
p_lasttime = get_systime()
//p_lasths = headshot
if(p_count>=2){
new s_time = get_systime()
if(s_time - p_lasttime<=5){ //这里意思是4秒内
p_count = 0
//new headshotcount = p_lasths + p_lasths + p_lasths
clear_data()
new sXe_version
get_cvar_string("__sxei_clt_ver",sXe_version,63)
server_cmd("kick #%d [提示]你没有开sXe%s反作弊器,请到www.yb-st.cn下载!",get_user_userid(killer),sXe_version);
server_exec();
client_print ( 0, print_chat,"玩家 %s 在5秒内杀了2个人,由于他没有开SXE%s,因此被踢出服务器!",name,sXe_version)
//new szMessage;
//format( szMessage, 511, "^x04 %s ^x01 在5秒内杀了2个人,由于他没有开SXE,因此被踢出服务器!",name,sXe_version)
//client_color(0,id,szMessage);
}
}
}
else{
p_lastkiller = killer
p_count = 1
clear_data()
p_lasttime = get_systime()
//p_lasths = headshot
}
}
public hook_roundstart(){
p_lastkiller = 0
p_count = 0
clear_data()
}
move_data(){
for(new i = 3;i>=1;i--){
p_lasttime = p_lasttime
//p_lasths = p_lasths
}
}
clear_data(){
for(new i = 3;i>=0;i--){
p_lasttime = 0
//p_lasths = 0
}
} 不要使用get_name,改成用get_user_name试试。 R版主,不行啊,一踢作弊的,服务器马上就挂! stock get_name(id, name[], len)
在中文插件里面有吧。其他插件用的话不用再写一次吧。 stock get_name(id, name[], len)
在中文插件里面有吧。其他插件用的话不用再写一次吧。
Cr@zyTreE 发表于 2009-8-15 09:56 http://www.dt-club.net/forum/images/common/back.gif
不写的话,是无法编译的! 本帖最后由 Rulzy 于 2009-8-15 12:14 编辑
用这个试试,带参数控制,本人未测试:#include <amxmodx>
#include <amxmisc>
#define MAXKILLCOUNT 10
new g_lastkiller = 0;
new g_killcount = 0;
new Float: g_killtime = {0.0,...};
public plugin_init()
{
register_plugin("KillInseconds", "1.0", "Rulzy");
register_cvar("amx_nosxe_kill_count", "3");
register_cvar("amx_nosxe_kill_seconds", "5");
register_event("DeathMsg", "eDeath", "a", "1!0");
}
public eDeath()
{
new killer = read_data(1);
if(!is_user_connected(killer)) return PLUGIN_CONTINUE;
if(killer==g_lastkiller)
{
g_killcount++;
new count = get_cvar_num("amx_nosxe_kill_count");
if(count>MAXKILLCOUNT)
count=MAXKILLCOUNT;
else if(count<1)
count = 1;
new seconds = get_cvar_num("amx_nosxe_kill_seconds");
if(g_killcount>=count)
{
g_killcount = count;
move_data(count);
g_killtime = get_gametime();
new name;
get_user_name(killer, name, 31);
if(g_killtime-g_killtime<float(seconds) && contain(name, "")!=-1)
{
new sXe_version;
get_cvar_string("__sxei_clt_ver", sXe_version, 31);
server_cmd("kick #%d [提示]你没有开sXe%s反作弊器,请到www.yb-st.cn下载!", get_user_userid(killer), sXe_version);
server_exec();
client_print ( 0, print_chat,"玩家 %s 在%d秒内连杀%d个人,由于他没有开SXE%s,因此被踢出服务器!", name, seconds, count, sXe_version);
}
}else{
g_killtime = get_gametime();
}
}else{
g_lastkiller = killer;
g_killcount = 1;
g_killtime = get_gametime();
}
return PLUGIN_CONTINUE;
}
stock move_data(count){
for(new i=count-1; i>0; i--)
{
g_killtime = g_killtime
}
} 唉,还是不行,老情况,连续杀人被T后服务器要挂! 那应该跟这个插件没什么关系,肯定是其他插件引起的。 恩,我想也是,可能是和其它哪个插件有了冲突造成的! 这个连杀函数我要看看
页:
[1]