Need help resetting specific vehicles on server restart

BlitZer31

New Member
The topic title may say it all, but I will give a rundown.
I need a way to reset a number of vehicles to their original spawn position at server restart, whilst leaving the other vehicles unaltered. I had an idea, that I may be able to create a secondary object_data table in the server database containing all of the vehicles that I wanted to be reset and just replace it after each restart, however I assume using two object_data tables isn't possible? Well, you cant have two tables with the same name.

Any ideas?
 
already have sorted this out here months ago...
there was a guy who wanted to do exactly the same...
i have told him to take a look at the origins sqf files...
like they respawn the urals in sector b...

EDIT: here is the LINK
 
Code:
DELETE
            FROM `object_data`
            WHERE `ObjectUID` = '0000500000393';
    DELETE
            FROM `object_data`
            WHERE `ObjectUID` = '0000500000394';
    DELETE
            FROM `object_data`
            WHERE `ObjectUID` = '0000500000395';
 
    DELETE
            FROM `object_data`
            WHERE `ObjectUID` = '0000500001393';
    DELETE
            FROM `object_data`
            WHERE `ObjectUID` = '0000500001394';
    DELETE
            FROM `object_data`
            WHERE `ObjectUID` = '0000500001395';
    DELETE
            FROM `object_data`
            WHERE `ObjectUID` = '0000500001396';
    DELETE
            FROM `object_data`
            WHERE `ObjectUID` = '0000500001397';
 
    INSERT INTO `object_data`
            VALUES (NULL, '0000500001393', '1', 'UralCivil2', '0.05000', '0', '[180,[22462.2,19495.5,0]]', '[[[],[]],[["ItemAntibiotic","ItemBandage","ItemBloodbag","ItemEpinephrine","ItemMorphine","ItemPainkiller","FoodCanBakedBeans","FoodCanFrankBeans","FoodCanPasta","FoodCanSardines","ItemSodaCoke","ItemSodaPepsi","ItemHeatPack"],[15,15,15,15,15,15,15,15,15,15,15,15,15]],[["O_TravelerPack_1","O_MegaPack_1"],[1,1]]]', '[["motor",0.8],["karoserie",1],["palivo",0.8],["wheel_1_1_steering",1],["wheel_2_1_steering",1],["wheel_1_2_steering",1],["wheel_2_2_steering",1]]', '0.01000', NOW());
    INSERT INTO `object_data`
            VALUES (NULL, '0000500001394', '1', 'UralCivil2', '0.05000', '0', '[269,[22180.7,19833.1,0]]', '[[["ItemPickaxe"],[2]],[["ItemBpt_b1","ItemBpt_b2","ItemBpt_h1","ItemBpt_h2","ItemBpt_g_s","ItemBpt_g_b","ItemBattery","ItemPin","ItemRocks","ItemCementBag","PartScrap","PartWoodPile","ItemCeMix"],[3,3,3,3,3,1,7,7,15,5,10,15,3]],[["O_TravelerPack_1","O_MegaPack_1"],[1,1]]]', '[["motor",0.8],["karoserie",1],["palivo",0.8],["wheel_1_1_steering",1],["wheel_2_1_steering",1],["wheel_1_2_steering",1],["wheel_2_2_steering",1]]', '0.01000', NOW());
    INSERT INTO `object_data`
            VALUES (NULL, '0000500001395', '1', 'UralCivil2', '0.05000', '0', '[90,[22452.8,20074.8,0]]', '[[["AKS_74_kobra","M16A2GL","AKS_74_U","FN_FAL","M9SD","PK_DZ","Pecheneg_DZ","bizon_silenced","M4A3_RCO_GL_EP1","NVGoggles","ItemGPS","G36K"],[3,3,3,3,3,3,3,3,3,2,2,1]],[["ItemBloodbag","100Rnd_762x54_PK","30Rnd_556x45_Stanag","100Rnd_762x51_M240","30Rnd_556x45_G36SD","10Rnd_9x39_SP5_VSS","ItemAntibiotic","30Rnd_545x39_AK","20Rnd_762x51_FNFAL","15Rnd_9x19_M9SD","64Rnd_9x19_SD_Bizon","1Rnd_HE_GP25","PartGeneric","PartEngine","PartGlass","PartVRotor","ItemJerrycan","ItemTent"],[10,10,10,10,10,10,10,10,10,10,10,10,4,2,6,2,10,2]],[["O_TravelerPack_1","O_MegaPack_1"],[1,1]]]', '[["motor",0.8],["karoserie",1],["palivo",0.8],["wheel_1_1_steering",1],["wheel_2_1_steering",1],["wheel_1_2_steering",1],["wheel_2_2_steering",1]]', '0.01000', NOW());
    INSERT INTO `object_data`
            VALUES (NULL, '0000500001396', '1', 'UralCivil2', '0.05000', '0', '[178,[22533,20073,0]]', '[[["AKS_74_kobra","M16A2GL","AKS_74_U","FN_FAL","M9SD","PK_DZ","Pecheneg_DZ","bizon_silenced","M4A3_RCO_GL_EP1","NVGoggles","ItemGPS","G36K"],[3,3,3,3,3,3,3,3,3,2,2,1]],[["ItemBloodbag","100Rnd_762x54_PK","30Rnd_556x45_Stanag","100Rnd_762x51_M240","30Rnd_556x45_G36SD","10Rnd_9x39_SP5_VSS","ItemAntibiotic","30Rnd_545x39_AK","20Rnd_762x51_FNFAL","15Rnd_9x19_M9SD","64Rnd_9x19_SD_Bizon","1Rnd_HE_GP25","PartGeneric","PartEngine","PartGlass","PartVRotor","ItemJerrycan","ItemTent"],[10,10,10,10,10,10,10,10,10,10,10,10,4,2,6,2,10,2]],[["O_TravelerPack_1","O_MegaPack_1"],[1,1]]]', '[["motor",0.8],["karoserie",1],["palivo",0.8],["wheel_1_1_steering",1],["wheel_2_1_steering",1],["wheel_1_2_steering",1],["wheel_2_2_steering",1]]', '0.01000', NOW());
    INSERT INTO `object_data`
            VALUES (NULL, '0000500001397', '1', 'UralCivil2', '0.05000', '0', '[178,[22549.2,20071.9,0]]', '[[["AKS_74_kobra","M16A2GL","AKS_74_U","FN_FAL","M9SD","PK_DZ","Pecheneg_DZ","bizon_silenced","M4A3_RCO_GL_EP1","NVGoggles","ItemGPS","G36K"],[3,3,3,3,3,3,3,3,3,2,2,1]],[["ItemBloodbag","100Rnd_762x54_PK","30Rnd_556x45_Stanag","100Rnd_762x51_M240","30Rnd_556x45_G36SD","10Rnd_9x39_SP5_VSS","ItemAntibiotic","30Rnd_545x39_AK","20Rnd_762x51_FNFAL","15Rnd_9x19_M9SD","64Rnd_9x19_SD_Bizon","1Rnd_HE_GP25","PartGeneric","PartEngine","PartGlass","PartVRotor","ItemJerrycan","ItemTent"],[10,10,10,10,10,10,10,10,10,10,10,10,4,2,6,2,10,2]],[["O_TravelerPack_1","O_MegaPack_1"],[1,1]]]', '[["motor",0.8],["karoserie",1],["palivo",0.8],["wheel_1_1_steering",1],["wheel_2_1_steering",1],["wheel_1_2_steering",1],["wheel_2_2_steering",1]]', '0.01000', NOW());

