Jump to content

Recommended Posts

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 @SALIVAL

Thanks for the attention.

Share this post


Link to post
Share on other sites

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. :biggrin:
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; 

 

 

Share this post


Link to post
Share on other sites
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. :)

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 salival
      Hi guys,
      Quite a few admins asked me to release my Change Code script so here it is, It comes with BattlEye filters, too.
      This will allow players to set the code on placement/upgrade of doors, lockboxes and safes as well as changing them after they are placed.
      https://github.com/oiad/changeCode
    • By salival
      Hi guys,
      Here's an in vehicle garage door opener I wrote a while ago, Original idea was from Sanbird.
      It will scan while you're inside a vehicle for either a locked cinder or a locked wooden door, providing you have access to it, it will allow you to open/close it from inside the car.
      https://github.com/oiad/garageDoorOpener
    • By Rezusty
      Hi guys,
      I'm running Epoch 0.5 Server build 749, trying to customize traders camp with in-game structures like, for example, adding a military cargo hq to it. I already have edited epoch_server_settings.pbo (altis.h in my case) to add the building in the map, it's working but I can't open doors.
      I've read that it has something to do with: enableSimulationGlobal
      I'm pretty sure this question has already been answered, but I've tried a lot of solutions and I can't get it to work... every other buildings on the map are working fine
      Thanks
      P.S.: Sorry for my english, haven't practised for a while
    • By Stephnet
      we have a server Epoch version 3.1.0, it is configured in indestrutible wall. Only doors can be destroyed.   Do you know how explosive satchel charges to destroy it be a door of a base. For three charges are not enough ....
    • By AlpacalypseTSH
      Hey guys, I recently had Zupa's custom clothing working really well.. then I installed Door Management and I cannot get the clothes script getList.sqf to function correctly.
       
      When I right click on a skin, the dialogue menu pops up, but it isn't populated. This is really pissing me off and I'm hoping that someone possibly has a fix. I looked in my client RPT and here's what I've found:
       



       
      When I checked the getList.sqf, there were no syntax errors at all that could have tripped this and I'm getting frustrated trying to figure it out. Thanks for the help, guys.
  • Advertisement
  • Supporters
  • Discord

×
×
  • Create New...