Jump to content

[Release] Safe zone vehicle management - 1.0.6


Joshyy

Recommended Posts

This will unlock vehicles that are left inside safezones and if they are not taken within 15 minutes it will remove them.

Step 1.

Define your safe zone positions in config Variables or below #include "configVariables"

DZE_SafeZonePosArray = [
[[4064,11665,0],510], // Bash
[[6326,7809,0],510], // Stary
[[11447,11364,0],510], // Klen
[[12944,12766,0],510], // Hero Camp
[[1606,7803,0],510] // Bandit camp
]; 

^^ above are my safezones, you could also add the aircraft dealer if you wish

Step 2.

go to your server_monitor.sqf located in dayz_server\system

find

  Reveal hidden contents

then find this below it

  Reveal hidden contents

add this directly below that

  

  Reveal hidden contents

 

This is what it should look like

  Reveal hidden contents

If you wish to change the settings e.g the range at which it deletes vehicles, or if you want vehicles to be removed faster or instantly simple edit the "uiSleep (60 * 15);" if you want to remove the 15 minute wait, just remove that line of code or comment it out.

 

Leave a comment if you need any help.

Link to comment
Share on other sites

Getting an error

 

  Reveal hidden contents

 

 

This is my code, I changed the 150 to 140 but thats it. Ill try the default again and see what happens.

 

  Reveal hidden contents

 

Link to comment
Share on other sites

Still same error with default code. Do I need to put _object or something at the top of the file?

 

  Reveal hidden contents

 

Link to comment
Share on other sites

when you spawn a thread you need to reference the object in this case as _this. here is some fixed code. 

 

         {
                if (_object distance (_x select 0) < 150) then { // '150' represents the distance from the safezone where it will check the vehicles
                    _object spawn {
                        _this setVehicleLock "UNLOCKED"; //Unlock the vehicle so its free to take
                        _this setVariable ["CharacterID", "0", true]; // Make sure it stays unlocked if someone has taken it
                        _oldPos = getPosATL _this;
                        diag_log (typeOf _this+' was left inside a safezone! POS: '+str(_oldPos));
                        uiSleep 900; // Wait 15 minutes before deleting
                        if (_this distance _oldPos < 150) then { // Check if it has left the safezone
                            [nil, nil, rSpawn, ["Vehicle "+typeOf _this+" has been deleted due to being left in a safezone after a restart."], {systemChat ("(Vehicle Cleanup): "+(_this select 0)+".")}] call RE;
                            _objectID = _this getVariable ["ObjectID","0"];
                            _objectUID = _this getVariable ["ObjectUID","0"];
                            [_objectID,_objectUID,objNull] spawn server_deleteObj; // Delete it from database
                            if !(isNull _this) then {deleteVehicle _this}; // Delete it from map
                        };
                    };
                };
            } forEach DZE_SafeZonePosArray;

 

Link to comment
Share on other sites

  On 12/13/2016 at 3:58 PM, icomrade said:

when you spawn a thread you need to reference the object in this case as _this. here is some fixed code. 

 

         {
                if (_object distance (_x select 0) < 150) then { // '150' represents the distance from the safezone where it will check the vehicles
                    _object spawn {
                        _this setVehicleLock "UNLOCKED"; //Unlock the vehicle so its free to take
                        _this setVariable ["CharacterID", "0", true]; // Make sure it stays unlocked if someone has taken it
                        _oldPos = getPosATL _this;
                        diag_log (typeOf _this+' was left inside a safezone! POS: '+str(_oldPos));
                        uiSleep 900; // Wait 15 minutes before deleting
                        if (_this distance _oldPos < 150) then { // Check if it has left the safezone
                            [nil, nil, rSpawn, ["Vehicle "+typeOf _this+" has been deleted due to being left in a safezone after a restart."], {systemChat ("(Vehicle Cleanup): "+(_this select 0)+".")}] call RE;
                            _objectID = _this getVariable ["ObjectID","0"];
                            _objectUID = _this getVariable ["ObjectUID","0"];
                            [_objectID,_objectUID,objNull] spawn server_deleteObj; // Delete it from database
                            if !(isNull _this) then {deleteVehicle _this}; // Delete it from map
                        };
                    };
                };
            } forEach DZE_SafeZonePosArray;

 

Expand  

Thanks, updated OP.

 

I added the unlocking right before posting and didn't even realise :D.

Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...
  • 2 weeks later...
  • 2 weeks later...

I think you guys forget not everyone is so seasoned in scripting and still trying to learn the files. not to be rude but condescending comments don't help. for instance I have a server from survival servers. I cant find "Define your safe zone positions in config Variables or below #include "configVariables"". makes no sense to me. I found a tut from juandayz that doesn't seem to apply. I went to my main root/epoch_dayz/addons/dayz_code and copied that over but it has a lot of the same options as my main files. my root has by default by survival servers EpochConfig.sqf, MainSysConfig.sqf and TraderConfig.sqf being called from the init labled //Epoch Config Variables. I pulled the configvariables.sqf from dayz_code. if I add a call in my init and this file has a lot of the same configurations as those custom files they made, will it break my server? the point is, I'm not looking for an opinion on who is a good or bad server provider. I am not as advanced or good as you guys to have my own server box yet. survival servers has been really good so far but "Define your safe zone positions in config Variables or below #include "configVariables" " makes no sense to me as well as many others. Do I put it in one of those premade files? EpochConfig.sqf, MainSysConfig.sqf or TraderConfig.sqf? Do I pull the configvariables file from dayz_code and just call it from my init? Do I put it in my variables.sqf? Do I install suicide script and just pull the trigger?

 

