unconditional Posted February 6, 2018 Report Share Posted February 6, 2018 Hi everybody, scuse me for intrusion :) If I did not make mistakes ... maybe I could create a script to unlock the doors through use of the hotwirekit... I did not understand how the system of credits on scripts works ... so I want to clarify that my work was based on a script of @salival to which I wrote in private before publishing this. I waited a week but not having received an answer...i think it is still right to make available to the community as much as I did...So all the credits go @salival because i am based on his garagedooropener... Now...this is my work: -1) custom variable.sqf: Spoiler below this s_player_manageDoor = -1; add this s_player_hwdoor_opener_ctrl = -1; -2) custom fn_selfActions.sqf: Spoiler below this } else { player removeAction s_player_manageDoor; s_player_manageDoor = -1; }; add this //Hotwire doors if (DZE_doorManagement && (_typeOfCursorTarget in DZE_DoorsLocked) && (_hasHotwireKit)) then { _hasAccess = [player, _cursorTarget] call FNC_check_access; if (s_player_hwdoor_opener_ctrl < 0 && (!(_hasAccess select 0) or !(_hasAccess select 2) or !(_hasAccess select 3) or !(_hasAccess select 4) or !(_hasAccess select 5))) then { s_player_hwdoor_opener_ctrl = player addAction [format["<t color='#ffffff'>Hotwire Door</t>"],"scripts\hwDoorOpener.sqf",_cursorTarget, 1, false]; }; } else { player removeAction s_player_hwdoor_opener_ctrl; s_player_hwdoor_opener_ctrl = -1; }; -3) in custom script folder (under mission folder); red text in the script below is needed only if you want to log in .rpt when someone try a hotwiring. If you want this, you have to leave red text in the script and you also have to do step 4 Spoiler create a new sqf file named hwDoorOpener.sqf and paste into it this code /* Author: Unconditional Credits: Based on Garage door opener by salival (https://github.com/oiad) */ if (dayz_actionInProgress) exitWith {"You are already performing an action, wait for the current action to finish." call dayz_rollingMessages;}; dayz_actionInProgress = true; private ["_cursortarget","_hotchance","_rollchance","_combi"]; _cursortarget = _this select 3; _hotchance = 15; _rollchance = round(random 100); if (isNull _cursortarget) exitWith {dayz_actionInProgress = false; systemChat "Selected door is NULL!";}; axeDiagLog = format["HOTWIRING tried: %1 at %2 ", (name player), (mapGridPosition getPos player)]; publicVariable "axeDiagLog"; if (_rollchance <= _hotchance) then { player removeMagazine "ItemHotwireKit"; _combi = _cursortarget getVariable ["CharacterID","0"]; sleep 1; format ["Lucky, HOTWIRED DOOR, COMBINATION IS: %1", _combi] call dayz_rollingMessages; } else { player removeMagazine "ItemHotwireKit"; sleep 1; titleText ["DAMN...Your HOTWIRE IT'S BROKEN...", "PLAIN DOWN", 3]; };dayz_actionInProgress = false; STEP 4 and 5 to do ONLY if you want to see log in .rpt -4) in inf.sqf (mission folder); Spoiler below this if (isServer) then { add this axe_server_log = compile preprocessFileLineNumbers "scripts\logtorpt.sqf"; "axeDiagLog" addPublicVariableEventHandler {_id = (_this select 1) spawn axe_server_log}; -5) in custom script folder (under mission folder); Spoiler create a new sqf file named logtorpt.sqf and paste into it this code private ["_targetObj"]; _targetObj = _this; diag_log format["ADVICE: %1",_targetObj]; - FINISH :-) Obviously i think it can be improved and for this reason i make it public, so that those who know more than me can suggest additions or modifications...For example ... I added a public variable to know via the .rpt file when a hotwire was used and whether it was successful or not.Maybe you can also add a routine to signal in the map or through text message for all the players that someone is trying to force a door...I tried it on my server and it seems to work fine.I await your observations and suggestions.I repeat: ALL CREDITS GO TO @SALIVALThanks for the attention. Link to comment Share on other sites More sharing options...
Relentless Posted February 6, 2018 Report Share Posted February 6, 2018 First of all it's a kinda interesting idea and I always love newcomers that come up with new scripts. Next up, I recommend you use the forum's code formatting and spoilers because this thread looks horrible. publicVariables are also a thing I wouldn't recommend since they are a huge security gap. When you really need to send something to the server you should better use publicVariableServer. But since you obviously just need it for writing a debug message in the rpt, you can also use diag_log. Just a small peak for formatting and preventing publicVariables: Spoiler /* Author: Unconditional Credits: Based on Garage door opener by salival (https://github.com/oiad) */ if (dayz_actionInProgress) exitWith {"You are already performing an action, wait for the current action to finish." call dayz_rollingMessages;}; dayz_actionInProgress = true; private ["_cursortarget","_hotchance","_rollchance","_combi"]; _cursortarget = _this select 3; _hotchance = 15; _rollchance = round(random 100); if (isNull _cursortarget) exitWith { dayz_actionInProgress = false; systemChat "Selected door is NULL!"; }; diag_log format["%1 is trying to hotwire a door at %2!", name player, mapGridPosition getPos player]; if (_rollchance <= _hotchance) then { player removeMagazine "ItemHotwireKit"; _combi = _cursortarget getVariable["CharacterID","0"]; sleep 1; format ["You're lucky! You hotwired the door, the combination is: %1", _combi] call dayz_rollingMessages; } else { player removeMagazine "ItemHotwireKit"; sleep 1; "Bad luck! Your hotwire broke!" call dayz_rollingMessages; }; dayz_actionInProgress = false; Link to comment Share on other sites More sharing options...
BigEgg Posted February 6, 2018 Report Share Posted February 6, 2018 17 minutes ago, DAmNRelentless said: diag_log format["%1 is trying to hotwire a door at %2!", name player, mapGridPosition getPos player]; @DAmNRelentless, this would be sent to client rpt, not server rpt. Relentless 1 Link to comment Share on other sites More sharing options...
Relentless Posted February 6, 2018 Report Share Posted February 6, 2018 12 minutes ago, BigEgg said: @DAmNRelentless, this would be sent to client rpt, not server rpt. True, you are right. That's why I mentioned publicVariableServer. With that, you don't even have to whitelist it in battleye. If you want it in server RPT send the message in a variable as publicVariableClient and then create an eventhandler server-side which uses diag_log to post it in the server RPT. :) Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now