Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
frezinator

Need help on fixing anti-team killing punishment!!!

Recommended Posts

im using an anti-team killing punishment script. It works great but the problem is that when you accidentally kill yourself it will also count as teamkill...

Does anyone know how to fix this???

Here is the script:

/*
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 DMZ_TKP_marker 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.
	_null = [this,"start"] execVM "TKP.sqf";
*/

_timer = 0;	// time in seconds until TK´er can move again. 
_increase = 60;	// 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 DMZ_TKP_marker, if within this punishment will be done, if this is set to 0, punishment will be done no matter where the TK happened.
// default marker used, can be any marker, for example "respawn_west".
_noTKzone = "DMZ_TKP_marker";
// message given to Team killer.
_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 addEventHandler ["killed", {[(_this select 1),(side (group (_this select 0))),(getPos (_this select 0)),"EH"] execVM "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, "TKP.sqf", _killer, _pos] call RE};
};
if (_killer != player OR (_distance != 0 AND ((_this select 1) distance (getMarkerPos _noTKzone)) > _distance)) exitWith {};
if (DMZ_TKP) exitWith {DMZ_TKP_rapsheet = DMZ_TKP_rapsheet + 1};
disableUserInput true;
if (isNil "DMZ_TKP_rapsheet") then {DMZ_TKP_rapsheet = 1; DMZ_TKP = true} else {DMZ_TKP_rapsheet = DMZ_TKP_rapsheet + 1};
_cnt = DMZ_TKP_rapsheet;
_timeLeft = ((_timer - 3) + (_increase * DMZ_TKP_rapsheet));
_killer setVariable ["DMZ_TKP", true, false];

_text = format["%1 is being punished for total %2 Team kills",(name player),DMZ_TKP_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 != DMZ_TKP_rapsheet) then {
	_timeLeft = _timeLeft + (_increase * (DMZ_TKP_rapsheet - _cnt));
	_cnt = DMZ_TKP_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; DMZ_TKP = false};

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.

I've also posted this in your other post of the same topic.

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 != player)[/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};

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.

I've also posted this in your other post of the same topic.

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 != player)[/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};

i just finished testing it..

i tried to kill myself and it didn't count as teakill.. but this time i tried to kill my teammates it didn't count as teamkill and i didn't get punish...

Do you know whats wrong?

Share this post


Link to post
Share on other sites

Hmmm I can only test with AI units and it works. Try this, I've changed "player" to "_killer" shown again in red.

/*
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)),(_this select 0),"EH"] execVM "TKP.sqf"}]};
};
if ("EH" in _this) exitWith {
_side = _this select 1; _pos = _this select 2; _target = _this select 3;
if (_side == (side (group _killer)) AND (_killer == player) AND (_target != [color="#FF0000"]_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};

Share this post


Link to post
Share on other sites
Hmmm I can only test with AI units and it works. Try this, I've changed "player" to "_killer" shown again in red.

/*
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)),(_this select 0),"EH"] execVM "TKP.sqf"}]};
};
if ("EH" in _this) exitWith {
_side = _this select 1; _pos = _this select 2; _target = _this select 3;
if (_side == (side (group _killer)) AND (_killer == player) AND (_target != [color="#FF0000"]_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};

I just tested it, it still wont work..

Also, what I noticed is that ur script is different the script that I showed. you used "noTKzone" and I use "DMZ_TKP_marker", so I tried changing it to noTKzone but it still wont work... :(

Could you just edit this script for me??? and paste it back here when ur done?? then im just gonna test it again see if it works

/* 
   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 DMZ_TKP_marker 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. 
       _null = [this,"start"] execVM "TKP.sqf"; 
*/ 