thanks.

a lot of us rely on your knowledge andmost of us wish e knew as much as yall

Link to comment
Share on other sites

  On 3/18/2017 at 2:56 PM, Jestertriks said:

I think you guys forget not everyone is so seasoned in scripting and still trying to learn the files. not to be rude but condescending comments don't help. for instance I have a server from survival servers. I cant find "Define your safe zone positions in config Variables or below #include "configVariables"". makes no sense to me. I found a tut from juandayz that doesn't seem to apply. I went to my main root/epoch_dayz/addons/dayz_code and copied that over but it has a lot of the same options as my main files. my root has by default by survival servers EpochConfig.sqf, MainSysConfig.sqf and TraderConfig.sqf being called from the init labled //Epoch Config Variables. I pulled the configvariables.sqf from dayz_code. if I add a call in my init and this file has a lot of the same configurations as those custom files they made, will it break my server? the point is, I'm not looking for an opinion on who is a good or bad server provider. I am not as advanced or good as you guys to have my own server box yet. survival servers has been really good so far but "Define your safe zone positions in config Variables or below #include "configVariables" " makes no sense to me as well as many others. Do I put it in one of those premade files? EpochConfig.sqf, MainSysConfig.sqf or TraderConfig.sqf? Do I pull the configvariables file from dayz_code and just call it from my init? Do I put it in my variables.sqf? Do I install suicide script and just pull the trigger?

 

thanks.

a lot of us rely on your knowledge andmost of us wish e knew as much as yall

Expand  

this is the one i use personally, and i find you can do much more with it.

nothing against your post joshyy, just a different way to tackle the issue at hand :)

Link to comment
Share on other sites

  On 3/18/2017 at 2:56 PM, Jestertriks said:

I think you guys forget not everyone is so seasoned in scripting and still trying to learn the files. not to be rude but condescending comments don't help. for instance I have a server from survival servers. I cant find "Define your safe zone positions in config Variables or below #include "configVariables"". makes no sense to me. I found a tut from juandayz that doesn't seem to apply. I went to my main root/epoch_dayz/addons/dayz_code and copied that over but it has a lot of the same options as my main files. my root has by default by survival servers EpochConfig.sqf, MainSysConfig.sqf and TraderConfig.sqf being called from the init labled //Epoch Config Variables. I pulled the configvariables.sqf from dayz_code. if I add a call in my init and this file has a lot of the same configurations as those custom files they made, will it break my server? the point is, I'm not looking for an opinion on who is a good or bad server provider. I am not as advanced or good as you guys to have my own server box yet. survival servers has been really good so far but "Define your safe zone positions in config Variables or below #include "configVariables" " makes no sense to me as well as many others. Do I put it in one of those premade files? EpochConfig.sqf, MainSysConfig.sqf or TraderConfig.sqf? Do I pull the configvariables file from dayz_code and just call it from my init? Do I put it in my variables.sqf? Do I install suicide script and just pull the trigger?

 

thanks.

a lot of us rely on your knowledge andmost of us wish e knew as much as yall

Expand  

I'm still learning as well. I used to go though gtx before i got my box and they did not have half the files either. What you should be able to do is make a file name it like something customVariables.sqf  in a custom folder

Add this into it

  Reveal hidden contents

then add in your mission init.sqf

  Reveal hidden contents

Under

  Reveal hidden contents

 

Link to comment
Share on other sites

Thank you @Hooty. That's exactly what I was confused about because they created theyre own files. I loved GTX till they took the .dll editing away and limited access to the database. Survival servers are not the greatest with support but eventually they get to answering you. GTX use to answer with-in 1-2 minutes, it was amazing for when the server box went down or I got ddossed or some crap like that. it sucks waiting a day or more for survival servers. I cant wait till I grasp more of the scripting and move on to my own box or rent one from OVH

 

thanks a lot for your time

Link to comment
Share on other sites

Configvariables.sqf is inside the dayz_code.pbo in the @dayz_epoch folder.

Simply copy that file and place it inside your mission folder somewhere.

In your init.sqf, where its says

#include "\z\addons\dayz_code\configVariables.sqf" // Don't remove this line

directly below this put

#include "thefilepathyouputthefile\configVariables.sqf"

You can then comment out the orignal line so it looks like

//#include "\z\addons\dayz_code\configVariables.sqf" // Don't remove this line

 

Once you have done that, you can add the safezone array to the configvariable.sqf file you just made.

 

Link to comment
Share on other sites

