Jump to content
  • 0
Sign in to follow this  
harcosgoogle

Automatic vehicle unlock (2) after day ?

Question

9 answers to this question

Recommended Posts

  • 0

Run this sql query. Change the 14 day to whatever time you want  

CREATE EVENT UnlockAbandonedVehicles
    ON SCHEDULE EVERY 1 DAY
    DO
      UPDATE `object_data` SET `CharacterID` = 0 WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 14 DAY) AND `Datestamp` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 14 DAY) AND `CharacterID` > 0 AND `Classname` NOT IN ('VaultStorage','LockboxStorage','VaultStorageLocked','LockboxStorageLocked','WoodShack_DZ','StorageShed_DZ','TentStorageDomed','TentStorageDomed2','TentStorage')  AND `Inventory` <> '[]' AND `Inventory` IS NOT NULL
;

Share this post


Link to post
Share on other sites
  • 0

YOu need run the sql function to unlockvehicles without keys over your db. Onces you did it the function is saved. Then you can run the lbuw sql code with a .bat file or with scheduler.xm. take a lookl on the link i give you to have an idea

Share this post


Link to post
Share on other sites
  • 0

Ok Do you understand that sql is not a sqf. And this run over your db right?. Then if u have the recomend sql events running then just add the code that lbuk give you to your sql file where the rest of sql events are

Share this post


Link to post
Share on other sites
  • 0

the function:

Spoiler
-- ----------------------------
-- Function structure for FindVehicleKeysCount
-- ----------------------------
DROP FUNCTION IF EXISTS `FindVehicleKeysCount`;
DELIMITER ;;
CREATE FUNCTION `FindVehicleKeysCount`(`keyId` INT) RETURNS int(11)
BEGIN
    DECLARE totalKeys INT DEFAULT 0;
    DECLARE keyName VARCHAR(32) DEFAULT "";
    DECLARE keysInChar INT DEFAULT 0;
    DECLARE keysInObj INT DEFAULT 0;

    SET keyName = (CASE
        WHEN `keyId` < 2501 THEN CONCAT('ItemKeyGreen', `keyId`)
        WHEN `keyId` < 5001 THEN CONCAT('ItemKeyRed', `keyId` - 2500)
        WHEN `keyId` < 7501 THEN CONCAT('ItemKeyBlue', `keyId` - 5000)
        WHEN `keyId` < 10001 THEN CONCAT('ItemKeyYellow', `keyId` - 7500)
        WHEN `keyId` < 12501 THEN CONCAT('ItemKeyBlack', `keyId` - 10000)
        ELSE 'ERROR'
    END);

    SET keysInChar = (SELECT COUNT(*) FROM `Character_DATA` WHERE `Alive` = '1' AND (`Inventory` LIKE CONCAT('%', keyName, '%') OR `Backpack` LIKE CONCAT('%', keyName, '%')));
    SET keysInObj = (SELECT COUNT(*) FROM `Object_DATA` WHERE `Inventory` LIKE CONCAT('%', keyName, '%'));

    RETURN (keysInChar + keysInObj);
END

 

 

The code:

Spoiler
-- ----------------------------
-- Delete server spawned vehicles.
-- ----------------------------
DELETE FROM `object_data`
WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 3 DAY)
AND `CharacterID` = '0'
AND `Classname`
NOT REGEXP 'barrier|storage|shed|bench|wall|floor|fence|pump|wood|hrescue|stick|pole|generator|panel|house|rack|bag|stand|barrel|canvas|wire|hedgehog|net|trap|ramp|fort|sand|scaffold|nest|killhouse|villa|castle|pub|shelter|stodola|garage|MBG|warehouse|sara';

-- ----------------------------
-- Delete all vehicles not touched in 3 days.
-- ----------------------------
DELETE FROM `object_data`
WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 3 DAY)
AND `Classname`
NOT REGEXP 'barrier|storage|shed|bench|wall|floor|fence|pump|wood|hrescue|stick|pole|generator|panel|house|rack|bag|stand|barrel|canvas|wire|hedgehog|net|trap|ramp|fort|sand|scaffold|nest|killhouse|villa|castle|pub|shelter|stodola|garage|MBG|warehouse|sara';

-- ----------------------------
-- Unlock purchased, inactive vehicles.
-- ----------------------------
UPDATE `object_data`
SET `CharacterID` = 0,`LastUpdated` = `LastUpdated`
WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 3 DAY)
AND `CharacterID` > 0
AND `Classname`
NOT REGEXP 'barrier|storage|shed|bench|wall|floor|fence|pump|wood|hrescue|stick|pole|generator|panel|house|rack|bag|stand|barrel|canvas|wire|hedgehog|net|trap|ramp|fort|sand|scaffold|nest|killhouse|villa|castle|pub|shelter|stodola|garage|MBG|warehouse|sara';