_timer = 0;    // time in seconds until TK´er can move again.  
_increase = 60;    // 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 DMZ_TKP_marker, if within this punishment will be done, if this is set to 0, punishment will be done no matter where the TK happened. 
// default marker used, can be any marker, for example "respawn_west". 
_noTKzone = "DMZ_TKP_marker"; 
// message given to Team killer. 
_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 addEventHandler ["killed", {[(_this select 1),(side (group (_this select 0))),(getPos (_this select 0)),"EH"] execVM "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, "TKP.sqf", _killer, _pos] call RE}; 
}; 
if (_killer != player OR (_distance != 0 AND ((_this select 1) distance (getMarkerPos _noTKzone)) > _distance)) exitWith {}; 
if (DMZ_TKP) exitWith {DMZ_TKP_rapsheet = DMZ_TKP_rapsheet + 1}; 
disableUserInput true; 
if (isNil "DMZ_TKP_rapsheet") then {DMZ_TKP_rapsheet = 1; DMZ_TKP = true} else {DMZ_TKP_rapsheet = DMZ_TKP_rapsheet + 1}; 
_cnt = DMZ_TKP_rapsheet; 
_timeLeft = ((_timer - 3) + (_increase * DMZ_TKP_rapsheet)); 
_killer setVariable ["DMZ_TKP", true, false]; 

_text = format["%1 is being punished for total %2 Team kills",(name player),DMZ_TKP_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 != DMZ_TKP_rapsheet) then { 
       _timeLeft = _timeLeft + (_increase * (DMZ_TKP_rapsheet - _cnt)); 
       _cnt = DMZ_TKP_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; DMZ_TKP = false};  

One more thing, what did you use for init.sqf? or init's player box?

Share this post


Link to post
Share on other sites

I'm not sure, but maybe you could put something like this in there. Sorry if I couldn't be of more help.

If ((Local _Killer) && (Player == _Killer)) ExitWith {};

Share this post


Link to post
Share on other sites
I'm not sure, but maybe you could put something like this in there. Sorry if I couldn't be of more help.

If ((Local _Killer) && (Player == _Killer)) ExitWith {};

Where do I put that?

Share this post


Link to post
Share on other sites

Right before it's going to punish the killer.

---------- Post added at 21:42 ---------- Previous post was at 21:40 ----------

The player is going to be local to his own machine. So, maybe you can use player to see if he's the killer or not. If he is (suicide), then exit the script before he punishes himself.

Share this post


Link to post
Share on other sites

This is your script that I've made the changes to and it works for me. It punishes me for a team kill and when i kill myself with a grenade i don't get punished, i don't know why it does not work for you.

/* 
   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 DMZ_TKP_marker 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. 
       _null = [this,"start"] execVM "TKP.sqf"; 
*/ 

_timer = 0;    // time in seconds until TK´er can move again.  
_increase = 60;    // 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 DMZ_TKP_marker, if within this punishment will be done, if this is set to 0, punishment will be done no matter where the TK happened. 
// default marker used, can be any marker, for example "respawn_west". 
_noTKzone = "DMZ_TKP_marker"; 
// message given to Team killer. 
_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 addEventHandler ["killed", {[(_this select 1),(side (group (_this select 0))),(getPos (_this select 0)),(_this select 0),"EH"] execVM "TKP.sqf"}]}; 
}; 
if ("EH" in _this) exitWith { 
   _side = _this select 1; _pos = _this select 2; _target = _this select 3; 
   if (_side == (side (group _killer)) AND (_killer == player) AND (_killer != _target)) then {[nil, _killer, "loc", rEXECVM, "TKP.sqf", _killer, _pos] call RE}else{}; 
}; 
if (_killer != player OR (_distance != 0 AND ((_this select 1) distance (getMarkerPos _noTKzone)) > _distance)) exitWith {}; 
if (DMZ_TKP) exitWith {DMZ_TKP_rapsheet = DMZ_TKP_rapsheet + 1}; 
disableUserInput true; 
if (isNil "DMZ_TKP_rapsheet") then {DMZ_TKP_rapsheet = 1; DMZ_TKP = true} else {DMZ_TKP_rapsheet = DMZ_TKP_rapsheet + 1}; 
_cnt = DMZ_TKP_rapsheet; 
_timeLeft = ((_timer - 3) + (_increase * DMZ_TKP_rapsheet)); 
_killer setVariable ["DMZ_TKP", true, false]; 

_text = format["%1 is being punished for total %2 Team kills",(name player),DMZ_TKP_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 != DMZ_TKP_rapsheet) then { 
       _timeLeft = _timeLeft + (_increase * (DMZ_TKP_rapsheet - _cnt)); 
       _cnt = DMZ_TKP_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; DMZ_TKP = false};

