Jump to content
Joshyy

[Release] Trader Kill Notification - 1.0.6

Recommended Posts

If a player is killed within a defined range from a trader there will be a chat message notifying everyone so they can be punished.

 

Step 1:

Make a copy of player_death.sqf in your mission file and change the path in your compiles.sqf

 

Step 2:

Define your trader areas by making an array with the trader position, range, and trader name

DZE_tradersarray = [

// [[position],range,"tradername"],

// [[position],range,"tradername"] -- Don't forget the last one doesn't have a , at the end!

];

Example:

Spoiler

DZE_tradersarray     = [
    [[4064,11665,0],510,"Trader city Bash"], // 510 = range from trader where the notification will check if the killer or victim is within. (in meters)
    [[6326,7809,0],510,"Trader city Stary"],
    [[11447,11364,0],510,"Trader city Klen"],
    [[12944,12766,0],510,"Hero camp"],
    [[1606,7803,0],510,"Bandit camp"],
    [[12060,12638,0],510,"Aircraft dealer"],
    [[3096,3469,0],510,"Trader city Bor"]
];

Put this in your init.sqf somewhere at the top or put it inside your configVariables.sqf

Step 3: 

Open your custom player_death.sqf

and find

Spoiler

if (!isNull _source) then {
        if (!isNull _body) then {

Then add this below

 

Spoiler

        {
            private ["_pos","_dis","_loc","_rng","_rnt","_systemchat"];
            _pos = _x select 0;
            _dis = _x select 1;
            _loc = _x select 2;

           _playerName = name _source;
            _rng = ((getPos _body) distance _pos); // Get victim position from trader
            _rnt = ((getPos _source) distance _pos); // Get attacker position from trader
            if (_rnt <= _dis) exitWith { // Check if victim was in trader range
                _systemchat = format["(Server): TRADER KILL! %1 killed %2 when %3 was %4m from %5",_killerName,dayz_playerName,_killerName,_rng,_loc];
                [nil, nil, rspawn, [_systemchat], {systemChat (_this select 0)}] call RE;
            };
            if (_rng <= _dis) exitWith { // Check if killer was in trader range
                _systemchat = format["(Server): TRADER KILL! %1 killed %2 when %3 was %4m from %5",_killerName,dayz_playerName,dayz_playerName,_rng,_loc];
                [nil, nil, rspawn, [_systemchat], {systemChat (_this select 0)}] call RE;
            };
        } forEach DZE_tradersarray;

 

The whole block should look like

Spoiler

    if (!isNull _source) then {
        if (!isNull _body) then {
        {
            private ["_pos","_dis","_loc","_rng","_rnt","_systemchat"];
            _pos = _x select 0;
            _dis = _x select 1;
            _loc = _x select 2;

           _playerName = name _source;


            _rng = ((getPos _body) distance _pos); // Get victim position from trader
            _rnt = ((getPos _source) distance _pos); // Get attacker position from trader
            if (_rnt <= _dis) exitWith { // Check if victim was in trader range
                _systemchat = format["(Server): TRADER KILL! %1 killed %2 when %3 was %4m from %5",_killerName,dayz_playerName,_killerName,_rng,_loc];
                [nil, nil, rspawn, [_systemchat], {systemChat (_this select 0)}] call RE;
            };
            if (_rng <= _dis) exitWith { // Check if killer was in trader range
                _systemchat = format["(Server): TRADER KILL! %1 killed %2 when %3 was %4m from %5",_killerName,dayz_playerName,dayz_playerName,_rng,_loc];
                [nil, nil, rspawn, [_systemchat], {systemChat (_this select 0)}] call RE;
            };
        } forEach DZE_tradersarray;
            _distance = round (_body distance _source);
        };
        _sourceVehicleType = typeOf (vehicle _source);
        _sourceWeapon = if (_sourceVehicleType isKindOf "LandVehicle" or _sourceVehicleType isKindOf "Air" or _sourceVehicleType isKindOf "Ship") then {_sourceVehicleType} else {currentWeapon _source};
        if (_sourceWeapon == "Throw") then {_sourceWeapon = (weaponState _source) select 3;};
        if (_ammo in ["PipeBomb","Mine","MineE"]) then {_sourceWeapon = _ammo;};
        if (alive _source) then {
            _sourceName = if (isPlayer _source) then {name _source} else {localize "STR_PLAYER_AI"};
        };
    };

 

Note: This is compatible with 1.0.5.1

 

Comment if you have any problems!

Share this post


Link to post
Share on other sites

The person getting killed gets kicked for

Value Restriction #0 "remExField" = [,,"spawn",["(Server): TRADER KILL! any killed any when any was 224.19m from Trader city Stary"],{systemChat (_this select 0)}]

Turn off battleye and it works except the message reads "TRADER KILL! any killed any when any was xxxxx from trader city"

Its not picking up the name of either player.

Share this post


Link to post
Share on other sites
On 23/01/2017 at 0:18 AM, lwbuk said:

The person getting killed gets kicked for

Value Restriction #0 "remExField" = [,,"spawn",["(Server): TRADER KILL! any killed any when any was 224.19m from Trader city Stary"],{systemChat (_this select 0)}]

Turn off battleye and it works except the message reads "TRADER KILL! any killed any when any was xxxxx from trader city"

Its not picking up the name of either player.

You can use a remote message script, those shouldn't cause BE kicks.

as for the name, make sure _killerName and _victimName are defined (_killerName = name _source;_victimName = name player;) << add this above the script somewhere

 

Edit: updated OP with fix

 

Share this post


Link to post
Share on other sites

@Joshyy if possible rcognize the killer as an unique entity?

cuz a great punish will be attach this player to a big stick in the middle of stary trader :D

using something like

_stick createvehicle......................

_killer  attachTo [_stick, [2, 2, 0]];

sleep 60;
detach _killer;

 

Share this post


Link to post
Share on other sites

player_death.sqf  (this one works)

Spoiler
private ["_pos","_display","_body","_playerID","_array","_source","_method","_isBandit","_punishment","_humanityHit","_myKills","_humanity","_kills","_killsV","_myGroup","_model","_infected","_distance","_sourceVehicleType","_sourceWeapon","_sourceName","_ammo"];
disableSerialization;
if (count _this == 0) then {
	//Spawned from Killed EH (engine death), this should be rare
	//Wait to see if sched_medical 1s loop spawns with _source and _method (blood<=0 death)
	uiSleep 1;
};
if (deathHandled) exitWith {};
deathHandled = true;

//Prevent client freezes
_display = findDisplay 49;
if (!isNull _display) then {_display closeDisplay 0;};
if (dialog) then {closeDialog 0;};
if (visibleMap) then {openMap false;};

_body = player;
_playerID = getPlayerUID player;
disableUserInput true;

//add weapon on back to player
if (dayz_onBack != "") then {
	//Add weapon on back to body.
	_body addWeapon dayz_onBack;
    /*
	//Add weapon on back to the ground.
	_pos = _body modeltoWorld [1,1,0];
	//_pos set [2, 0];
    _item = createVehicle ["WeaponHolder", _pos, [], 0.0, "CAN_COLLIDE"];
    _item setPosATL [_pos select 0, _pos select 1, ((_pos select 2) + 0.1)];
    _item addWeaponCargoGlobal [dayz_onBack,1];
	*/
};
_infected = if (r_player_infected && DZE_PlayerZed) then {1} else {0};
_method = "unknown";
_sourceName = "unknown";
_sourceWeapon = "";
_distance = 0;
if (count _this > 0) then {
	_source = _this select 0;
	_method = _this select 1;
	_ammo = if (count _this > 2) then {_this select 2} else {""};
	
	if (!isNull _source) then {
		if (!isNull _body) then {
		     {
            private ["_pos","_dis","_loc","_rng","_rnt","_systemchat"];
            _pos = _x select 0;
            _dis = _x select 1;
            _loc = _x select 2;
			_killerName = name _source;
		   _victimName = name player; 

           _playerName = name _source;
            _rng = ((getPos _body) distance _pos); // Get victim position from trader
            _rnt = ((getPos _source) distance _pos); // Get attacker position from trader
            if (_rnt <= _dis) exitWith { // Check if victim was in trader range
             
			    _systemchat = format["(Server): TRADER KILL! %1 killed %2 when %3 was %4m from %5",_killerName,_victimName,_killerName,_rng,_loc];// this line are working. save the file, repack and try again
                [nil, nil, rspawn, [_systemchat], {systemChat (_this select 0)}] call RE;
            };
            if (_rng <= _dis) exitWith { // Check if killer was in trader range
                _systemchat = format["(Server): TRADER KILL! %1 killed %2 when %3 was %4m from %5",_killerName,dayz_playerName,dayz_playerName,_rng,_loc];
                [nil, nil, rspawn, [_systemchat], {systemChat (_this select 0)}] call RE;
            };
        } forEach DZE_tradersarray; 
		
		_distance = round (_body distance _source);
		};
		_sourceVehicleType = typeOf (vehicle _source);
		_sourceWeapon = if (_sourceVehicleType isKindOf "LandVehicle" or _sourceVehicleType isKindOf "Air" or _sourceVehicleType isKindOf "Ship") then {_sourceVehicleType} else {currentWeapon _source};
		if (_sourceWeapon == "Throw") then {_sourceWeapon = (weaponState _source) select 3;};
		if (_ammo in ["PipeBomb","Mine","MineE"]) then {_sourceWeapon = _ammo;};
		if (alive _source) then {
			_sourceName = if (isPlayer _source) then {name _source} else {localize "STR_PLAYER_AI"};
		};
	};
};

//Send Death Notice
diag_log format["Player_Death: Body:%1 BodyName:%2 Infected:%3 SourceName:%4 SourceWeapon:%5 Distance:%6 Method:%7",_body,dayz_playerName,_infected,_sourceName,_sourceWeapon,_distance,_method];
PVDZ_plr_Death = [dayz_characterID,0,_body,_playerID,toArray dayz_playerName,_infected,toArray _sourceName,toArray _sourceWeapon,_distance,toArray _method]; //Send name as array to avoid publicVariable value restrictions
publicVariableServer "PVDZ_plr_Death";

_id = [player,20,true,getPosATL player] call player_alertZombies;
uiSleep 0.5;
player setDamage 1;
if (dayz_soundMuted) then {call player_toggleSoundMute;}; // hide icon before fadeSound
0.1 fadeSound 0;

player setVariable ["NORRN_unconscious", false, true];
player setVariable ["unconsciousTime", 0, true];
player setVariable ["USEC_isCardiac",false,true];
player setVariable ["medForceUpdate",true,true];
player setVariable ["bloodTaken", false, true];
player setVariable ["startcombattimer", 0]; //remove combat timer on death
player setVariable ["inCombat", false, true];
r_player_unconscious = false;
r_player_cardiac = false;
_model = typeOf player;
autoRunActive = false;

_array = _this;
if (count _array > 0) then {
	_source = _array select 0;
	_method = _array select 1;
	if (!local _source && isPlayer _source) then {
		_isBandit = (player getVariable["humanity",0]) <= -2000;
		//_isBandit = (_model in ["Bandit1_DZ","BanditW1_DZ"]);
		
		//if you are a bandit or start first - player will not recieve humanity drop
		_punishment = ((_isBandit or {player getVariable ["OpenTarget",false]}) && !(player isKindOf "PZombie_VB"));
		_humanityHit = 0;

		if (!_punishment) then {
			//I'm "not guilty" - kill me and be punished
			_myKills = (player getVariable ["humanKills",0]) * 33.3;
			// how many non bandit players have I (the dead player) killed?
			// punish my killer 2000 for shooting a surivor
			// but subtract 500 for each survivor I've murdered
			_humanityHit = -(2000 - _myKills);
			_kills = _source getVariable ["humanKills",0];
			_source setVariable ["humanKills",(_kills + 1),true];
			PVDZ_send = [_source,"Humanity",[_humanityHit,300]];
			publicVariableServer "PVDZ_send";
		} else {
			//i'm "guilty" - kill me as bandit
			_killsV = _source getVariable ["banditKills",0];
			_source setVariable ["banditKills",(_killsV + 1),true];
		};
		
		//Setup for study bodys.
		_body setVariable ["KillingBlow",[_source,_punishment],true];
	};
	_body setVariable ["deathType",_method,true];
};

terminate dayz_musicH;
terminate dayz_slowCheck;
terminate dayz_monitor1;

//Reset (just in case)
//deleteVehicle dayz_playerTrigger;
//disableUserInput false;
r_player_dead = true;

//Player is dead!
3 fadeSound 0;
uiSleep 1;

dayz_originalPlayer enableSimulation true;
addSwitchableUnit dayz_originalPlayer;
setPlayable dayz_originalPlayer;
selectPlayer dayz_originalPlayer;

_myGroup = group _body;
[_body] joinSilent dayz_firstGroup;
deleteGroup _myGroup;
80000 cutText ["","PLAIN"]; //Clear group icons

3 cutRsc ["default", "PLAIN",3];
4 cutRsc ["default", "PLAIN",3];

_body setVariable["combattimeout", 0, true];
//due to a cleanup issue with effects this has been disabled remember to look at the cleanup before adding it back.
//dayzFlies = player;
//publicVariable "dayzFlies";
uiSleep 2;
1 cutRsc [if (DZE_DeathScreen) then {"DeathScreen_DZE"} else {"DeathScreen_DZ"},"BLACK OUT",3];
playMusic "dayz_track_death_1";
uiSleep 2;

for  "_x" from 5 to 1 step -1 do {
	titleText [format[localize "str_return_lobby", _x], "PLAIN DOWN", 1];
	uiSleep 1;
};

PVDZ_Server_Simulation = [_body, false];
publicVariableServer "PVDZ_Server_Simulation";

endMission "END1";

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Similar Content

    • By FG_Trap
      Made this in my free time awhile ago thought id make it public.
      Right Alt is the key to open the menu.
      Install instructions are inside the download.
      https://github.com/NWDZ-Trapxxgods/traps-menu
       
       
      here is a picture of the server menu
       
    • By Restplay
      Hello i created my server from this thread:
      . How to fix it?      
    • By mudzereli
      Outdated, does not work with Epoch 1.0.7
      DEPLOYABLE BIKE 2.8.2
      all of this information is available in an easier-to-read format on github pages>>
      version 2.8.2 updates the code to work with Epoch Mod 1.0.6. Thanks @ebaydayz!
      version 2.8.1 should hopefully fix the long-standing non-moving-bike problem! Thanks @SchwEde!
      FYI: 2.8.0 adds the _condition and _ammo parameters to the config array so you will need to add a value for these parameter in each record of the DZE_DEPLOYABLES_CONFIG array in the appropriate spot if you are upgrading from 2.6
       
      Out of the box, it adds a deployable bike with a right click action on a toolbox and a couple other neat deployables.
      Really, it can be used to deploy just about anything. See the configuration section below.
      For some samples of what it can do, check out this gallery on imgur
       
      Installation
      download the files extract the addons and overwrites folder from the downloaded zip file into your mission file root find this line in your mission file init.sqf (warning: if you have a custom compiles file, find that line instead of the one below!) call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\compiles.sqf"; place this line directly after the line you found call compile preprocessFileLineNumbers "addons\bike\init.sqf"; edit addons\bike\config.sqf to change some options or add different deployables (see configuration section for more info) Warning:
      due to the way the way arma handles numbers and the way addon is coded, using the save-to-database option may not allow you to re-pack some objects if you have Character ID's over 500,000 (which I don't think will be an issue for 99.99% of people).  
      Adding Your Own Custom Actions
      If you use another right click method like extra_rc.hpp and want to switch to my method, see my click actions configuration github page.
      The click actions script is included in the deploy script as part of the core, so you don't need to download anything, just follow the instructions for adding your own actions.
      * note: before attempting to troubleshoot issues with adding your own actions, make sure you are using the most recent version of the addon.
       
      Configuration
      This addon is highly configurable, you can deploy just about anything, not just bikes.
      open addons\bike\config.sqf and edit the array to add your own deployables.
       
      DZE_DEPLOYABLES_CONFIG format -- (note no comma after last array entry)
      DZE_DEPLOYABLES_CONFIG = [ [_clickItem,_deployOffset,_packDistance,_damageLimit,_packAny,_cargo,_hive,_plot,_simulation,_deployables,_near,_parts], [_clickItem,_deployOffset,_packDistance,_damageLimit,_packAny,_cargo,_hive,_plot,_simulation,_deployables,_near,_parts], [...more stuff here...] ]; DZE_DEPLOYABLES_CONFIG array values (view on github to read easier):
      parameter | description | type | example --------------|---------------------------------------------------------------------|--------|-------- _clickItem | class name of the item to click on | string | "ItemToolbox" _deployOffset | [_side,_front,_up] array to offset the deployable when buiding | array | [0,2,1] _packDistance | how close does the packer need to be to pack the object? | number | 5 _damageLimit | item can't be repacked if damage is > this. (-1 = no re-packing) | number | 0.1 _packAny | can anyone repack the deployable? | bool | false _cargo | clear the cargo of the deployable? | bool | false _ammo | should vehicle ammo be cleared? (does not persist through restart) | bool | true _hive | write deployable to database? | bool | false _plot | require a plot from the owner to build the deployable? | bool | false _simulation | enable simulation (movement/damage) for the object? (true for cars) | bool | true _road | enable road building for this object? | bool | true _deployables | array of class names that can be deployed with this method | array | ["MMT_Civ"] _near | array of items required nearby to build (workshop/fire/fueltank) | array | [] _parts | array of parts required to build (will be taken from player) | array | ["ItemToolbox"] _condition | string of code to evaluate to determine whether action is shown | string | "!(isNull player) && {(getPlayerUID player) in DZE_DEPLOYABLE_ADMINS}" DZE_DEPLOYABLE_NAME_MAP array -- allows you to rename the deployable (on the right click/messages)
      format (note no comma after last array entry)
      DZE_DEPLOYABLE_NAME_MAP = [ [_class,_name], [_class,_name], [... more ...] ];  array parameters
      parameter    | description                                                         |  type  | example --------------|---------------------------------------------------------------------|--------|-------- _class        | class name of the item you want to replace the name of              | string | "Notebook" _name         | new name to display when right clicking                             | string | "Macbook Pro" Change Log
      version | change --------|------- 2.8.2 | updates for 1.0.6! Thanks @ebaydayz! 2.8.1 | fix from SchwEde that should fix bike not moving. Thanks @SchwEde! 2.8.0 | option to clear vehicle ammo 2.7.1 | better exit reasons 2.7.0 | option to add condition for showing action in config 2.6.1 | fix for unrideable bikes 2.6.0 | road building options, deployable name mapping 2.5.1  | fix a bug where preview items would sometimes disappear  2.5.0  | now uses a modified epoch building system to deploy the objects  2.4.3  | better click actions build conflict detection  2.4.2  | updated for new click actions handler build  2.4.1  | fixed deployables spawning in locked after restart  2.4.0  | multi-part deployables. yay!  2.3.1  | big fix on packing temp objects  2.3.0  | optional saving to database with post-restart memory of deployed items (see warning below about this) | configurable damage limits on re-packing | admin list for packing/deploying instantly & being able to remove all deployables  2.2.1  | positioning fix for deployed items  2.2.0  | option for clearing cargo of spawned items  2.1.0  | change way dependency call is made, only one line needed in init.sqf now for setup  2.0.0  | major update, allow multiple deployables, pretty much any class  1.1.0  | configuration options / code optimization  1.0.0  | release Issues/FAQ
      1) people are getting kicked for createvehicle restriction when building a stone wall
      open your battleye filter createvehicle.txt and change this line
      5 "Fort_" !="Fort_RazorWire" !="Fort_RazorWirePreview" to this:
      5 "Fort_" !="Fort_RazorWire" !="Fort_RazorWirePreview" != "Fort_StoneWall_EP1" 2) I am using "A Plot For Life" and this is not working!
    • By salival
      Hi,
      Here's my version of  @OtterNas3 vehicle key changer.  It was subsequently modified by @Grahame for epoch 1.0.6. Updated for 1.0.7.
      This adds support for briefcases, gems and coins as well as using the epoch vehicle upgrade system to do the key changing/claiming.
      * original discussion url: https://epochmod.com/forum/topic/5972-release-vehicle-key-changer-for-making-masterkey-v-14-updated-06152014/
      * updated discussion url: https://epochmod.com/forum/topic/43048-release-vehicle-key-changer-for-making-masterkey-v-141-updated-for-epoch-106/
      Github link with install directions: https://github.com/oiad/vkc
      **EDIT* Link to a working locate Vehicle script that is able to find multiple vehicles per key: 
       
      **** For Epoch 1.0.6.2 only **** >> Download <<
      Visit this link: https://github.com/oiad/vkc/tree/vkc-Epoch-1.0.6.2
    • By salival
      Hi guys,
      Here's my version of the bury/butcher body script. Focus'd on optimization and cleanliness.
      * Tested as working on a blank Epoch 1.0.7 server
      * Contains a server side scheduler module to clean up old weapon crates, graves and crosses after 25 minutes.
      * Removes the flies sound when body is buried for performance.
       
      To download: https://github.com/oiad/buryBodies
       
      **** For Epoch 1.0.6.2 only **** >> Download <<
      Visit this link: https://github.com/oiad/buryBodies/tree/Epoch_1.0.6.2
  • Advertisement
  • Supporters
  • Discord

×
×
  • Create New...