LunchboxCharlie Posted June 2, 2014 Report Share Posted June 2, 2014 We have AGN safe zones, but I believe this will work with just vanilla Dayz Epoch since the 'canbuild' function is from Epoch. I got ideas on how to write this all over the forums, if you need or want credit, please let me know. I don't remember where portions of code came from. Works perfect on our server (Doubletapdayz: Lunchbox and HisShadow). Tested with: 1.0.4.2a How it works: Vehicle god mode on entrance of a safe zone. Once the player leaves the Safe Zone without the vehicle, god mode on it will turn off and be damageable once again. The player has to at least drive into the safe zone or enter the vehicle at least once to activate the god mode. Once the player and vehicle leaves your designated safe zone, it will deactivate and return to normal. Limitations: Player must be logged in for the vehicle god mode to be active. Player must have at least entered the vehicle once. Player must remain in the safe zone for the vehicle to remain god moded. Edited: Added a private entry for the variable theVehicle so it won't interrupt any other scripts. safezonevehicle.sqf // Godmode vehicle in safe zones. // How it works: When in safezone, vehicle takes no damage. However, When the player // leaves the safezone with the car in the safezone, the car will take damage. // This is to prevent abuses with the safezone system. // Written for Doubletapdayz if (isNil "canbuild") then { canbuild = true; }; while {true} do { // Vehicle Godmode on. waitUntil { !canbuild }; waitUntil { player != vehicle player }; private ["theVehicle"]; theVehicle = vehicle player; theVehicle removeAllEventHandlers "handleDamage"; theVehicle addEventHandler ["handleDamage", {false}]; theVehicle allowDamage false; fnc_usec_damageVehicle ={}; vehicle_handleDamage ={}; vehicle_handleKilled ={}; // hintSilent "Vehicle godmode ON"; // Uncomment this to help see when it turns on waitUntil { canbuild }; // Vehicle Godmode off. theVehicle removeAllEventHandlers "handleDamage"; theVehicle addEventHandler ["handleDamage", {_this select 2}]; theVehicle allowDamage true; // Call global scripts. fnc_usec_damageVehicle = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandlerVehicle.sqf"; vehicle_handleDamage = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_handleDamage.sqf"; vehicle_handleKilled = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_handleKilled.sqf"; // hintSilent "Vehicle godmode OFF"; // Uncomment this to help see when it turns off }; Place file in the scripts folder, if it doesn't exist in your missions file create a folder called scripts. Paste into the isdedicated portion of your init.sqf of your missions file: [] execVM "scripts\safezonevehicle.sqf"; Should be good to go. It really is that easy. :) I'm a long time lurker and figured I should contribute. HisShadow 1 Link to comment Share on other sites More sharing options...
MGT Posted June 2, 2014 Report Share Posted June 2, 2014 Do all vehicles lose god mode when they leave the traders? I've tried many ways to enable this but they hold on to god mode when they've left. Link to comment Share on other sites More sharing options...
LunchboxCharlie Posted June 2, 2014 Author Report Share Posted June 2, 2014 Do all vehicles lose god mode when they leave the traders? I've tried many ways to enable this but they hold on to god mode when they've left. Every single vehicle I have tried has lost god mode on leaving. I've tried helis, cars and even planes. I've also had a buddy fire onto vehicles outside the zone, while mine was godmoded to be sure that it didn't god mode all vehicles when a single player enters. I have not tested with AI firing at it however, but still, I don't think AI will effect how the script works. I could be wrong however. :p MGT 1 Link to comment Share on other sites More sharing options...
Csus Posted June 3, 2014 Report Share Posted June 3, 2014 nice work :) i was just finishing up the same thing but you beat me to the punch :P if i might suggest, i'd replace all 'theVehicle' variables with '_theVehicle'. it won't make a difference to the script at all but if another script someone has just happens to have a variable called 'theVehicle' the 2 will clash and break both scripts. please, don't think i'm trying to butt in, just offering some advice :) Link to comment Share on other sites More sharing options...
HisShadow Posted June 3, 2014 Report Share Posted June 3, 2014 this has worked for us no problem in testing , post any unusual behavior you find , and this can also be used to block most any functions you need in safezones so it can be adapted for knockouts in safe zone arrest and other unwanted functions , we will probably release further versions of those scripts should the original authors take no issue. Link to comment Share on other sites More sharing options...
crazzeddemonn Posted June 3, 2014 Report Share Posted June 3, 2014 Ok so what i have found is that the god mode works when you crash into things or ram another vehicle but thats not fixing the problem i have of players shooting into the trader and destroying vehicles.. Link to comment Share on other sites More sharing options...
LunchboxCharlie Posted June 3, 2014 Author Report Share Posted June 3, 2014 Ok so what i have found is that the god mode works when you crash into things or ram another vehicle but thats not fixing the problem i have of players shooting into the trader and destroying vehicles.. It's working perfectly for us. Note: If the driver leaves the safe zone without the vehicle, the vehicle will become damageable as well. It's not 100% of the time, only when the driver is present. This also does not include recently purchased vehicles the driver has not gotten into yet. As per the limitations listed with the script. I will test an islocked check. I didn't add an islocked check before, because I assumed people jumped straight into the vehicles they purchase. :P Link to comment Share on other sites More sharing options...
LunchboxCharlie Posted June 3, 2014 Author Report Share Posted June 3, 2014 It's working perfectly for us. Note: If the driver leaves the safe zone without the vehicle, the vehicle will become damageable as well. It's not 100% of the time, only when the driver is present. This also does not include recently purchased vehicles the driver has not gotten into yet. As per the limitations listed with the script. I will test an islocked check. I didn't add an islocked check before, because I assumed people jumped straight into the vehicles they purchase. :P Infistar already did a islocked check in safezones script: http://pastebin.com/i2FsHwXg Link to comment Share on other sites More sharing options...
HisShadow Posted June 3, 2014 Report Share Posted June 3, 2014 ALSO A BIG REMINDER YOU MUST REMAIN IN THE SAFEZONE FOR THE VEHICLE TO BE GODMODED this is intentional behavior as to not allow abuse of safezones to save cars or use as a shield at the edge of the zone for firefights and other sneaky shit players are known for coming up with, and again post any reasonable exploits you come across. you have to be in or get in a vehicle for godmode to be applied. Link to comment Share on other sites More sharing options...
LunchboxCharlie Posted June 3, 2014 Author Report Share Posted June 3, 2014 nice work :) i was just finishing up the same thing but you beat me to the punch :P if i might suggest, i'd replace all 'theVehicle' variables with '_theVehicle'. it won't make a difference to the script at all but if another script someone has just happens to have a variable called 'theVehicle' the 2 will clash and break both scripts. please, don't think i'm trying to butt in, just offering some advice :) I understand, I'll change it. :) Link to comment Share on other sites More sharing options...
crazzeddemonn Posted June 3, 2014 Report Share Posted June 3, 2014 Thanks ! Link to comment Share on other sites More sharing options...
Vindomire Posted June 3, 2014 Report Share Posted June 3, 2014 i have vehicle safe in safe zones whether locked or unlocked player in them or not, Vehicles safe 50m within plot pole distance if not crewed and always god mode when locked... instead of coding that you just stick 5 or 6 lines in the vehicle damage handler file.... always works flawlessly without editing handlers. Link to comment Share on other sites More sharing options...
LunchboxCharlie Posted June 3, 2014 Author Report Share Posted June 3, 2014 i have vehicle safe in safe zones whether locked or unlocked player in them or not, Vehicles safe 50m within plot pole distance if not crewed and always god mode when locked... instead of coding that you just stick 5 or 6 lines in the vehicle damage handler file.... always works flawlessly without editing handlers. It was intentionally set up that way so people couldn't exploit the system. IE: Locking people out of safe zones because they made a wall of cars. Link to comment Share on other sites More sharing options...
Vindomire Posted June 3, 2014 Report Share Posted June 3, 2014 if that happened my admins just delete them lol. if it works as described it is a good job. I didnt feel like tracking if people were in the safe zone in case of disconnect. then an AI chopped flyes by and blows it to hell. Link to comment Share on other sites More sharing options...
HisShadow Posted June 4, 2014 Report Share Posted June 4, 2014 maybe im being a bit nitpicky here but kinda a dick move to post in a mod thread that you have the same mod , then go on to not be the same functionality and have to compensate for it , to boot you niether posted the code here when talking about it, or when others have clearly been asking for it on forums (forums your clearly watching to have posted here). Seems your easy 5 lines coulda helped out had you ever posted it, even now ... also your solution isnt complete with logic as the one offered here intends , needing to admin or compensate for not having functionality isnt the same. Anyways if you like spending your time admining rather then having it offer a near complaint proof system that only requires the same general cleanup of traders you normally should be performing then you have .. i was goiung to say two choices but as you havent posted code ...everyone elses choices are limited, but you can clearly choose not to use this. sorry but this kinda stuff gets ma goat and i probably come off a bit dickish but ... just post code if you have code it helps everyone or dont elude to it or brag or whatever that thing is pple seem to need to do on forums. Link to comment Share on other sites More sharing options...
Mist Posted June 4, 2014 Report Share Posted June 4, 2014 Just searched for this after a group rage quit cause they crashed a vodnik somehow in the traderzone and it just blew up with all their stuff in it. Is this confirmed to work on all vehicles? I just don't want to accidentally give all my players god mode vehicles after the trader. Thanks for this script Link to comment Share on other sites More sharing options...
LunchboxCharlie Posted June 5, 2014 Author Report Share Posted June 5, 2014 Maybe somebody is willing to try my safezone script, I've put in something to prevent vehicle damage but have not tested it: https://pastebin.com/ht7djVGH I'll test out your script tomorrow. :) Link to comment Share on other sites More sharing options...
Csus Posted June 5, 2014 Report Share Posted June 5, 2014 @ infiSTAR verrrry clean code, i'm looking forward to trying this out later :) Link to comment Share on other sites More sharing options...
ricwoodard Posted July 13, 2014 Report Share Posted July 13, 2014 Using infiSTAR's Safe Zone but all players are getting banned: | BadVar: gmdadmin = "gmdadmin" (BANNED)" Link to comment Share on other sites More sharing options...
Cannon Posted August 17, 2014 Report Share Posted August 17, 2014 Maybe somebody is willing to try my safezone script, I've put in something to prevent vehicle damage but have not tested it: https://pastebin.com/ht7djVGH We've got your AH so we'll try this as well as we are having issues with AGN not working properly 100% of the time (people outside can still shoot in and certain skins seem to be exempt from the safe zone..) Will let you know how we get on Link to comment Share on other sites More sharing options...
robbiedarza Posted August 18, 2014 Report Share Posted August 18, 2014 Hello, I have a custom trader setup at gorka with safe zones using maccas improved safezones and this script works for stary but gorka doesnt, Is there any way I can add gorka in please? Many thanks Robbie Link to comment Share on other sites More sharing options...
ElDubya Posted October 20, 2014 Report Share Posted October 20, 2014 Maybe somebody is willing to try my safezone script, I've put in something to prevent vehicle damage but have not tested it: https://pastebin.com/ht7djVGH Will this code only work for your infistar customers? Or anyone? 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