Edited by PartyHead

Share this post


Link to post
Share on other sites
This is your script that I've made the changes to and it works for me. It punishes me for a team kill and when i kill myself with a grenade i don't get punished, i don't know why it does not work for you.

/* 
   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 DMZ_TKP_marker 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. 
       _null = [this,"start"] execVM "TKP.sqf"; 
*/ 

_timer = 0;    // time in seconds until TK´er can move again.  
_increase = 60;    // 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 DMZ_TKP_marker, if within this punishment will be done, if this is set to 0, punishment will be done no matter where the TK happened. 
// default marker used, can be any marker, for example "respawn_west". 
_noTKzone = "DMZ_TKP_marker"; 
// message given to Team killer. 
_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 addEventHandler ["killed", {[(_this select 1),(side (group (_this select 0))),(getPos (_this select 0)),(_this select 0),"EH"] execVM "TKP.sqf"}]}; 
}; 
if ("EH" in _this) exitWith { 
   _side = _this select 1; _pos = _this select 2; _target = _this select 3; 
   if (_side == (side (group _killer)) AND (_killer == player) AND (_killer != _target)) then {[nil, _killer, "loc", rEXECVM, "TKP.sqf", _killer, _pos] call RE}else{}; 
}; 
if (_killer != player OR (_distance != 0 AND ((_this select 1) distance (getMarkerPos _noTKzone)) > _distance)) exitWith {}; 
if (DMZ_TKP) exitWith {DMZ_TKP_rapsheet = DMZ_TKP_rapsheet + 1}; 
disableUserInput true; 
if (isNil "DMZ_TKP_rapsheet") then {DMZ_TKP_rapsheet = 1; DMZ_TKP = true} else {DMZ_TKP_rapsheet = DMZ_TKP_rapsheet + 1}; 
_cnt = DMZ_TKP_rapsheet; 
_timeLeft = ((_timer - 3) + (_increase * DMZ_TKP_rapsheet)); 
_killer setVariable ["DMZ_TKP", true, false]; 

_text = format["%1 is being punished for total %2 Team kills",(name player),DMZ_TKP_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 != DMZ_TKP_rapsheet) then { 
       _timeLeft = _timeLeft + (_increase * (DMZ_TKP_rapsheet - _cnt)); 
       _cnt = DMZ_TKP_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; DMZ_TKP = false};

Now it works!!!!!!!!!!!!!!!!!!!!!!!!!! I don't know what I was doing wrong >.< but when I copied and paste the script that u just edited, it works perfectly fine now.

Im so happy!!! Thank you so much!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Also, thank you iceman for helping!

Thank you guys!!!!!!!! really appreciated it !!!!

Share this post


Link to post
Share on other sites

[hi guys because i am very noob in scripts and i have big problem with team kills in my dedicated server i try with this script with first script from demonized in arma 2 editor i make 1 marker name DMZ_TKP_marker next i pu 1 fanctions module no name no any add in this functions...just a functions module default ... in every player on my mission i add in initialization _null = [this,"start"] execVM "TKP.sqf"; but work fine only in preview mode with A.i players if i run my mission online multiplayer i can team kill all can team kill but i got panishe if i die my self with button respawn or grenade or somthing..... i test the other versions like this here and dont work i dont got panishe if i killed my self but noone got panishe for team kill in multiplayer in editor preview mode work fine ..... sory for my bad english plz help..!!! me what i make wronk here i spent alot hours for nothing.... 1 guide step by step? :j:

1: Make sure you have a functions module on your map. >>> here is not clear for me mission just need 1 functions module in default no name or somthing ????

2: Place a marker called DMZ_TKP_marker in your base or your no TK zone, or change marker name below in options. >>>> i make marker with this name on my base ...

3: Place this in init of any unit you wish to be included in TKP script. >> any player playable on my mission have _null = [this,"start"] execVM "TKP.sqf"; in initialization is ok ??? or i need somthing more from this steps

_null = [this,"start"] execVM "TKP.sqf";

Share this post


Link to post
Share on other sites
Sign in to follow this  

×