Ok so that's great, however since I'm a bit of a noob when it comes to scripting, problems have risen. So I see that I need to replace the ObjectUID's with that of the objects that I want to be removed and put back, and pretty much "INSERT" them again. But how exactly do I execute this script before starting the server? Is it a batch file or something?
Or do I make it say.. bleh.sqf and chuck [] ExecVM "bleh.sqf"; at the beginning of init.sqf?
 
well depending on you're host, i would use a Mysql event or if you are currently using a dedicated host you could read up on how to execute a sql file using your .bat file for launching you're server.

For the event use something like this:

Code:
DROP EVENT IF EXISTS updateStockDaily;
CREATE EVENT ResetVehicles
    ON SCHEDULE EVERY 4 HOUR
    COMMENT 'Resets Vehicles'
    DO
DELETE FROM `object_data` WHERE `ObjectUID` = '0000500001393';
INSERT INTO `object_data` VALUES (NULL, '0000500001393', '1', 'UralCivil2', '0.05000', '0', '[180,[22462.2,19495.5,0]]', '[[[],[]],[["ItemAntibiotic","ItemBandage","ItemBloodbag","ItemEpinephrine","ItemMorphine","ItemPainkiller","FoodCanBakedBeans","FoodCanFrankBeans","FoodCanPasta","FoodCanSardines","ItemSodaCoke","ItemSodaPepsi","ItemHeatPack"],[15,15,15,15,15,15,15,15,15,15,15,15,15]],[["O_TravelerPack_1","O_MegaPack_1"],[1,1]]]', '[["motor",0.8],["karoserie",1],["palivo",0.8],["wheel_1_1_steering",1],["wheel_2_1_steering",1],["wheel_1_2_steering",1],["wheel_2_2_steering",1]]', '0.01000', NOW());

That would reset that specific ural on a origins server with a 4 hour restart, just change the ural into whatever vehicle you wish to reset,the position, the loot and the object uid.
 
Back
Top