Jump to content
Sign in to follow this  
Juulloo

Function module in Teamkill Punishment script

Recommended Posts

In one of my mission files I want to have an anti teamkill script. I've been looking for some from arma 2, and I've found this one by Demonized:

/*
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 != _killer)) 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};

The only thing why I think it doesn't work is that we can't put function modules in anymore. Now, I've heard that you can still get these scripts that require the functions modules to work, working. But how do I do that? Can anyone please explain me in detail how this works? (I have little coding experience, so just saying add this code won't work, I need a little bit more direction :).

Share this post


Link to post
Share on other sites

function module is no longer required in Arma3, just be aware that you still need to wait for the functions to be pre-loaded by adding

waituntil {!(isnil "bis_fnc_init")}; 

before any scripts that rely on them are executed.

Share this post


Link to post
Share on other sites

it still doesn't work for me if I add that to the script, I have no clue what else is wrong with it. I did hear that the MPF doesn't work the same for A3 as for A2? Then maybe this:

waitUntil {!(isNil "BIS_MPF_InitDone")};

is the issue. Anyone who can fix this script, or any other good anti teamkill script?

Share this post


Link to post
Share on other sites

Any luck yet in getting this script to work Juulloo. I like what I see in it. :)

I have not managed to get it to work either, although I see the game executing it and reading at least part of it.

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  

×