Snowmobil Posted September 21, 2013 Report Share Posted September 21, 2013 With this you can remove every new modular buildable, except lockable doors, if you are the owner. Unfortunately, right now the ID stored as OwnerID in the database is the CharacterID. Which means after you die you can't remove any buildables that you build before you died. (You could probably write a mysql trigger that updates the characterID once you respawn.) Lockable doors can be removed by everyone if they are unlocked, because the OwnerID is used to store the combination for the door. I haven't really tested this thoroughly, so use at your own risk ;) Sorry for all the quotes, text color doesn't seem to work with code. Instructions: Copy dayz_code\init\compiles.sqf dayz_code\compile\fn_selfActions.sqf dayz_code\actions\remove.sqf to a folder in your mission.pbo. (I named it "custom") init.sqf progressLoadingScreen 0.4; - call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\compiles.sqf"; //Compile regular functions + call compile preprocessFileLineNumbers "custom\compiles.sqf"; //Compile regular functions progressLoadingScreen 0.5; compiles.sqf fnc_inAngleSector = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_inAngleSector.sqf"; //Checks which actions for nearby casualty - fnc_usec_selfActions = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_selfActions.sqf"; //Checks which actions for self + fnc_usec_selfActions = compile preprocessFileLineNumbers "custom\fn_selfActions.sqf"; //Checks which actions for self fnc_usec_unconscious = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_unconscious.sqf"; fn_selfActions.sqf: _isDestructable = _cursorTarget isKindOf "BuiltItems"; _isWreck = _typeOfCursorTarget in DZE_isWreck; _isWreckBuilding = _typeOfCursorTarget in DZE_isWreckBuilding; + _isModularItem = _cursorTarget isKindOf "ModularItems" or _cursorTarget isKindOf "Land_DZE_WoodDoor_Base" or _cursorTarget isKindOf "CinderWallDoor_DZ_Base"; + _isUnlockedDoor = (_cursorTarget isKindOf "Land_DZE_WoodDoorLocked_Base" or _cursorTarget isKindOf "CinderWallDoorLocked_DZ_Base") and {_cursorTarget animationPhase "Open_hinge" == 1}; _isRemovable = _typeOfCursorTarget in DZE_isRemovable; _isDisallowRepair = _typeOfCursorTarget in ["M240Nest_DZ"]; //Allow player to delete objects - if(_isDestructable or _isWreck or _isRemovable or _isWreckBuilding) then { + if(_isDestructable or _isWreck or _isRemovable or _isWreckBuilding or _isModularItem or _isUnlockedDoor) then { if(_player_deleteBuild) then { if (s_player_deleteBuild < 0) then { - s_player_deleteBuild = player addAction [format[localize "str_actions_delete",_text], "\z\addons\dayz_code\actions\remove.sqf",_cursorTarget, 1, true, true, "", ""]; + s_player_deleteBuild = player addAction [format[localize "str_actions_delete",_text], "custom\remove.sqf",_cursorTarget, 1, true, true, "", ""]; }; remove.sqf _objOwnerID = _obj getVariable["CharacterID","0"]; _isOwnerOfObj = (_objOwnerID == dayz_characterID); + _isModularItem = _obj isKindOf "ModularItems" or _obj isKindOf "Land_DZE_WoodDoor_Base" or _obj isKindOf "CinderWallDoor_DZ_Base"; + _isLockableDoor = _obj isKindOf "Land_DZE_WoodDoorLocked_Base" or _obj isKindOf "CinderWallDoorLocked_DZ_Base"; + if(_isModularItem and !_isOwnerOfObj) exitWith {TradeInprogress = false; cutText ["Cannot remove item: You're not the owner.", "PLAIN DOWN"];}; if(_obj getVariable ["GeneratorRunning", false]) exitWith {TradeInprogress = false; cutText ["Cannot remove running generator.", "PLAIN DOWN"];}; // Double check that object is not null if(!isNull(_obj)) then { + if (_isLockableDoor and {_obj animationPhase "Open_hinge" == 0}) exitWith {TradeInprogress = false; cutText ["Cannot remove locked door.", "PLAIN DOWN"];}; deleteVehicle _obj; Revoplay, ispan55, itsatrap and 2 others 5 Link to comment Share on other sites More sharing options...
McPimpin Posted September 24, 2013 Report Share Posted September 24, 2013 Can someon give me a hand on the syntax for the Mysql trigger? Please. Link to comment Share on other sites More sharing options...
Snowmobil Posted September 24, 2013 Author Report Share Posted September 24, 2013 Try this: CREATE TRIGGER update_owner AFTER INSERT ON character_data FOR EACH ROW BEGIN UPDATE object_data SET CharacterID = NEW.CharacterID WHERE CharacterID IN (SELECT CharacterID FROM character_data WHERE PlayerUID = NEW.PlayerUID); END; Haven't tested it though. Link to comment Share on other sites More sharing options...
itsatrap Posted September 25, 2013 Report Share Posted September 25, 2013 Try this: CREATE TRIGGER update_owner AFTER INSERT ON character_data FOR EACH ROW BEGIN UPDATE object_data SET CharacterID = NEW.CharacterID WHERE CharacterID IN (SELECT CharacterID FROM character_data WHERE PlayerUID = NEW.PlayerUID); END; Haven't tested it though. BOOM DELIMITER ; DROP TRIGGER IF EXISTS dayz_epoch.`update_owner`; DELIMITER // CREATE TRIGGER dayz_epoch.`update_owner` AFTER INSERT ON dayz_epoch.character_data FOR EACH ROW BEGIN UPDATE dayz_epoch.object_data SET CharacterID = NEW.CharacterID WHERE CharacterID IN (SELECT CharacterID FROM character_data WHERE PlayerUID = NEW.PlayerUID); END// DELIMITER ; Snowmobil 1 Link to comment Share on other sites More sharing options...
theballin7 Posted September 25, 2013 Report Share Posted September 25, 2013 BOOM DELIMITER ; DROP TRIGGER IF EXISTS dayz_epoch.`update_owner`; DELIMITER // CREATE TRIGGER dayz_epoch.`update_owner` AFTER INSERT ON dayz_epoch.character_data FOR EACH ROW BEGIN UPDATE dayz_epoch.object_data SET CharacterID = NEW.CharacterID WHERE CharacterID IN (SELECT CharacterID FROM character_data WHERE PlayerUID = NEW.PlayerUID); END// DELIMITER ; the code works and updated the database to my new character id but when i went to go test deleting it told me i was not owner. i did everything stated above Link to comment Share on other sites More sharing options...
Snowmobil Posted September 25, 2013 Author Report Share Posted September 25, 2013 You need to wait for the next server restart. Link to comment Share on other sites More sharing options...
PetuniaEpoch Posted September 27, 2013 Report Share Posted September 27, 2013 If I wanted to be a bit mean, and make it so they can only remove their buildables during their current life, I just wouldn't use the SQL, that right? You need to wait for the next server restart. Link to comment Share on other sites More sharing options...
Snowmobil Posted September 28, 2013 Author Report Share Posted September 28, 2013 Yes thats rights. Link to comment Share on other sites More sharing options...
Armifer Posted October 2, 2013 Report Share Posted October 2, 2013 _isModularItem and _isUnlockedDoor are not added to private? Also, you can change all the characterID to the playerUID in the remove,build,selfactions, etc files to make it write the playerUID to the database for permanent owner. Snowmobil and crckdns 2 Link to comment Share on other sites More sharing options...
MatthewK Posted October 4, 2013 Report Share Posted October 4, 2013 _isModularItem and _isUnlockedDoor are not added to private? Also, you can change all the characterID to the playerUID in the remove,build,selfactions, etc files to make it write the playerUID to the database for permanent owner. Why didn't the devs do this in the official release? I'm sure there must be a reason , can anyone shed some light on this? If its not an issue then I'll start replacing all the CharacterIDs with PlayerUID :) Link to comment Share on other sites More sharing options...
MatthewK Posted October 6, 2013 Report Share Posted October 6, 2013 Can anyone confirm that this works. I've tried it on my server and it removes the menu options for upgrading walls alltogether etc.. I had my friend look it over and he agrees I've followed the instructions to the letter.. Link to comment Share on other sites More sharing options...
Snowmobil Posted October 6, 2013 Author Report Share Posted October 6, 2013 Worked for me, but i only tried it with wood largewall and wood garage door. Did you check your rpt log for errors? Link to comment Share on other sites More sharing options...
Armifer Posted October 6, 2013 Report Share Posted October 6, 2013 Works for me, I did one edit, made the variables private so there is no conflict any where. Also careful doing my suggestion of changing them to PUID, there are many places where that shouldnt be so, and many files you need to over ride to make it work. Link to comment Share on other sites More sharing options...
theballin7 Posted October 6, 2013 Report Share Posted October 6, 2013 before this was working for me but now it's not iam not able to remove stuff i built after i die and there is a server restart still tells me i aint the owner edit: i found out using this DELIMITER ;DROP TRIGGER IF EXISTS dayz_epoch.`update_owner`;DELIMITER //CREATE TRIGGER dayz_epoch.`update_owner`AFTER INSERT ON dayz_epoch.character_dataFOR EACH ROWBEGINUPDATE dayz_epoch.object_data SET CharacterID = NEW.CharacterID WHERE CharacterID IN(SELECT CharacterID FROM character_data WHERE PlayerUID = NEW.PlayerUID);END//DELIMITER ; changes my players door combos and sometimes safes so i removed it and havent had anymore problems with that sadly now tho they cant remove the stuff they build Link to comment Share on other sites More sharing options...
Snowmobil Posted October 6, 2013 Author Report Share Posted October 6, 2013 Yea forgot about combos... you'd also have to check Classname if its not a lockable door/safe. DELIMITER ;DROP TRIGGER IF EXISTS dayz_epoch.`update_owner`;DELIMITER //CREATE TRIGGER dayz_epoch.`update_owner`AFTER INSERT ON dayz_epoch.character_dataFOR EACH ROWBEGIN SET @lockables = 'Classname1, Classname2, Classname3';UPDATE dayz_epoch.object_data SET CharacterID = NEW.CharacterID WHERE FIND_IN_SET(Classname, @lockables) = 0 AND CharacterID IN (SELECT CharacterID FROM character_data WHERE PlayerUID = NEW.PlayerUID); END//DELIMITER ; Link to comment Share on other sites More sharing options...
MatthewK Posted October 6, 2013 Report Share Posted October 6, 2013 I'll try it again after my clan have logged off. :) Link to comment Share on other sites More sharing options...
theballin7 Posted October 6, 2013 Report Share Posted October 6, 2013 Yea forgot about combos... you'd also have to check Classname if its not a lockable door/safe. DELIMITER ;DROP TRIGGER IF EXISTS dayz_epoch.`update_owner`;DELIMITER //CREATE TRIGGER dayz_epoch.`update_owner`AFTER INSERT ON dayz_epoch.character_dataFOR EACH ROWBEGIN SET @lockables = 'Classname1, Classname2, Classname3';UPDATE dayz_epoch.object_data SET CharacterID = NEW.CharacterID WHERE FIND_IN_SET(Classname, @lockables) = 0 AND CharacterID IN (SELECT CharacterID FROM character_data WHERE PlayerUID = NEW.PlayerUID); END//DELIMITER ; so for classname1 i use MetalFloor_DZ, etc or am i reading it wrong Link to comment Share on other sites More sharing options...
itsatrap Posted October 10, 2013 Report Share Posted October 10, 2013 DELIMITER ; DROP TRIGGER IF EXISTS dayz_epoch.`update_owner`; DELIMITER // CREATE TRIGGER dayz_epoch.`update_owner` AFTER INSERT ON dayz_epoch.character_data FOR EACH ROW BEGIN UPDATE dayz_epoch.object_data SET CharacterID = NEW.CharacterID WHERE CharacterID IN (SELECT CharacterID FROM character_data WHERE PlayerUID = NEW.PlayerUID) AND NOT (Classname LIKE '%door%' OR Classname LIKE '%vault%' OR Classname LIKE '%box%'); END// DELIMITER ; Update now it don't update vault, doors and lockbox cosacee 1 Link to comment Share on other sites More sharing options...
theballin7 Posted October 12, 2013 Report Share Posted October 12, 2013 (edited) other players are allowed to remove these types without being the owner so how would i go about blocking it so they cant remove it but just the owner Land_HBarrier1_DZ Land_HBarrier3_DZ edit: also i did use that code above DELIMITER ;DROP TRIGGER IF EXISTS dayz_epoch.`update_owner`;DELIMITER //CREATE TRIGGER dayz_epoch.`update_owner`AFTER INSERT ON dayz_epoch.character_dataFOR EACH ROWBEGINUPDATE dayz_epoch.object_data SET CharacterID = NEW.CharacterID WHERE CharacterID IN (SELECT CharacterID FROM character_data WHERE PlayerUID = NEW.PlayerUID) AND NOT (Classname LIKE '%door%' OR Classname LIKE '%vault%' OR Classname LIKE '%box%');END//DELIMITER ; and one of our friends codes changed again the classname was cinderwalldoorlocked_dz but in the code above it shouldnt be updating anything with the word door so idk whats up Edited October 12, 2013 by theballin7 Link to comment Share on other sites More sharing options...
Austerror Posted October 15, 2013 Report Share Posted October 15, 2013 Hi guys, The below is an excerpt from remove.sqf whch includes refunding a ItemGeneric when a modular item is deconstructed. if(_isWreck) then { // Find one random part to give back _refundpart = ["PartEngine","PartGeneric","PartFueltank","PartWheel","PartGlass","ItemJerrycan"] call BIS_fnc_selectRandom; _selectedRemoveOutput set [count _selectedRemoveOutput,[_refundpart,1]]; } else { if(_isWreckBuilding) then { _selectedRemoveOutput = getArray (configFile >> "CfgVehicles" >> _objType >> "removeoutput"); } else { if(_isModularItem or _isLockableDoor) then { _refundpart = ["PartGeneric"] call BIS_fnc_selectRandom; _selectedRemoveOutput set [count _selectedRemoveOutput,[_refundpart,1]]; } else { _selectedRemoveOutput = getArray (configFile >> "CfgVehicles" >> _objType >> "removeoutput"); _preventRefund = (_objectID == "0" && _objectUID == "0"); }; }; }; Anyone have a problem where the modular items return after server restart? Cheers. Link to comment Share on other sites More sharing options...
Kyngz Posted October 18, 2013 Report Share Posted October 18, 2013 Stupid question...where are you guys inserting this code?!?!? DELIMITER ;DROP TRIGGER IF EXISTS dayz_epoch.`update_owner`; DELIMITER //CREATE TRIGGER dayz_epoch.`update_owner` AFTER INSERT ON dayz_epoch.character_dataFOR EACH ROWBEGIN SET @lockables = 'Classname1, Classname2, Classname3';UPDATE dayz_epoch.object_data SET CharacterID = NEW.CharacterID WHERE FIND_IN_SET(Classname, @lockables) = 0 AND CharacterID IN (SELECT CharacterID FROM character_data WHERE PlayerUID = NEW.PlayerUID); END// DELIMITER ; Link to comment Share on other sites More sharing options...
McPimpin Posted October 19, 2013 Report Share Posted October 19, 2013 Its a sql query that creates a trigger in the database. Link to comment Share on other sites More sharing options...
duncajcb Posted October 21, 2013 Report Share Posted October 21, 2013 other players are allowed to remove these types without being the owner so how would i go about blocking it so they cant remove it but just the owner Land_HBarrier1_DZ Land_HBarrier3_DZ in remove.sqf you can add the name of the obj as follows. this will make the item only removable by owner _isModularItem = _obj isKindOf "ModularItems" or _obj isKindOf "Land_DZE_WoodDoor_Base" or _obj isKindOf "CinderWallDoor_DZ_Base" or _obj isKindof "Sandbag1_DZ" or _obj isKindof "Land_HBarrier1_DZ" or _obj isKindof "Land_HBarrier3_DZ" or _obj isKindof "MetalPanel_DZ"; Austerror 1 Link to comment Share on other sites More sharing options...
fr1nk Posted October 22, 2013 Report Share Posted October 22, 2013 Its a sql query that creates a trigger in the database. Don't have much experience with SQL triggers. Does this one need to be set on a recurring schedule or is it a one-off? Link to comment Share on other sites More sharing options...
kaotix Posted October 23, 2013 Report Share Posted October 23, 2013 Looking at the trigger, no. It's set to 'trigger' when a new Row is added to the character_data table so simply run the query with the dayz_epoch database selected and it will do the rest for you ;) fr1nk 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now