ALKINDA Posted December 5, 2014 Report Share Posted December 5, 2014 Hello, I have been wondering how to do this, I don't like how people are leaving their cars in my safezone areas and in the airfields. I was wondering if somehow in the fn_selfactions.sqf we can add an if statement to not allow people to lock if they are in that area. This is the chunk of code im trying to modify for this if that helps. //FN_SELFACTIONS.SQF // Allow Owner to lock && unlock vehicle if(_player_lockUnlock_crtl) then { if (s_player_lockUnlock_crtl < 0) then { _hasKey = _characterID in _temp_keys; _oldOwner = (_characterID == dayz_playerUID); if(locked _cursorTarget) then { if(_hasKey || _oldOwner) then { _Unlock = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\unlock_veh.sqf",[_cursorTarget,(_temp_keys_names select (parseNumber _characterID))], 2, true, true, "", ""]; s_player_lockunlock set [count s_player_lockunlock,_Unlock]; s_player_lockUnlock_crtl = 1; } else { if(_hasHotwireKit) then { _Unlock = player addAction [format[localize "STR_EPOCH_ACTIONS_HOTWIRE",_text], "\z\addons\dayz_code\actions\hotwire_veh.sqf",_cursorTarget, 2, true, true, "", ""]; } else { _Unlock = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_VEHLOCKED"], "",_cursorTarget, 2, true, true, "", ""]; }; s_player_lockunlock set [count s_player_lockunlock,_Unlock]; s_player_lockUnlock_crtl = 1; }; } else { if(_hasKey || _oldOwner) then { _lock = player addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\lock_veh.sqf",_cursorTarget, 1, true, true, "", ""]; s_player_lockunlock set [count s_player_lockunlock,_lock]; if (_typeOfCursorTarget in ColourVehicles) then { private ["_paint"]; _paint = player addAction ["Paint", "Paint\player_paint_init.sqf",_cursorTarget, 2, true, true, "", ""]; s_player_lockunlock set [count s_player_lockunlock,_paint]; }; s_player_lockUnlock_crtl = 1; }; }; }; } else { {player removeAction _x} count s_player_lockunlock;s_player_lockunlock = []; s_player_lockUnlock_crtl = -1; }; //MISSION.SQM class Sensors { items=1; class Item0 { position[]={6325.6772,304.99033,7807.7412}; a=100; b=100; activationBy="WEST"; repeating=1; interruptable=1; age="UNKNOWN"; name="zonestary"; expCond="(player distance zonestary) < 100;"; expActiv="[""trader city Stary"",true,""enter""] spawn player_traderCity;"; expDesactiv="[""trader city Stary"",true,""leave""] spawn player_traderCity;"; class Effects { }; }; }; How would I add it to expActiv? expActiv="[""trader city Stary"",true,""enter""] spawn player_traderCity; _player_lockUnlock_crtl == false; "; and to turn off expDesactiv="[""trader city Stary"",true,""leave""] spawn player_traderCity; _player_lockUnlock_crtl == true; "; Thanks for all the help! Link to comment Share on other sites More sharing options...
0 calamity Posted December 5, 2014 Report Share Posted December 5, 2014 just set this up to move them or delete them http://epochservers.com/viewtopic.php?f=14&t=17&sid=afebdc0199798e2a106d77e0a29cc48c Link to comment Share on other sites More sharing options...
0 ALKINDA Posted December 5, 2014 Author Report Share Posted December 5, 2014 just set this up to move them or delete them http://epochservers.com/viewtopic.php?f=14&t=17&sid=afebdc0199798e2a106d77e0a29cc48c Don't want to delete them, people would not like that at all. Link to comment Share on other sites More sharing options...
0 calamity Posted December 5, 2014 Report Share Posted December 5, 2014 Don't want to delete them, people would not like that at all. I use this script to move vehicles Link to comment Share on other sites More sharing options...
0 jahangir13 Posted December 5, 2014 Report Share Posted December 5, 2014 I am using a safezone script. So for that in the mission.sqm file there is something like this for a trader: class Sensors { items=6; class Item0 { position[]={6325.6772,304.99033,7807.7412}; a=100; b=100; activationBy="WEST"; repeating=1; interruptable=1; age="UNKNOWN"; name="zonestary"; expCond="(player distance zonestary) < 100;"; expActiv="TitleText[""Now entering trader city Stary"",""PLAIN DOWN""]; canbuild = false;"; expDesactiv="TitleText[""Now leaving trader city Stary"",""PLAIN DOWN""]; canbuild = true;"; class Effects { }; So variable canbuild is set to true or false if you are in or outside a safezone. I guess this variable can be used in your fn_selfAction.sqf part as a prerequisite of the condition for the Lock vehicle menu option to show up. Then it will not showup if canbuild=false (in safezone) or canbuild=true (not in safezone). That's how I would do this. What you used above: _player_lockUnlock_crtl == false ...is a comparison, not an assignment of an value. This would be _player_lockUnlock_crtl = false; I don't know from my mind what _player_lockUnlock_crtl is ment for, so I cannot say anything to that. BUT: if you have an '_' as the first letter for an variable name, the var is local only (so only known by the file/script it is in), and will not be known by any other file per default (so your fn_selfAction.sqf where you want to use the value I guess). Hope that helps a bit. ALKINDA 1 Link to comment Share on other sites More sharing options...
0 calamity Posted December 5, 2014 Report Share Posted December 5, 2014 wait so you dont want players to be able to lock their vehicles in safezones ?? that would kinda cause alot of grief issues when players go to traders safezones. I just use one of the links I provided and set it to unlock safezone vehicles at restarts.. Link to comment Share on other sites More sharing options...
0 StiflersM0M Posted December 5, 2014 Report Share Posted December 5, 2014 Don't want to delete them, people would not like that at all. This script does not delete them, it unlocks them after restart, it only delete vehicles which got more then 10% (0.1) damage, which can be adjusted or completly disabled. Link to comment Share on other sites More sharing options...
0 oSoDirty Posted December 8, 2014 Report Share Posted December 8, 2014 It would be somewhat easy to use fn_selfActions to do this. The issue with this is once the server restarts they wont be able to access the locked vehicle. +1 on the unlock @ restart script. Link to comment Share on other sites More sharing options...
0 StiflersM0M Posted December 8, 2014 Report Share Posted December 8, 2014 It would be somewhat easy to use fn_selfActions to do this. The issue with this is once the server restarts they wont be able to access the locked vehicle. +1 on the unlock @ restart script. In server_monitor.sqf find: if(_ownerID != "0" && !(_object isKindOf "Bicycle")) then { _object setvehiclelock "locked"; }; Replace it with: if(_ownerID != "0" && !(_object isKindOf "Bicycle")) then { { if ((_pos distance (_x select 0)) < (_x select 1)) then { if (_damage > 0.1) then { _damage = 1; [_idKey,false,"SERVER"] call server_deleteObj; diag_log format["DELETING SAFEZONE VEHICLE: %1", [_idKey, _type]]; }; _object setvehiclelock "Unlocked"; } else { _object setvehiclelock "locked"; }; } forEach [[[22575.9,19638.9],1900],[[7644.96,7968.45],16],[[16745.8,10332.3],17],[[10296.7,18413],15],[[1069.24,17796.1],20],[[8268.71,20852.9],30],[[15689.5,15892],35],[[10717.6,11079.1],80],[[17782.2,5599.9],40],[[10355.6,6418.09],50],[[2820.48,7320.54],30],[[4175.73,13945.5],35],[[3502.32,17758.5],45]]; }; This will make them lockable again. My safezone cords are a bit diffrent as you can see, the first 2 strings in the bracket are the cordinates if the safezone, the last digit in bracket are the max. allowed distance. Link to comment Share on other sites More sharing options...
0 oSoDirty Posted December 8, 2014 Report Share Posted December 8, 2014 So basically in fn_selfActions you set it so you cant lock the vehicle in a safe zone and this keeps it unlocked persistently through restarts? Link to comment Share on other sites More sharing options...
0 StiflersM0M Posted December 8, 2014 Report Share Posted December 8, 2014 No So basically in fn_selfActions you set it so you cant lock the vehicle in a safe zone and this keeps it unlocked persistently through restarts? No, the server monitor spawns in the objects, the script check if the object is in a safezone. if yes, he set it to "Unlocked" if not, he set it to default, (locked). So you can simply lock it again if you got the key. Link to comment Share on other sites More sharing options...
0 oSoDirty Posted December 8, 2014 Report Share Posted December 8, 2014 OK, so then YES. Because he doesnt want the vehicles to be lockable in safezones so people dont feel so free to just park them and log out. So with the fn_selfactions //allow owner to unlock bit he can add an "if then else" statement to detect if in a canBuild state which if you are not meaning you are in a safezone, It wont let you use the lock/unlock function. And with the help of your script they will remain unlocked until moved from trader/safezone. Link to comment Share on other sites More sharing options...
0 StiflersM0M Posted December 8, 2014 Report Share Posted December 8, 2014 Oh now i understand what you mean ^^ also pretty pretty simple. in fn_selfaction.sqf search for: if(_hasKey || _oldOwner) then { _lock = player addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\lock_veh.sqf",_cursorTarget, 1, true, true, "", ""]; s_player_lockunlock set [count s_player_lockunlock,_lock]; s_player_lockUnlock_crtl = 1; }; replace it with: if((_hasKey || _oldOwner) && canbuild) then { _lock = player addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\lock_veh.sqf",_cursorTarget, 1, true, true, "", ""]; s_player_lockunlock set [count s_player_lockunlock,_lock]; s_player_lockUnlock_crtl = 1; }; oSoDirty 1 Link to comment Share on other sites More sharing options...
Question
ALKINDA
Hello,
I have been wondering how to do this,
I don't like how people are leaving their cars in my safezone areas and in the airfields.
I was wondering if somehow in the fn_selfactions.sqf we can add an if statement to not allow people to lock if they are in that area.
This is the chunk of code im trying to modify for this if that helps.
Thanks for all the help!
Link to comment
Share on other sites
12 answers to this question
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now