So und nochmal....
Wer es aber doch schärfer haben will, nimmt dieses.
GranatenTKs werden nicht gezählt. Aber das Opfer kann sich trotzdem Rächen....Wenn das Opfer es vergisst, wird das System aber nicht automatisch handeln...
Code:
/*
* [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
Ein wenig entschaerft von [WING]Black Knight
Wieder etwas schärfer gemacht von [WING] Sir Drink a lot :-)
*/
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
#define ACCESS_CONSOLE 131072
#define AUTOBAN_IN_FIRST_EIGHT_SECONDS 1
#define AUTOBAN_TK_BAN_TIME 10
#define NUMBER_OF_TKS_RESULT_IN_BAN 3
new STRING_VERSION[MAX_DATA_LENGTH] = "v2.1";
new first_eight_seconds = 0;
new tkedby[MAX_PLAYERS] = {-1,...};
new tkscore[MAX_PLAYERS] = {0,...};
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);
strcpy(outputmessage, victimname, MAX_DATA_LENGTH);
strcat(outputmessage, " wurde tked von ", MAX_DATA_LENGTH);
strcat(outputmessage, tkname, MAX_DATA_LENGTH);
strcat(outputmessage, ", ", MAX_DATA_LENGTH);
strcat(outputmessage, victimname, MAX_DATA_LENGTH);
strcat(outputmessage, " kann schreiben slap, kill or forgive.", MAX_DATA_LENGTH);
say(outputmessage);
}
public tkr_checktk(HLCommand,HLData,HLUserName,UserIndex)
{
new iIDA;
new iIDV;
new iUserID;
new iWONID;
new iTeamA;
new iTeamV;
new Text[MAX_DATA_LENGTH];
new Victim[MAX_NAME_LENGTH];
new TKiller[MAX_NAME_LENGTH];
new weapon[MAX_TEXT_LENGTH];
new sIDA[3];
new sIDV[3];
new Data[MAX_NAME_LENGTH];
convert_string(HLData,Data,MAX_DATA_LENGTH);
strsplit(Data, " ", sIDA, 3, sIDV, 3,weapon,MAX_TEXT_LENGTH);
iIDA = strtonum( sIDA );
iIDV = strtonum( sIDV );
if(playerinfo(iIDA, TKiller, MAX_NAME_LENGTH, iUserID, iWONID, iTeamA))
{
if(playerinfo(iIDV, Victim, MAX_NAME_LENGTH, iUserID, iWONID, iTeamV))
{
if(iTeamV != iTeamA)
return PLUGIN_CONTINUE;
if(first_eight_seconds == 1 && AUTOBAN_IN_FIRST_EIGHT_SECONDS) {
ban(TKiller, AUTOBAN_TK_BAN_TIME);
}
else {
if(strcmp(weapon,"grenade")!=0){
tkscore[iIDA] += 1;
if(tkscore[iIDA]==NUMBER_OF_TKS_RESULT_IN_BAN){
snprintf(Text,MAX_TEXT_LENGTH,"Du hast %i TKs begangen. Nun bist Du als Strafe %i Min gebannt worden",tkscore[iIDA],NUMBER_OF_TKS_RESULT_IN_BAN);
ban(TKiller, AUTOBAN_TK_BAN_TIME);
return PLUGIN_CONTINUE;
}
snprintf(Text,MAX_TEXT_LENGTH,"Vorsichtig.Du hast jetzt %i Teamkills begangen^nUeber %i Teamkills und Du wirst gebannt !",tkscore[iIDA],NUMBER_OF_TKS_RESULT_IN_BAN);
messageex(TKiller,Text,print_chat);
}
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];
new Name[MAX_NAME_LENGTH];
new Text[MAX_TEXT_LENGTH];
new loop;
new iUserID;
new iWONID;
convert_string(HLData,Params,MAX_DATA_LENGTH);
if(strcmp("Round_Start", Params) == 0 )
{
for( loop = 0; loop < MAX_PLAYERS; loop += 1 )
{
if(tkscore[loop]>=1)
{
if( playerinfo(loop, Name, MAX_NAME_LENGTH, iUserID, iWONID ) )
{
tkscore[loop] -= 1;
snprintf(Text,MAX_TEXT_LENGTH,"Da Dich keiner Bestraft hat, muss das System das uebernehmen!^nDu hast nun noch %i Bestrafungen vor Dir!",tkscore[loop]);
messageex(Name,Text,print_chat);
slay(Name);
}
}
}
first_eight_seconds = 1;
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];
convert_string(HLData, Data, MAX_DATA_LENGTH);
strstripquotes(Data);
if(strcmp(Data,"slap") == 0) {
new tkname[MAX_NAME_LENGTH];
new victimname[MAX_NAME_LENGTH];
playerinfo(UserIndex, victimname, MAX_NAME_LENGTH);
if(tkedby[UserIndex]==-1){
messageex(victimname,"Du wurdest von keinem Teammitglied getoetet",print_chat);
return PLUGIN_CONTINUE;
}
playerinfo(tkedby[UserIndex], tkname, MAX_NAME_LENGTH);
slap(tkname);
slap(tkname);
slap(tkname);
slap(tkname);
slap(tkname);
slap(tkname);
strcpy(Data, victimname, MAX_DATA_LENGTH);
strcat(Data, " entschied slap ", MAX_DATA_LENGTH);
strcat(Data, tkname, MAX_DATA_LENGTH);
strcat(Data, " als TK-Rache.", MAX_DATA_LENGTH);
say(Data);
tkedby[UserIndex] = -1;
tkscore[tkedby[UserIndex]]-= 1;
} else if(strcmp(Data,"kill") == 0) {
new tkname[MAX_NAME_LENGTH];
new victimname[MAX_NAME_LENGTH];
playerinfo(UserIndex, victimname, MAX_NAME_LENGTH);
if(tkedby[UserIndex]==-1){
messageex(victimname,"Du wurdest von keinem Teammitglied getoetet",print_chat);
return PLUGIN_CONTINUE;
}
playerinfo(tkedby[UserIndex], tkname, MAX_NAME_LENGTH);
slay(tkname);
strcpy(Data, victimname, MAX_DATA_LENGTH);
strcat(Data, " entschied ", MAX_DATA_LENGTH);
strcat(Data, tkname, MAX_DATA_LENGTH);
strcat(Data, " als TK-Rache zu toeten.", MAX_DATA_LENGTH);
say(Data);
tkedby[UserIndex] = -1;
tkscore[tkedby[UserIndex]]-= 1;
} else if(strcmp(Data,"forgive") == 0) {
new tkname[MAX_NAME_LENGTH];
new victimname[MAX_NAME_LENGTH];
playerinfo(UserIndex, victimname, MAX_NAME_LENGTH);
if(tkedby[UserIndex]==-1){
messageex(victimname,"Du wurdest von keinem Teammitglied getoetet",print_chat);
return PLUGIN_CONTINUE;
}
playerinfo(tkedby[UserIndex], tkname, MAX_NAME_LENGTH);
strcpy(Data, victimname, MAX_DATA_LENGTH);
strcat(Data, " entschied ", MAX_DATA_LENGTH);
strcat(Data, tkname, MAX_DATA_LENGTH);
strcat(Data, " den TK zu vergeben.", MAX_DATA_LENGTH);
say(Data);
tkedby[UserIndex] = -1;
tkscore[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" );
exec( "logd_reg 62 admin_command tkr_world" );
return PLUGIN_CONTINUE;
}
Aber bitte testen...Ich habe nur Bots und kann es deswegen nicht zu 100% Testen....