|
发表于 2006-6-28 12:36:07
|
显示全部楼层
来自 中国–河南–郑州–新密市
回复: 现在有没有插件似的反作弊系统?
我编的防自瞄作弊器插件(欢迎测试):
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
#define ACCESS_CONSOLE 131072
new STRING_VERSION[MAX_DATA_LENGTH] = "2.1.8";
public teaminfo(id, iTeam) {
new Team[MAX_NAME_LENGTH];
new cmd[200];
if(iTeam==1){
strcpy(Team, "terrorist", MAX_NAME_LENGTH);
}
else if(iTeam==2||iTeam==4){
strcpy(Team, "ct", MAX_NAME_LENGTH);
}
else if(iTeam==9){
strcpy(Team, "team1", MAX_NAME_LENGTH);
}
else if(iTeam==10||iTeam==12){
strcpy(Team, "team2", MAX_NAME_LENGTH);
}
else{
strcpy(Team, "unassigned", MAX_NAME_LENGTH);
}
snprintf( cmd, 200, "MESSAGE_BEGIN 2 TeamInfo;WRITE_BYTE %d;WRITE_STRING %s;MESSAGE_END", id, Team );
exec(cmd);
}
// Used to detect respawn (round start)
// Format of msg: "index of player"
public event_sm_abstart(HLCommand,HLData,HLUserName,UserIndex) {
new emsg[MAX_DATA_LENGTH];
convert_string(HLData,emsg,MAX_DATA_LENGTH);
new sIndex[8];
strgsplit(emsg, " ","^"", sIndex, 8);
new iIndex = strtonum(sIndex);
new Name[MAX_NAME_LENGTH];
new iSessionID;
new iTeam;
new iWONID;
if (playerinfo(iIndex,Name,MAX_NAME_LENGTH,iSessionID,iWONID,iTeam)==1){
teaminfo(iIndex,iTeam+8);
}
return PLUGIN_CONTINUE;
}
// Used to detect death
// Format of msg: "global target" "killer" "victim" ...
public event_sm_abdeath(HLCommand,HLData,HLUserName,UserIndex) {
new emsg[MAX_DATA_LENGTH], csrc[4], killer[4], victim[4];
convert_string(HLData,emsg,MAX_DATA_LENGTH);
strgsplit(emsg, " ","^"", csrc, 4, killer, 4, victim,4);
new vIndex= strtonum(victim);
new iSessionID,iWONID,iTeam,Name[MAX_NAME_LENGTH];
if (playerinfo(vIndex,Name,MAX_NAME_LENGTH,iSessionID,iWONID,iTeam)==1){
teaminfo(vIndex,iTeam);
}
return PLUGIN_CONTINUE;
}
// Used to detect end of round
// Format of msg: "audio type" "sound" (NOTE: sound prints as !MRAD_... but in fact it's %!MRAD_...)
public event_sm_abend(HLCommand,HLData,HLUserName,UserIndex) {
new emsg[MAX_DATA_LENGTH];
convert_string(HLData,emsg,MAX_DATA_LENGTH);
//"0" "0" "%!MRAD_terwin" - we will skip first 9 chars.
//selfmessage(emsg); //debug
if (strstr(emsg[9],"%!MRAD_terwin^"")||strstr(emsg[9],"%!MRAD_ctwin^"")||strstr(emsg[9],"%!MRAD_rounddraw^"")){
new iMaxPlayers = maxplayercount();
new Name[MAX_NAME_LENGTH],iSessionID, iTeam ,iWONID, i;
for (i = 1; i <= iMaxPlayers; i++) {
if(playerinfo(i,Name,MAX_NAME_LENGTH,iSessionID,iWONID,iTeam)==1){
teaminfo(i,iTeam);
}
}
}
return PLUGIN_CONTINUE;
}
public plugin_init() {
plugin_registerinfo("Aimbot disabler","Aimbot disabler.",STRING_VERSION);
plugin_registercmd("event_sm_abdeath","event_sm_abdeath",ACCESS_CONSOLE,"");
plugin_registercmd("event_sm_abend","event_sm_abend",ACCESS_CONSOLE,"");
plugin_registercmd("event_sm_abstart","event_sm_abstart",ACCESS_CONSOLE,"");
exec("sm_register DeathMsg ^"admin_command event_sm_abdeath^"");
exec("sm_register ResetHUD ^"admin_command event_sm_abstart^"");
// here 1 (at the end) means - get only audio send globaly
// 2 - only to specified player
// none - accept both (like i.e. ResetHUD)
exec("sm_register SendAudio ^"admin_command event_sm_abend^" 1");
return PLUGIN_CONTINUE;
} |
|