Thank you for responding lwbuk. What I'm mainly asking is, if I do what your saying. The configvariables.sqf has most of the configurations: Plot management, snap build, dynamic vehicles, ect.... as the files I have in my root. if I make a call to that file after dragging it over, will it conflict since they will be there twice?

 

Hooty's example was perfect although I went with using thedukes suggestion for I did not know that files would still work with 1.0.6. I used that in my 1.0.5.1 and it worked great

Link to comment
Share on other sites

  On 3/18/2017 at 3:33 PM, Jestertriks said:

Thank you @Hooty. That's exactly what I was confused about because they created theyre own files. I loved GTX till they took the .dll editing away and limited access to the database. Survival servers are not the greatest with support but eventually they get to answering you. GTX use to answer with-in 1-2 minutes, it was amazing for when the server box went down or I got ddossed or some crap like that. it sucks waiting a day or more for survival servers. I cant wait till I grasp more of the scripting and move on to my own box or rent one from OVH

 

thanks a lot for your time

Expand  

No problem. Happy to help.

Link to comment
Share on other sites

Without knowing exactly how the file structure has been made its hard to say. Youll probably have various calls in your init.sqf to all the different config files, which you could in theroy delete and just use the deafult ones.

HOWEVER.

If the host has gone to trouble of messing with the files that much and creating loads of pointless extra config files, its probably not worth the hassle of changing it around trying to find all the different calls and mentions of these extra files.

I dont know why these hosting compnaies make life so difficult for people, its supposed to be the easlier option.

Link to comment
Share on other sites

Yes. I feel they are just trying to make make it easy to config the server for users. maybe be different from other hosts. that's why Hooty's answer is perfect for a generic file edit that applies to all users. I wasn't sure if it would overwrite the default and work to simply just add that call command.

Link to comment
Share on other sites

@Jestertriks the configvariables in dayz_code folder is some default options. You can copy that file over to mission side in its entirety and change the call in the init to read your new copy OR you can just copy PARTS of that file and add it to your init or as many people like to do and is a good idea if adding a lot of scripts is to have a custom variables file that gets called in your init AFTER the original configvariables from dayz_code.

#include "\z\addons\dayz_code\configVariables.sqf" // Don't remove this line (around line 47 for me) all these variables get loaded into memory

The first item in configVariables.sqf is 
dayz_knifeDulling = false;

Lets assume we want to make this TRUE

We can set this as true by adding the line to the init.sqf 
dayz_knifeDulling =  true;
we must add this line AFTER the default variables are loaded. in my case AFTER line 47. otherwise we set it true and then we load configVariables and that sets it false again.

around line 140 in my init i have
call compile preprocessFileLineNumbers "dayz_code\init\variables.sqf";  // this is my custom variables file. its getting loaded toward the end of the init so anything in here will overwrite configVariables.sqf and anything i have defined in the init before this line.

You can also ADD to variables.

DZE_PlotManagementAdmins = ["1234567890"]; // assume this is in your init

then later in your custom configs...
DZE_PlotManagementAdmins = DZE_PlotManagementAdmins  + someOtherListof_Admins; // the format of this code is wrong cause im an idiot . The goal is to just tell you it can be done lol.

 

Link to comment
Share on other sites

Hey,

got this error in RPT:

16:10:17 Error in expression <enableSimulation true;
};
{
if (_object distance (_x select 0) < 150) then { 
_o>
16:10:17   Error position: <distance (_x select 0) < 150) then { 
_o>
16:10:17   Error distance: Typ Zahl, erwartet Array,Objekt,Location
16:10:17 File z\addons\dayz_server\system\server_monitor.sqf, line 293

 

Link to comment
Share on other sites

  • 1 year later...

Hey guys...
First of all thanks a lot for all the work you are doing, I am learning step by step with all "trial and error" steps but... little by little and with all I read here, I am getting some advances.

So now I have a question for developers, and considering I am a beginner in the area, is there a way (guide, advice, code pre design) to creat something like a "safe zone" but backwards.

Meaning, We want to make Cherno and Electro "PvP areas".  My idea is to mark them in map as the safezones but when you enter you have the announcemente that "you entered a PvP area".  
I would be thankfull for any kind of advice and or suggestion.

Link to comment
Share on other sites

  On 4/5/2018 at 2:51 AM, LadyVal said:

Hey guys...
First of all thanks a lot for all the work you are doing, I am learning step by step with all "trial and error" steps but... little by little and with all I read here, I am getting some advances.

So now I have a question for developers, and considering I am a beginner in the area, is there a way (guide, advice, code pre design) to creat something like a "safe zone" but backwards.

Meaning, We want to make Cherno and Electro "PvP areas".  My idea is to mark them in map as the safezones but when you enter you have the announcemente that "you entered a PvP area".  
I would be thankfull for any kind of advice and or suggestion.

Expand  

If you look into your mission.sqm you can see an area that notifies you when you enter the safezone. You can add 2 more entries and have them for your two PvP areas, just increase the area you are notified. Just be sure to increase the "items=6" to however many you add to the list.
 

  Reveal hidden contents

 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...