Jump to content
Coolinator

Anyone knows a good Anti Team Kill script that works for coop mission multiplayer?

Recommended Posts

No problem, let me know if something doesn't work, but add details!

Will do! :)

Share this post


Link to post
Share on other sites

I just tested it didn't work, one my friend killed 8 players by rockets he didnt get kicked.:( but i think the reason it didn't work is because that im running Farrooq revive script? But i tested iceman anti kill script by disabling player's keyboard for team damage, it works! but i tihnk disabling keyboard is too cruel and harsh. and the player canno press escape to exit the lobby.

Share this post


Link to post
Share on other sites
I just tested it didn't work, one my friend killed 8 players by rockets he didnt get kicked.:( but i think the reason it didn't work is because that im running Farrooq revive script? But i tested iceman anti kill script by disabling player's keyboard for team damage, it works! but i tihnk disabling keyboard is too cruel and harsh. and the player canno press escape to exit the lobby.

I haven't looked inside any revive scripts and I don't really plan to, but just reading this bug report makes me think that the "fired" event handler never goes off. Try disabling farooq's revive and see if it works then, after that we can make some progress on an alternate system

Share this post


Link to post
Share on other sites
I haven't looked inside any revive scripts and I don't really plan to, but just reading this bug report makes me think that the "fired" event handler never goes off. Try disabling farooq's revive and see if it works then, after that we can make some progress on an alternate system

Using a farooq revive, you don't instantly kill someone, you only injured the player, so i guess thats the problem. But i will try to create a separate test mission just for anti TK script without any revive scripts, and see how it goes.

Kinda busy for now, but whenever i get a chance to test it, i post the results right away :)

Share this post


Link to post
Share on other sites

Sorry for just testing it right now, it's been a long time...

I made a testing mission just for this anti TK script, then tested it in dedicated server with a friend. Results, didn't work. No punishments, and no warning messages. :(

Here's what i used in my testing mission.

Description.ext

author = "Captain James";							
onLoadName = "testing";												
OnLoadMission = "Dedicated server testing";


class Header {
gameType = COOP;													
minPlayers = 1;														
maxPlayers = 15;													
}; 


enableDebugConsole = 0;													
disabledAI = 1;
joinUnassigned = 1;

respawn = "BASE";
respawnDialog = 1;
respawnDelay = 10;



class CfgDebriefing
{        
       class teamkillEnd 
       { 
       title = "Mission Failed"; 
       subtitle = "You killed too many teammates."; 
       description = "You killed too many of your teammates."; //intentionally different so you can see where the game puts both messages
       }; 
};

init.sqf

waitUntil {player == player};
unitConnected = player;
publicVariableServer "unitConnected";

initServer.sqf

trustedUIDs = [];
teamkillLimit = 2;

"unitConnected" addPublicVariableEventHandler
{
   (_this select 1) addEventHandler ["killed", handleTeamkill];
};
["removeTeamkill", "onPlayerDisconnected",
{
   //not really sure what happens when a player disconnects...does it turn into AI?
}] call BIS_fnc_addStackedEventHandler;

handleTeamkill = compileFinal
'
   _unit = _this select 0;
   _killer = _this select 1;
   if (((side _unit) == (side _killer)) && {!((getPlayerUID _killer) in trustedUIDs)}) then
   {
       missionNamespace setVariable [format ["TK_%1", name _killer], missionNamespace getVariable [format ["TK_%1", name _killer], 0] + 1];
       if (missionNamespace getVariable [format ["TK_%1", name _killer], 0] == teamkillLimit) then
       {
           ["teamkillEnd", false] BIS_fnc_endMission;
       }else
       {
           [format ["Please do not kill teammates. You have been warned %1 times", missionNamespace getVariable [format ["TK_%1", name _killer], 0]], "systemChat", _killer] call BIS_fnc_MP;
       };
   };
';

//{
//    if (isPlayer) then
//    {
//        _x addEventHandler ["killed", handleTeamkill];
//    };
//}forEach playableUnits; //commented this part out because I think it's not necessary anymore  

Share this post


Link to post
Share on other sites
On 11/10/2014 at 6:06 PM, Tajin said:

 


TRUSTEDUIDS = []; // UID Strings
TEAMATTACKLIMIT = 5;

fnc_taPunish = {
private ["_s","_p","_ta"]; 
_s = _this select 0;
_p = _this select 1;
_ta = _this select 2;

if ((getPlayerUID _s) in TRUSTEDUIDS) exitWith {};

systemChat format["[Teamattack warning %1/%2]: %3 has attacked %4!", _ta, TEAMATTACKLIMIT, name _s, name _p];

if (_ta >= TEAMATTACKLIMIT) then {
	if (local _s) then {
		"end1" call BIS_fnc_endMission;
	};
	systemChat format["%1 has been removed for excessive teamattacks!",name _s];
}
};

if (!isDedicated) then {
   player addEventHandler ["HandleDamage", {
   	private ["_dmg","_p","_s","_pSide","_sSide","_ta"]; 
   	_dmg = _this select 2;
   	_p = _this select 0;
   	_s = _this select 3;
   	_pSide = side(_p);
   	_sSide = side(_s);

   	if(_pSide == _sSide) then {
   		_dmg = {};
   		_ta = (_s getVariable["teamattacks",0]) + 1;
   		_s setVariable["teamattacks",_ta,true];
   		[ [_s,_p,_ta], "fnc_taPunish", true] spawn BIS_fnc_MP;
   	};

   	_dmg
   };
};

 
 
 

 

Does this method still work? cause I am trying to get it to work and its saying error on line 39.

Any method of kicking team killers please?

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

×