-- ----------------------------
-- Unlock vehicle's with no key.
-- ----------------------------
UPDATE `Object_DATA`
SET `Object_DATA`.`CharacterID` = 0,`LastUpdated` = `LastUpdated`
WHERE `Object_DATA`.`CharacterID` <> 0
AND`Object_DATA`.`CharacterID` <= 12500
AND`Object_DATA`.`Classname` NOT LIKE 'Tent%'
AND`Object_DATA`.`Classname` NOT LIKE '%Locked'
AND`Object_DATA`.`Classname` NOT LIKE 'Land%'
AND`Object_DATA`.`Classname` NOT LIKE 'Cinder%'
AND`Object_DATA`.`Classname` NOT LIKE 'Wood%'
AND`Object_DATA`.`Classname` NOT LIKE 'Metal%'
AND`Object_DATA`.`Classname` NOT LIKE '%Storage%'
AND`Object_DATA`.`Classname` NOT IN ('OutHouse_DZ', 'GunRack_DZ', 'WorkBench_DZ', 'Sandbag1_DZ', 'FireBarrel_DZ', 'DesertCamoNet_DZ', 'StickFence_DZ', 'LightPole_DZ', 'DeerStand_DZ', 'ForestLargeCamoNet_DZ', 'Plastic_Pole_EP1_DZ', 'Hedgehog_DZ', 'FuelPump_DZ', 'Fort_RazorWire', 'SandNest_DZ', 'ForestCamoNet_DZ', 'Fence_corrugated_DZ', 'CanvasHut_DZ', 'Generator_DZ')
AND FindVehicleKeysCount(Object_DATA.CharacterID) = 0;

 

 

Share this post


Link to post
Share on other sites
  • 0
On 7/7/2017 at 6:05 AM, juandayz said:

the function:

  Reveal hidden contents

-- ----------------------------
-- Function structure for FindVehicleKeysCount
-- ----------------------------
DROP FUNCTION IF EXISTS `FindVehicleKeysCount`;
DELIMITER ;;
CREATE FUNCTION `FindVehicleKeysCount`(`keyId` INT) RETURNS int(11)
BEGIN
    DECLARE totalKeys INT DEFAULT 0;
    DECLARE keyName VARCHAR(32) DEFAULT "";
    DECLARE keysInChar INT DEFAULT 0;
    DECLARE keysInObj INT DEFAULT 0;

    SET keyName = (CASE
        WHEN `keyId` < 2501 THEN CONCAT('ItemKeyGreen', `keyId`)
        WHEN `keyId` < 5001 THEN CONCAT('ItemKeyRed', `keyId` - 2500)
        WHEN `keyId` < 7501 THEN CONCAT('ItemKeyBlue', `keyId` - 5000)
        WHEN `keyId` < 10001 THEN CONCAT('ItemKeyYellow', `keyId` - 7500)
        WHEN `keyId` < 12501 THEN CONCAT('ItemKeyBlack', `keyId` - 10000)
        ELSE 'ERROR'
    END);

    SET keysInChar = (SELECT COUNT(*) FROM `Character_DATA` WHERE `Alive` = '1' AND (`Inventory` LIKE CONCAT('%', keyName, '%') OR `Backpack` LIKE CONCAT('%', keyName, '%')));
    SET keysInObj = (SELECT COUNT(*) FROM `Object_DATA` WHERE `Inventory` LIKE CONCAT('%', keyName, '%'));

    RETURN (keysInChar + keysInObj);
END

 

 

The code:

  Reveal hidden contents

-- ----------------------------
-- Delete server spawned vehicles.
-- ----------------------------
DELETE FROM `object_data`
WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 3 DAY)
AND `CharacterID` = '0'
AND `Classname`
NOT REGEXP 'barrier|storage|shed|bench|wall|floor|fence|pump|wood|hrescue|stick|pole|generator|panel|house|rack|bag|stand|barrel|canvas|wire|hedgehog|net|trap|ramp|fort|sand|scaffold|nest|killhouse|villa|castle|pub|shelter|stodola|garage|MBG|warehouse|sara';

-- ----------------------------
-- Delete all vehicles not touched in 3 days.
-- ----------------------------
DELETE FROM `object_data`
WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 3 DAY)
AND `Classname`
NOT REGEXP 'barrier|storage|shed|bench|wall|floor|fence|pump|wood|hrescue|stick|pole|generator|panel|house|rack|bag|stand|barrel|canvas|wire|hedgehog|net|trap|ramp|fort|sand|scaffold|nest|killhouse|villa|castle|pub|shelter|stodola|garage|MBG|warehouse|sara';

-- ----------------------------
-- Unlock purchased, inactive vehicles.
-- ----------------------------
UPDATE `object_data`
SET `CharacterID` = 0,`LastUpdated` = `LastUpdated`
WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 3 DAY)
AND `CharacterID` > 0
AND `Classname`
NOT REGEXP 'barrier|storage|shed|bench|wall|floor|fence|pump|wood|hrescue|stick|pole|generator|panel|house|rack|bag|stand|barrel|canvas|wire|hedgehog|net|trap|ramp|fort|sand|scaffold|nest|killhouse|villa|castle|pub|shelter|stodola|garage|MBG|warehouse|sara';


