/* * [WHO]Them's anti-tk script * original code borrowed from bud-froggy to expedite release * * this script is very similar to the anti-tk actions of the original csbot Edited by Kndroc to be complient with LogD 1.0 Little bit disarmed by [WING]Black Knight */ #include <core> #include <console> #include <string> #include <admin> #include <adminlib> #define ACCESS_CONSOLE 131072 #define TK_BAN_TIME 1 #define AUTOBAN_IN_FIRST_EIGHT_SECONDS 0 #define AUTOBAN_TK_BAN_TIME 1 new STRING_VERSION[MAX_DATA_LENGTH] = "2.50.42"; new first_eight_seconds = 0; new tkedby[MAX_PLAYERS] = {-1,...}; public victimoptionssay(tkid, victimid) { new outputmessage[MAX_DATA_LENGTH]; new tkname[MAX_NAME_LENGTH]; new victimname[MAX_NAME_LENGTH]; playerinfo(tkid, tkname, MAX_NAME_LENGTH); playerinfo(victimid, victimname, MAX_NAME_LENGTH); snprintf(outputmessage, MAX_DATA_LENGTH, "%s was teamkilled by %s, %s may say slap, kill or forgive..",victimname,tkname,victimname); say(outputmessage); } public tkr_checktk(HLCommand,HLData,HLUserName,UserIndex) { new iIDA; new iIDV; new iTeamA; new iTeamV; new sIDA[3]; new sIDV[3]; new DataA[MAX_NAME_LENGTH]; new DataV[MAX_NAME_LENGTH]; new Data[MAX_DATA_LENGTH]; convert_string(HLData,Data,MAX_DATA_LENGTH); strsplit(Data, " ", sIDA, 3, sIDV, 3 ); iIDA = strtonum( sIDA ); iIDV = strtonum( sIDV ); if(playerinfo(iIDA, DataA, MAX_NAME_LENGTH,_,_,iTeamA)) { if(playerinfo(iIDV, DataV, MAX_NAME_LENGTH,_,_,iTeamV)) { if(iTeamV != iTeamA){ return PLUGIN_CONTINUE; } if(first_eight_seconds == 1 && AUTOBAN_IN_FIRST_EIGHT_SECONDS) { ban(DataA, AUTOBAN_TK_BAN_TIME); } else { tkedby[iIDV] = iIDA; victimoptionssay(iIDA, iIDV); log("[LogD] tkPunish called"); } } } return PLUGIN_CONTINUE; } public tkr_world(HLCommand,HLData,HLUserName,UserIndex) { new Params[MAX_DATA_LENGTH]; convert_string(HLData,Params,MAX_DATA_LENGTH); if(Params[6]=='S') { first_eight_seconds = 0; set_timer("eightsecondsover", 8, 0); } return PLUGIN_CONTINUE; } public eightsecondsover() { first_eight_seconds = 0; } public HandleSay(HLCommand,HLData,HLUserName,UserIndex) { new Data[MAX_DATA_LENGTH]; new tkname[MAX_NAME_LENGTH]; new victimname[MAX_NAME_LENGTH]; convert_string(HLData, Data, MAX_DATA_LENGTH); strstripquotes(Data); if(tkedby[UserIndex]==-1){ return PLUGIN_CONTINUE; } playerinfo(tkedby[UserIndex], tkname, MAX_NAME_LENGTH); playerinfo(UserIndex, victimname, MAX_NAME_LENGTH); if(strcmp(Data,"slap") == 0) { new i; for(i=1;i<=6;i++) { slap(tkname); } snprintf(Data,MAX_DATA_LENGTH,"%s decided to slap %s for tk revenge.",victimname,tkname); say(Data); tkedby[UserIndex] = -1; } else if(strcmp(Data,"kill") == 0) { slay(tkname); snprintf(Data,MAX_DATA_LENGTH,"%s decided to have %s executed for tk revenge.",victimname,tkname); say(Data); tkedby[UserIndex] = -1; } else if(strcmp(Data,"forgive") == 0) { snprintf(Data,MAX_DATA_LENGTH,"%s decided to forgive %s and forfeit revenge.",victimname,tkname); say(Data); tkedby[UserIndex] = -1; } return PLUGIN_CONTINUE; } public plugin_connect(HLUserName, HLIP, UserIndex) { new i=1; if (UserIndex >= 1 && UserIndex <= MAX_PLAYERS) { for(i=1;i<=MAX_PLAYERS;i++) { if(tkedby[i] == UserIndex) { tkedby[i] = -1; } if(tkedby[UserIndex] != -1) { tkedby[UserIndex] = -1; } } tkedby[UserIndex] = -1; } return PLUGIN_CONTINUE; } public plugin_disconnect(HLUserName, UserIndex) { new i=1; if (UserIndex >= 1 && UserIndex <= MAX_PLAYERS) { for(i=1;i<=MAX_PLAYERS;i++) { if(tkedby[i] == UserIndex) { tkedby[i] = -1; } if(tkedby[UserIndex] != -1) { tkedby[UserIndex] = -1; } } tkedby[UserIndex] = -1; } return PLUGIN_CONTINUE; } public plugin_init() { plugin_registerinfo("Team Killing Detection ([WHO]Them variant)",".",STRING_VERSION); plugin_registercmd("tkr_checktk", "tkr_checktk", ACCESS_CONSOLE); plugin_registercmd("tkr_world", "tkr_world", ACCESS_CONSOLE); plugin_registercmd("say","HandleSay",ACCESS_ALL); plugin_registercmd("say_team", "HandleSay", ACCESS_ALL); exec("logd_reg 57 admin_command tkr_checktk",1); exec("logd_reg 62 admin_command tkr_world",1); return PLUGIN_CONTINUE; }