MatthewK Posted October 22, 2013 Report Share Posted October 22, 2013 Edited: Silvershot updated his original script (I didn't realise he was because he hadn't replied to any of the questions on his original post, hence why I tried to make this version myself). I had no intentions of using this myself, I just didn't like seeing people asking for a script that was obviously easy enough to make, even for an amateur like myself. Anyway his version is definitely much better as he understands the code better than me, so here it is: http://dayzepoch.com/forum/index.php?/topic/1345-safezones-without-gear-menu-open-backpack/page-3#entry16760 . NB: His updated script doesn't allow you to remove or access backpacks on dead bodies (yet). The version below does. Feel free to continue using mine, I'll leave it here so people can maybe learn from it. As I am :) ---- My version ------ Confirmed to be working. Replace { !canbuild } with { alive player } if you want it on ALL the time, not just in the trader zones.Installation Instructions: 1. I'm assuming you're going to put this script in a folder called Custom. 2. Create a new text file and call it anti_theft.sqf 3. Cut and Paste the following code into the anti_theft.sqf file and save it. 4. Edit your init.sqf and right at the bottom add: execVM "custom\anti_theft.sqf"; (skip to 6 if you go with this option) 5. Alternatively, add this antitheft = execVM "custom\anti_theft.sqf"; to your trigger activation, right after canbuild = false; 5a. Then add this terminate antitheft; right at the end of your triggers exit code, right after canbuild = true; 5b. Do steps 5 and 5a for each of your trader triggers (if the script isn't in the trigger for that trader zone, it won't Trigger!!) IMPORTANT: If you choose to go with step 5 then do NOT follow step 4. HOWEVER, if you are going to go with the ALWAYS on option, then you will have to use step 4 as step 5 and 5a are for triggers (trader cities) only. Hope that made sense, if not please say. 6. Repackage your mission file, upload and everything should work. // Thanks to SilverShot for starting this script. // Anti-Theft (Backpack) by Hayward _fix = false; while { !canbuild } do { sleep 0.2; // Check if target is player and alive if (alive cursorTarget && (cursorTarget isKindOf "Man")) then { if( !isNull (FindDisplay 106) ) then { if( !_fix ) then { player action ["GEAR", ""]; titleText["\n\nCan only access your own gear.", "PLAIN DOWN",0]; _fix = true; }; } else { if( _fix ) then { _fix = false; }; }; // If target is not a player then do nothing } else { }; }; bFe 1 Link to comment Share on other sites More sharing options...
MatthewK Posted October 22, 2013 Author Report Share Posted October 22, 2013 No longer working on a "IS FRIENDLY" version, as I'm sure SilverShot will release a version of his own soon enough :D bFe and BetterDeadThanZed 2 Link to comment Share on other sites More sharing options...
BetterDeadThanZed Posted October 22, 2013 Report Share Posted October 22, 2013 This is awesome. Thanks for sharing. I will put the friendly tag version on my server after you've confirmed it's working. MatthewK and bFe 2 Link to comment Share on other sites More sharing options...
MatthewK Posted October 22, 2013 Author Report Share Posted October 22, 2013 This is awesome. Thanks for sharing. I will put the friendly tag version on my server after you've confirmed it's working. Let me know if it works on your server. It's working fine on mine, but I know how flaky even the simplest bit of code can be. Still working on the friendly tag version, if your server isn't busy and you want to test it for me I'd be grateful. I'll log in and test it with you of course. Link to comment Share on other sites More sharing options...
vex_dev Posted October 23, 2013 Report Share Posted October 23, 2013 Awesome, thanks to share, i will install it on my sv soon MatthewK 1 Link to comment Share on other sites More sharing options...
Flens Posted October 23, 2013 Report Share Posted October 23, 2013 Awesome work! Thank you for this nice Script. Will try the Friendly version with { alive player } Link to comment Share on other sites More sharing options...
MatthewK Posted October 23, 2013 Author Report Share Posted October 23, 2013 Awesome work!Thank you for this nice Script. Will try the Friendly version with { alive player }Let me know how you get on with the friendly version. I still haven't been able to test it yet. Link to comment Share on other sites More sharing options...
BetterDeadThanZed Posted October 23, 2013 Report Share Posted October 23, 2013 Let me know if it works on your server. It's working fine on mine, but I know how flaky even the simplest bit of code can be. Still working on the friendly tag version, if your server isn't busy and you want to test it for me I'd be grateful. I'll log in and test it with you of course. I've got some stuff to do today, but if I have time, I'll test it out today. MatthewK 1 Link to comment Share on other sites More sharing options...
vex_dev Posted October 23, 2013 Report Share Posted October 23, 2013 Also you can add it to trader triggers adding a private variable, so the script only run when the player is withn trader area and do not make trouble with other server areas which has "can build" property. Example: Private ["_triggername"]; _triggername = _this select 0; while {true} do { //wait until Player is in the area waitUntil {vehicle player in list _triggername}; //rest of the code and you call it usin [triggername] execvm anti_theft.sqf in the trigger from mission.sqm like this class Item0 { position[]={6325.6772,304.99033,7807.7412}; activationBy="WEST"; repeating=1; interruptable=1; age="UNKNOWN"; name="zonestary"; expCond="(player distance zonestary) < 50;"; expActiv="if (playerSide == WEST) then {[zonestary] execVM ""anti_theft.sqf""};TitleText[""Now entering trader city Stary, don't shoot or pay consequences"",""PLAIN DOWN""]; canbuild = true;"; expDesactiv="TitleText[""Now leaving trader city Stary"",""PLAIN DOWN""]; canbuild = true;"; class Effects { }; }; that is from stary trader MatthewK 1 Link to comment Share on other sites More sharing options...
MatthewK Posted October 23, 2013 Author Report Share Posted October 23, 2013 That's how I was testing it. I created a testing area off the map. You can simply terminate a script when the player leaves the trigger, saves you having to do any extra work setting private variables etc.. I called my script like this at the end of the expActiv field: antitheft = [] execVM "custom\anti_theft.sqf"; Then in the expDesactiv field I added: terminate antitheft; to the end. The player enters that trigger, my script runs, the player leaves and it's terminated :) vex_dev 1 Link to comment Share on other sites More sharing options...
Flens Posted October 24, 2013 Report Share Posted October 24, 2013 Let me know how you get on with the friendly version. I still haven't been able to test it yet. It works perfect for me! thx again vex_dev 1 Link to comment Share on other sites More sharing options...
MatthewK Posted October 24, 2013 Author Report Share Posted October 24, 2013 Ok, I didn't realise Silvershot was updating his original script. His version is obviously better in terms of server performance and lag. You can get it here: http://dayzepoch.com/forum/index.php?/topic/1345-safezones-without-gear-menu-open-backpack/page-3#entry16760 For now I'd probably just use mine as an example. I'm going to stop working on my Tagged Friendly version then, as I'm sure Silvershot will release an updated version of his soon too. :) Link to comment Share on other sites More sharing options...
MatthewK Posted October 24, 2013 Author Report Share Posted October 24, 2013 I only tried to help with my code as it seemed like nobody else was (I can't stand seeing people ask questions that somebody here can obviously answer, but just be ignored). My coding skills are not as good as SilverShots and I did ask in a previous thread if anyone would look at mine but nobody did, or even replied (Silvershot could have said he was working on a better version). As I'm using what I do anyway to help me understand the arma coding language better it would help if the more experienced programmers of this community showed their support a little more (I'm not having a dig, just saying that having your questions and requests go ignored by such a decent community makes you wonder), I appreciate your feedback by the way. I hadn't thought about the lag issues yet as my server is only 20 users strong. Anyway, I'll leave this project alone for now. I'm one of those people who likes to get something done today, instead of next week. But I guess people will just have to wait for quality ;) Link to comment Share on other sites More sharing options...
vex_dev Posted October 24, 2013 Report Share Posted October 24, 2013 Hey, i appreciate your work, so don't stop to make things even if you are not a programmer. I'm sorry if i offended you with my comment Link to comment Share on other sites More sharing options...
bFe Posted October 24, 2013 Report Share Posted October 24, 2013 Will definitely add this, great work hayward! Link to comment Share on other sites More sharing options...
MatthewK Posted October 25, 2013 Author Report Share Posted October 25, 2013 Hey, i appreciate your work, so don't stop to make things even if you are not a programmer. I'm sorry if i offended you with my comment You didn't offend me at all. I liked your comment. I was just saying in my little rant that it would be helpful if the more experienced developers answered questions and helped the less experienced like myself, as in all honesty I don't have a use for the backpack antitheft script but I knew in my limited knowledge that it was possible. Your comment about the trigger activation was a good point, one that I'd missed myself while trying to produce this script :) .. I'll add that to the first post btw, so people can put it in their triggers only and avoid additional lag issues. Link to comment Share on other sites More sharing options...
MatthewK Posted October 25, 2013 Author Report Share Posted October 25, 2013 I've asked about the friendlyto and friendly values in the epoch code, but nobody has answered yet. I'll give it another day or two then I'm giving up on it as I'm totally stumped by this one hurdle at the moment and the people who have the solid answer, are the devs of course. I wait, patiently :P Link to comment Share on other sites More sharing options...
MatthewK Posted October 25, 2013 Author Report Share Posted October 25, 2013 Hi ebay, I appreciate how you helped me out by pointing me in the right direction the other evening. I hear what you're saying and I agree, to a point. There is a lot of cut and pasting when it comes to coding for Arma, especially noobs, I've seen my debug code copied several times, which I copied bits and bobs from other sources, so it goes hand in hand. I try my best to understand what I'm doing completely before I give it to the public, so cutting and pasting something that works close enough to what I'm looking for, then tweaking a bit here and a bit there helps me to understand how and why that part does what it does (if you get my drift). Not everybody learns well from books, I certainly don't, I learn by pulling stuff apart and putting it back together (learning about each component as I do it). Anyway, unless you took programming as a subject at uni I'm sure you started at the same place I and others are starting from and possibly many more after us, and I'm pretty sure you cut and pasted your way to where you are today , to the point where you don't need to because you understand the language now, you know where all the resources are, etc.. As for searching first , I guess the gripe with that for me is, how can I search for it when I don't even know what phrase or keyword to search for, because trust me I've searched and I've searched lol :) Kudos to you, as I think you're an asset to this community. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now