-- ----------------------------
-- Unlock vehicle's with no key.
-- ----------------------------
UPDATE `Object_DATA`
SET `Object_DATA`.`CharacterID` = 0,`LastUpdated` = `LastUpdated`
WHERE `Object_DATA`.`CharacterID` <> 0
AND`Object_DATA`.`CharacterID` <= 12500
AND`Object_DATA`.`Classname` NOT LIKE 'Tent%'
AND`Object_DATA`.`Classname` NOT LIKE '%Locked'
AND`Object_DATA`.`Classname` NOT LIKE 'Land%'
AND`Object_DATA`.`Classname` NOT LIKE 'Cinder%'
AND`Object_DATA`.`Classname` NOT LIKE 'Wood%'
AND`Object_DATA`.`Classname` NOT LIKE 'Metal%'
AND`Object_DATA`.`Classname` NOT LIKE '%Storage%'
AND`Object_DATA`.`Classname` NOT IN ('OutHouse_DZ', 'GunRack_DZ', 'WorkBench_DZ', 'Sandbag1_DZ', 'FireBarrel_DZ', 'DesertCamoNet_DZ', 'StickFence_DZ', 'LightPole_DZ', 'DeerStand_DZ', 'ForestLargeCamoNet_DZ', 'Plastic_Pole_EP1_DZ', 'Hedgehog_DZ', 'FuelPump_DZ', 'Fort_RazorWire', 'SandNest_DZ', 'ForestCamoNet_DZ', 'Fence_corrugated_DZ', 'CanvasHut_DZ', 'Generator_DZ')
AND FindVehicleKeysCount(Object_DATA.CharacterID) = 0;

 

 

Hello Juandayz!

Am I running these both over my database under query or events? 

Thanks.

Share this post


Link to post
Share on other sites
  • 0
6 hours ago, jjsnacks77 said:

Hello Juandayz!

Am I running these both over my database under query or events? 

Thanks.

The function shoulbe running as query one single time. The other code iis event. I running it called with a .bat

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Similar Content

    • By Brian Soanes
      To unlock vehicles left in your traders over a server restart, open your epoch_server.pbo

      In epoch_server\compile\epoch_vehicle\EPOCH_load_vehicles.sqf
      Find
      if (_allowDamage) then { Just above that, add this
      A3E_SafeZonePosArray = [ [[18451.9,14278.1,0]], //Altis East trader [[13333.5,14494.3,0]], //Altis Central trader [[6192.46,16834,0]] //Altis West trader ]; { if (_vehicle distance (_x select 0) < 200) then { _vehicle lock false; diag_log format["Vehicle %1 left in trader unlocked @ %2", _class, mapGridPosition _vehicle]; }; } forEach A3E_SafeZonePosArray; Pack pbo and you're good to go
    • By thegdog
      2:08:04 Error Type Any, expected String 2:08:04 File z\addons\dayz_server\compile\server_playerSync.sqf, line 41 2:08:12 Server: Object 3:54 not found (message 70) 2:08:12 "Server_PublishVehicle2 error: Wrong parameter format" 2:08:12 "Trader Menu: jeffdog (76561198147272349) purchased 1x BAF_Merlin_DZE into gear at Aircraft Trader for 1 ItemObsidian" 2:08:12 Error in expression <ceFoot = 0; trying to buy aircraft from the default aircraft trader.  never touched any of it and it giving this error.  no vehicle spawns.  it shows the arrow.  EDIT:  i tried other traders, all vehicles dont spawn when bought.
    • By webbie
      Hi all, Ive been looking for a while now for a vehicle flip script for a single player.
      Ive tried stuff ive used on previous servers but its not allowing the option so im guessing epoch has something that interferes with it.
      If anyone knows of a simple script to allow players to do this could you link it to me please,
      Thanks in advance.
      PS. Im aware the jacks flip vehicles but I actually  find this to be incredibly painstaking unless theirs a trick to it.
    • By Honey Bee
      Hallo zusammen,
      Die glorreiche Idee den Fahrzeugen das Volumen zu nehmen war jetzt nicht gerade der Bringer. Alle beschweren. Jetzt hab ich mal geschaut aber finde nix wo die Kapazität der Fahrzeuge drin steht. Jemand Erfahrung damit?
       
      Hi,
      how can i change the Vehicle capacity?
       
      THX
    • By NinjaInGreen
      Ok guys, please help me to clear the situation.
      I have dedicated server and i wanted to setup EpochMod on it. I checked github repos, youtube guides, etc, and i'm really confused.
      There is no working epoch 1.0.6.1 version on linux.
      I checked denisio's github (it uses 1.0.5.1version), i checked emestee's github with his automatic scripts. Second one is based on first one. And i dont see any chance to make 1.0.6.1 to work on linux, the greatest system to run game servers.
      Also i checked some topics here, like this one. Very pessimistic ending. So...
      Is it possible to make it run with Wine or PlayOnLinux? Did anyone success in it?
       
       
  • Advertisement
  • Supporters
  • Discord

×
×
  • Create New...