Jump to content
Sign in to follow this  
frezinator

Anyone knows a good Anti-Team killing script???

Recommended Posts

Here's a good one I use that Demonized put together.

TKP.sqf

/*
TK punishment v 1.1
by Demonized

Teach Team Killers a lesson..

1: Make sure you have a functions module on your map.
2: Place a marker called noTKzone in your base or your no TK zone, or change marker name below in options.
3: Place this in init of any unit you wish to be included in TKP script.
       _nil = [this,"start"] execVM "[color="#FF0000"]TKP[/color].sqf";
*/

_timer = 30;	        // time in seconds until TK´er can move again. 
_increase = 10;	        // extra time in seconds added for every amount of TK´s commited, if its the second TK, it will be total wait of (_timer + _increase + _increase) in seconds.
_distance = 0;	        // this is the distance to noTKzone, if within this punishment will be done, if this is set to 0, punishment will be done no matter where the TK happened.
_noTKzone = "noTKzone";
_message = "You are being punished because of Team killing";

waitUntil {!(isNil "BIS_MPF_InitDone")};
_killer = _this select 0;
if ("start" in _this) exitWith {
if (local _killer) then {_killer addMPEventHandler ["MPkilled", {[(_this select 1),(side (group (_this select 0))),(getPos (_this select 0)),"EH"] execVM "[color="#FF0000"]TKP[/color].sqf"}]};
};
if ("EH" in _this) exitWith {
_side = _this select 1; _pos = _this select 2;
if (_side == (side (group _killer)) AND _killer == player) then {[nil, _killer, "loc", rEXECVM, "[color="#FF0000"]TKP[/color].sqf", _killer, _pos] call RE};
};
if (_killer != player OR (_distance != 0 AND ((_this select 1) distance (getMarkerPos _noTKzone)) > _distance)) exitWith {};
if (TKP) exitWith {rapsheet = rapsheet + 1};
disableUserInput true;
if (isNil "rapsheet") then {rapsheet = 1; TKP = true} else {rapsheet = rapsheet + 1};
_cnt = rapsheet;
_timeLeft = ((_timer - 3) + (_increase * rapsheet));
_killer setVariable ["TKP", true, false];

_text = format["%1 is being punished for total %2 Team kills",(name player),rapsheet];
[nil,nil,rHINT,_text] call RE;

cutText [_message,"BLACK OUT",3];
sleep 3;
while {_timeLeft != 0} do {
_text = format["time left \n %1 \n \n %2",_timeLeft,_message];
cutText [_text,"BLACK FADED",0];
sleep 1;
_timeLeft = _timeLeft - 1;
if (_cnt != rapsheet) then {
	_timeLeft = _timeLeft + (_increase * (rapsheet - _cnt));
	_cnt = rapsheet;
	_text = format["%1 is being punished for total %2 Team kills",(name player),_cnt];
	[nil,nil,rHINT,_text] call RE;
};
};
cutText ["You can now join the game again, be more careful in the future","BLACK IN",5];
_text = format["%1 has finnished his punishment for his %2 Team kills \n \n %1 is now back in play",(name player),_cnt];
[nil,nil,rHINT,_text] call RE;

if (!isNull player) then {disableUserInput false; TKP = false};

Edited by PartyHead

Share this post


Link to post
Share on other sites
Here's a good one I use that Demonized put together.

TKP.sqf

/*
TK punishment v 1.1
by Demonized

Teach Team Killers a lesson..

1: Make sure you have a functions module on your map.
2: Place a marker called noTKzone in your base or your no TK zone, or change marker name below in options.
3: Place this in init of any unit you wish to be included in TKP script.
       _nil = [this,"start"] execVM "scripts\tkp.sqf";
*/

_timer = 30;	        // time in seconds until TK´er can move again. 
_increase = 10;	        // extra time in seconds added for every amount of TK´s commited, if its the second TK, it will be total wait of (_timer + _increase + _increase) in seconds.
_distance = 0;	        // this is the distance to noTKzone, if within this punishment will be done, if this is set to 0, punishment will be done no matter where the TK happened.
_noTKzone = "noTKzone";
_message = "You are being punished because of Team killing";

waitUntil {!(isNil "BIS_MPF_InitDone")};
_killer = _this select 0;
if ("start" in _this) exitWith {
if (local _killer) then {_killer addMPEventHandler ["MPkilled", {[(_this select 1),(side (group (_this select 0))),(getPos (_this select 0)),"EH"] execVM "scripts\BZU_fnc_tkp.sqf"}]};
};
if ("EH" in _this) exitWith {
_side = _this select 1; _pos = _this select 2;
if (_side == (side (group _killer)) AND _killer == player) then {[nil, _killer, "loc", rEXECVM, "scripts\BZU_fnc_tkp.sqf", _killer, _pos] call RE};
};
if (_killer != player OR (_distance != 0 AND ((_this select 1) distance (getMarkerPos _noTKzone)) > _distance)) exitWith {};
if (TKP) exitWith {rapsheet = rapsheet + 1};
disableUserInput true;
if (isNil "rapsheet") then {rapsheet = 1; TKP = true} else {rapsheet = rapsheet + 1};
_cnt = rapsheet;
_timeLeft = ((_timer - 3) + (_increase * rapsheet));
_killer setVariable ["TKP", true, false];

_text = format["%1 is being punished for total %2 Team kills",(name player),rapsheet];
[nil,nil,rHINT,_text] call RE;

cutText [_message,"BLACK OUT",3];
sleep 3;
while {_timeLeft != 0} do {
_text = format["time left \n %1 \n \n %2",_timeLeft,_message];
cutText [_text,"BLACK FADED",0];
sleep 1;
_timeLeft = _timeLeft - 1;
if (_cnt != rapsheet) then {
	_timeLeft = _timeLeft + (_increase * (rapsheet - _cnt));
	_cnt = rapsheet;
	_text = format["%1 is being punished for total %2 Team kills",(name player),_cnt];
	[nil,nil,rHINT,_text] call RE;
};
};
cutText ["You can now join the game again, be more careful in the future","BLACK IN",5];
_text = format["%1 has finnished his punishment for his %2 Team kills \n \n %1 is now back in play",(name player),_cnt];
[nil,nil,rHINT,_text] call RE;

if (!isNull player) then {disableUserInput false; TKP = false};

THere's one problem about this script... when you accidentally died, it will count as team kill... its really annoying

Do you know any other anti-team killing scripts?

Share this post


Link to post
Share on other sites

Try this version, I've made some changes to the script so when you accidentally kill yourself it wont count as a team kill. The changes are shown in red.

TKP.sqf

/*
TK punishment v 1.1
by Demonized

Teach Team Killers a lesson..

1: Make sure you have a functions module on your map.
2: Place a marker called noTKzone in your base or your no TK zone, or change marker name below in options.
3: Place this in init of any unit you wish to be included in TKP script.
       _nil = [this,"start"] execVM "TKP.sqf";
*/

_timer = 30;	        // time in seconds until TK´er can move again. 
_increase = 10;	        // extra time in seconds added for every amount of TK´s commited, if its the second TK, it will be total wait of (_timer + _increase + _increase) in seconds.
_distance = 0;	        // this is the distance to noTKzone, if within this punishment will be done, if this is set to 0, punishment will be done no matter where the TK happened.
_noTKzone = "noTKzone";
_message = "You are being punished because of Team killing";

waitUntil {!(isNil "BIS_MPF_InitDone")};
_killer = _this select 0;
if ("start" in _this) exitWith {
if (local _killer) then {_killer addMPEventHandler ["MPkilled", {[(_this select 1),(side (group (_this select 0))),(getPos (_this select 0))[color="#FF0000"],(_this select 0)[/color],"EH"] execVM "TKP.sqf"}]};
};
if ("EH" in _this) exitWith {
_side = _this select 1; _pos = _this select 2; [color="#FF0000"]_target = _this select 3;[/color]
if (_side == (side (group _killer)) AND (_killer == player) [color="#FF0000"]AND (_target != _killer)[/color]) then {[nil, _killer, "loc", rEXECVM, "TKP.sqf", _killer, _pos] call RE};
};
if (_killer != player OR (_distance != 0 AND ((_this select 1) distance (getMarkerPos _noTKzone)) > _distance)) exitWith {};
if (TKP) exitWith {rapsheet = rapsheet + 1};
disableUserInput true;
if (isNil "rapsheet") then {rapsheet = 1; TKP = true} else {rapsheet = rapsheet + 1};
_cnt = rapsheet;
_timeLeft = ((_timer - 3) + (_increase * rapsheet));
_killer setVariable ["TKP", true, false];

_text = format["%1 is being punished for total %2 Team kills",(name player),rapsheet];
[nil,nil,rHINT,_text] call RE;

cutText [_message,"BLACK OUT",3];
sleep 3;
while {_timeLeft != 0} do {
_text = format["time left \n %1 \n \n %2",_timeLeft,_message];
cutText [_text,"BLACK FADED",0];
sleep 1;
_timeLeft = _timeLeft - 1;
if (_cnt != rapsheet) then {
	_timeLeft = _timeLeft + (_increase * (rapsheet - _cnt));
	_cnt = rapsheet;
	_text = format["%1 is being punished for total %2 Team kills",(name player),_cnt];
	[nil,nil,rHINT,_text] call RE;
};
};
cutText ["You can now join the game again, be more careful in the future","BLACK IN",5];
_text = format["%1 has finnished his punishment for his %2 Team kills \n \n %1 is now back in play",(name player),_cnt];
[nil,nil,rHINT,_text] call RE;

if (!isNull player) then {disableUserInput false; TKP = false};

Hope this is what your after.

Edited by PartyHead

Share this post


Link to post
Share on other sites

//////////ANTI TEAMKILLING
////////////////////////////////////////////////////////////////////////////////
ATK_TKSLIMIT = 4;
ATK_TKSTIME = 60;

ATK_TKS = 0;
ATK_TIMESTAMP = 0;
ATK_IDSTKERS = [];

ATK_F_PUNISH =
{
[] spawn
{
	disableUserInput true;
	hint format [localize "STR_MSG_TK", ATK_TKSLIMIT];
	sleep 5;

	endMission "end1";
};
};

"ATK_PUNISH" addPublicVariableEventHandler
{
if (getPlayerUID player == _this select 1) then
{
	call ATK_F_PUNISH;
};
};

onPlayerConnected
"
if (_uid in ATK_IDSTKERS) then
{
	_uid spawn
	{
		sleep 2;
		ATK_PUNISH = _this;
		publicVariable 'ATK_PUNISH';
	};
};
";

if (isServer) then
{
"ATK_REGTKER" addPublicVariableEventHandler
{
	ATK_IDSTKERS = ATK_IDSTKERS + [_this select 1];

	ATK_PUNISH = _this select 1;
	publicVariable 'ATK_PUNISH';
};
};

"ATK_TKEVENT" addPublicVariableEventHandler
{
if (getPlayerUID player == _this select 1) then
{
	ATK_TKS = ATK_TKS + 1;

	if (ATK_TKS == 1) then
	{
		ATK_TIMESTAMP = serverTime;
	}
	else
	{
		if (serverTime - ATK_TIMESTAMP < ATK_TKSTIME) then
		{
			if (ATK_TKS > ATK_TKSLIMIT) then
			{
				ATK_REGTKER = getPlayerUID player;
				publicVariable "ATK_REGTKER";
			};
		}
		else
		{
			if (ATK_TKS > ATK_TKSLIMIT) then
			{
				ATK_TKS = 1;
				ATK_TIMESTAMP = serverTime;
			};
		};
	};
};
};

if (! isDedicated) then
{
[] spawn
{
	waitUntil {alive player};
	player setVariable ["ATK_PLAYERSIDE", side player, true];

	player addEventHandler
	[
		"killed",
		{
			if (_this select 1 getVariable "ATK_PLAYERSIDE" == playerSide) then
			{
				ATK_TKEVENT = getPlayerUID (_this select 1);
				publicVariable "ATK_TKEVENT";
			};
		}
	];
};
};
////////////////////////////////////////////////////////////////////////////////

I found this in forum.give name to this script and call it from init.sqf.

anti teamkilling system & automatic ban

easy way is if you playing Coop, use a trigger.

0X0

none

repeatedly

condition:

Score player<-2

act:

removeAllWeapons player;

You can change score number ( at now for 3 team kill, teamkiller will punish)

also you can use more option for punish like move teamkiller to far away with this:

player setpos getpos teamkillpoint;

Use Bi wiki for find more code's to use against teamkillers.

almost teamkilling happen in base.one of best way is protect everything in base.

use this thread to protect base: ProtectionZone_Ep1

Share this post


Link to post
Share on other sites
//////////ANTI TEAMKILLING
////////////////////////////////////////////////////////////////////////////////
ATK_TKSLIMIT = 4;
ATK_TKSTIME = 60;

ATK_TKS = 0;
ATK_TIMESTAMP = 0;
ATK_IDSTKERS = [];

ATK_F_PUNISH =
{
[] spawn
{
	disableUserInput true;
	hint format [localize "STR_MSG_TK", ATK_TKSLIMIT];
	sleep 5;

	endMission "end1";
};
};

"ATK_PUNISH" addPublicVariableEventHandler
{
if (getPlayerUID player == _this select 1) then
{
	call ATK_F_PUNISH;
};
};

onPlayerConnected
"
if (_uid in ATK_IDSTKERS) then
{
	_uid spawn
	{
		sleep 2;
		ATK_PUNISH = _this;
		publicVariable 'ATK_PUNISH';
	};
};
";

if (isServer) then
{
"ATK_REGTKER" addPublicVariableEventHandler
{
	ATK_IDSTKERS = ATK_IDSTKERS + [_this select 1];

	ATK_PUNISH = _this select 1;
	publicVariable 'ATK_PUNISH';
};
};

"ATK_TKEVENT" addPublicVariableEventHandler
{
if (getPlayerUID player == _this select 1) then
{
	ATK_TKS = ATK_TKS + 1;

	if (ATK_TKS == 1) then
	{
		ATK_TIMESTAMP = serverTime;
	}
	else
	{
		if (serverTime - ATK_TIMESTAMP < ATK_TKSTIME) then
		{
			if (ATK_TKS > ATK_TKSLIMIT) then
			{
				ATK_REGTKER = getPlayerUID player;
				publicVariable "ATK_REGTKER";
			};
		}
		else
		{
			if (ATK_TKS > ATK_TKSLIMIT) then
			{
				ATK_TKS = 1;
				ATK_TIMESTAMP = serverTime;
			};
		};
	};
};
};

if (! isDedicated) then
{
[] spawn
{
	waitUntil {alive player};
	player setVariable ["ATK_PLAYERSIDE", side player, true];

	player addEventHandler
	[
		"killed",
		{
			if (_this select 1 getVariable "ATK_PLAYERSIDE" == playerSide) then
			{
				ATK_TKEVENT = getPlayerUID (_this select 1);
				publicVariable "ATK_TKEVENT";
			};
		}
	];
};
};
////////////////////////////////////////////////////////////////////////////////

I found this in forum.give name to this script and call it from init.sqf.

anti teamkilling system & automatic ban

easy way is if you playing Coop, use a trigger.

0X0

none

repeatedly

condition:

Score player<-2

act:

removeAllWeapons player;

You can change score number ( at now for 3 team kill, teamkiller will punish)

also you can use more option for punish like move teamkiller to far away with this:

player setpos getpos teamkillpoint;

Use Bi wiki for find more code's to use against teamkillers.

almost teamkilling happen in base.one of best way is protect everything in base.

use this thread to protect base: ProtectionZone_Ep1

I used the game logic and the trigger

it works perfectly fine!!!!!!!!!!!!!!!!!!! Thank you so much!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Edited by frezinator

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×