|
我的本意是想NOSXE玩家在几秒种内连杀几人就被服务器踢出,并给出踢出原因,以防止暴力作弊器!
目的是达到了,NOSXE玩家确实连杀会被踢,但与此同时,服务器也会挂掉,我查不出来是什么原因,麻烦你给看看,谢谢了!本插件是参考别人写的连杀奖励插件!
#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <memhack>
stock get_name(id, name[], len)
{
new buffer = engfunc(EngFunc_GetInfoKeyBuffer, id)
new strtmp1[256]
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[len - 1] = 0
}
new p_lastkiller = 0
new p_lasttime[4] = {0,...}
//new p_lasths[4] = {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[32]
get_name( killer , name , 31 )
if((killer == p_lastkiller) && (contain(name, "[NO-sXe-I]") != -1)){
p_count++
move_data()
p_lasttime[0] = get_systime()
//p_lasths[0] = headshot
if(p_count>=2){
new s_time = get_systime()
if(s_time - p_lasttime[2]<=5){ //这里意思是4秒内
p_count = 0
//new headshotcount = p_lasths[0] + p_lasths[1] + p_lasths[2]
clear_data()
new sXe_version[64]
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[512];
//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[0] = get_systime()
//p_lasths[0] = 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[i-1]
//p_lasths = p_lasths[i-1]
}
}
clear_data(){
for(new i = 3;i>=0;i--){
p_lasttime = 0
//p_lasths = 0
}
} |
|