Schatten 290 Posted September 18, 2015 And i need just a chat message on system chat who killed a civilian person. How do i get that? Server side Killed event handler code: [(name (_this select 1)) + " has killed civilian!", "systemChat"] call BIS_fnc_MP; Share this post Link to post Share on other sites
davidoss 552 Posted September 18, 2015 Well works but works strange. class Extended_Init_EventHandlers { class Civilian_F { init = "(_this select 0) addeventhandler ['killed',{[(name (_this select 1)) + ' has killed civilian!', 'hint'] call BIS_fnc_MP;}];"; }; }; Is giving me hint : Abdul-Aziz Jawadi has killed civilian! Every time i kill a civilian this give me other name i assume the name of killed civilian. Changing (name (_this select 1)) to (name (_this select 0)) gives the same results :blink: There are some rpt warnings too: 20:22:21 HJa false20:22:21 HJa false20:22:26 WARNING: Function 'name' - Abdul-Aziz Jawadi is dead20:22:35 HJa false20:22:36 HJa false20:23:11 WARNING: Function 'name' - Abdul-Basir Ghafurzai is dead20:23:11 WARNING: Function 'name' - Abdul-Basir Ghafurzai is dead20:23:20 WARNING: Function 'name' - Qadeer Zamani is dead20:23:20 WARNING: Function 'name' - Qadeer Zamani is dead Share this post Link to post Share on other sites
Schatten 290 Posted September 18, 2015 Try to use this: init = "this addeventhandler ['killed',{[(name (_this select 1)) + ' has killed civilian!', 'hint'] call BIS_fnc_MP;}];"; Or use regular event handler. Share this post Link to post Share on other sites
Ilias38rus 5 Posted September 18, 2015 How are you going to determine who killed 10 civilians? Without DB you can't determine this. E.g. player1 killed 9 civilians, player2 killed 1 civilian. In your current implementation player2 will be kicked, because SHK_DeadCivilianLimit will be 10 after killing civilian by player2. https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#CuratorObjectPlaced https://community.bistudio.com/wiki/Code_Optimisation#Loops about MCC? Share this post Link to post Share on other sites
Schatten 290 Posted September 18, 2015 about MCC? I don't know because I haven't worked with MCC. Share this post Link to post Share on other sites
davidoss 552 Posted September 18, 2015 Try to use this: init = "this addeventhandler ['killed',{[(name (_this select 1)) + ' has killed civilian!', 'hint'] call BIS_fnc_MP;}];"; Or use regular event handler. Hmm bad luck not working at all Share this post Link to post Share on other sites
Schatten 290 Posted September 18, 2015 Hmm bad luck not working at all It works for me when I create AI units on server and add to them event handlers. Share this post Link to post Share on other sites
davidoss 552 Posted September 20, 2015 Have created a event on civilian kill by player. Description.ext class CfgFunctions { class INS { class ck { class ckMP { preInit = 0; postInit = 0; preStart = 0; recompile = 0; ext = ".sqf"; headerType = -1; }; class ckcivEH { preInit = 0; postInit = 0; preStart = 0; recompile = 0; ext = ".sqf"; headerType = -1; }; }; }; }; class Extended_Init_EventHandlers { class Civilian_F { init = "(_this select 0) call INS_fnc_ckcivEH"; }; }; fn_ckcivEH.sqf // INS_fnc_ckcivEH if (_this isKindOf "Man") then { _this addEventHandler ["killed", { private ["_cvictim", "_ckiller"]; _cvictim = _this select 0; _ckiller = _this select 1; if(vehicle _ckiller isEqualTo vehicle _cvictim ) exitWith{}; if (isPlayer _ckiller) then { [] remoteExec [ "INS_fnc_ckMP", _ckiller ]; }; }]; }; fn_ckMP.sqf //civilian casualties punishment INS_fnc_ckMP private ["_txt", "_output", "_declare"]; [profileName + " has killed civilian!", "systemChat"] call BIS_fnc_MP; sleep 2; [[hq_logic_papa,"papabear_dammit"],"sideRadio",WEST,false,false] call BIS_fnc_MP; player setCaptive true; disableUserInput true; sleep 2; titleCut ["", "BLACK FADED", 999]; sleep 3; playSound "WoundedGuyA_03"; titleText ["YOU HAVE KILLED A CIVILIAN!!","PLAIN"]; titleFadeOut 5; sleep 5; playSound "WoundedGuyA_04"; titleText ["HOW COULD YOU?!","PLAIN"]; titleFadeOut 5; sleep 5; playSound "WoundedGuyA_05"; _txt = "You are experiencing extreme stress caused by killing unarmed civilian!!"; _output = [ [_txt,"<t size='1.2' font='PuristaBold'>%1</t>",15] ]; _declare = [_output,0,0.5,"<t color='#FFFFFFFF' align='center'>%1</t>"] spawn BIS_fnc_typeText; waitUntil {scriptDone _declare}; "dynamicBlur" ppEffectEnable true; "dynamicBlur" ppEffectAdjust [6]; "dynamicBlur" ppEffectCommit 0; "dynamicBlur" ppEffectAdjust [0.0]; "dynamicBlur" ppEffectCommit 5; titleCut ["", "BLACK IN", 5]; sleep 3; playSound "WoundedGuyA_06"; player switchMove "Acts_UnconsciousStandUp_part2"; waituntil { sleep 0.5; animationState player != "Acts_UnconsciousStandUp_part2"}; titleCut ["", "BLACK FADED", 999]; sleep 2; playSound "4Five_near"; player setdamage 0.9; player setCaptive false; disableUserInput false; "dynamicBlur" ppEffectEnable true; "dynamicBlur" ppEffectAdjust [6]; "dynamicBlur" ppEffectCommit 0; "dynamicBlur" ppEffectAdjust [0.0]; "dynamicBlur" ppEffectCommit 5; titleCut ["", "BLACK IN", 5]; player setdamage 1; How to prevent multiple call of INS_fnc_ckMP after more civilians was killed on the same time by the same player? Share this post Link to post Share on other sites
Ilias38rus 5 Posted November 19, 2015 Hi. Have found on ARMA2 forum some code by Shuko which can be useful for my Insurgency mission. I don't knew for now if this is arma 3 compatible but i wanna ask you fellows if there are any possibility to get player kicked if he exceeds the CK limit (SHK_DeadCivilianLimit = 10;). If not maybe someone knew different way how the mission could punish the player for too many civilian casualties? SHK_DeadCivilianCount = 0; SHK_DeadCivilianLimit = 10; SHK_fnc_deadCivilians = { hintsilent format ["Civilians dead: %1",_this]; if (_this >= SHK_DeadCivilianLimit) then { player sidechat "mission end"; // end mission, do whatever }; }; if isserver then { { if (side _x == Civilian && _x iskindof "Man") then { _x addEventHandler ["killed", { SHK_DeadCivilianCount = SHK_DeadCivilianCount + 1; publicvariable "SHK_DeadCivilianCount"; if !isdedicated then { SHK_DeadCivilianCount call SHK_fnc_deadCivilians; }; }]; }; } foreach allunits; }; if !isdedicated then { "SHK_DeadCivilianCount" addpublicvariableeventhandler { (_this select 1) call SHK_fnc_deadCivilians }; }; Sorry for lifting the "Topic", just, just needed a maded script which was needeble here. akc = []; akck = []; if (!isDedicated) then { while {true} do { sleep 1; { if ((side _x) == civilian) then { if ((akc find _x) == -1) then { _x addMPeventhandler ["MPKilled",{ hint (str (_this select 1) + " is under invastigation"); akc = akc - [_x]; if ((akck find (_this select 1)) == -1) then { _this select 1 setvariable ["pvkck", 1]; akck = akck + [_this select 1]; } else { _lv = _this select 1 getVariable ["pvkck", 1]; _lv = _lv + 1; _this select 1 setvariable ["pvkck", _lv]; }; // Can add here any number of anything which will execute when any civilian dead; }]; akc = akc + [_x]; }; }; } foreach allUnits; }; }; Execute on all computers (Working on each computer exact server (For do not bothering server)). Will work for all civilians in game (`doesn't meter when they was created or script executed). akck - array which seen on the computer and containing all units which ever killed civilian. pvkck - personal variable attached to each <|------------------------------------| containing number of killed by the unit civilians. Share this post Link to post Share on other sites