Jump to content
Sign in to follow this  
d3nn16

anti teamkilling system & automatic ban

Recommended Posts

Some friends asked me if I can script an anti teamkill system for their maps, so I'm working on it but I'm posting here in case some among you have already written these kind of scripts.

And also they would like to ban a teamkiller automatically.

I know I can get the player ArmA ID with onPlayerConnected command.

I can check a teamkill with killed event handler.

I can end a mission for a team killer with endmission command.

But is it possible to record IDs in a file from a mission ? Or is it possible to ban a teamkiller from a mission ?

Or even let players leave comments while playing a mission to server admin and with the teamkiller's ID in a file ?

Share this post


Link to post
Share on other sites

Be careful, poor piloting of a full bird will rack up more teamkills faster than anything.

Share this post


Link to post
Share on other sites

I think the best solution is to use statistics.

You can't say for sure someone is a real disturbed team killer by looking at few team kills in one mission.

The best is to end the mission for someone who does a specific number of teamkills above a threshold and in a specific time frame. Also record his ID in a file along with timestamps for each one of his teamkills.

Then the file could be analyzed and team killers will appear as IDs for which there are a regular number of team kills separated by a few seconds delays in several missions.

Share this post


Link to post
Share on other sites

And here is the script (It works but I changed it to use the getPlayerUID command and didn't test it after) :

//////////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";
			};
		}
	];
};
};
////////////////////////////////////////////////////////////////////////////////

Share this post


Link to post
Share on other sites
And here is the script (It works but I changed it to use the getPlayerUID command and didn't test it after) :

//////////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';
};
};

How do you run this script?

Share this post


Link to post
Share on other sites

what happens when your in armour and a rocket hits you? Isn;t the driver credited with the deaths of the occupants?

Share this post


Link to post
Share on other sites

If you are going to run scripts like this please put some contact details on the server. It's possible someone may get banned for accidents eg crashing a Helo or a badly placed nade or Satchel charge. They need a means of appeal.

I remember 6 players running towards a radio tower and someone the other side of the hill let off the satchel charge. It was just an accident, he didn't intentionally team kill. He healed everyone so it was a laugh in the end. We told him off for not checking on TS 1st.

I was banned from a server because someone was blowing up vehicles in base. It wasn't me, I had just joined the lobby and wasn't even in the game!

I think they just banned everyone they did not know. The server did not have contact details so I could not appeal - that's unfair. :(

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  

×