Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/php
- <?php
- $db=mysqli_connect("hive.hfbservers.com","user-4030","yhp6RIXM","user-4030");
- // Check connection
- if (mysqli_connect_errno($db))
- {
- echo "Failed to connect to MySQL: " . mysqli_connect_error();
- }
- //delete destroyed vehicles
- echo "Deleting damaged vehicles \n\n";
- $del_dmg = mysqli_query($db,"DELETE FROM instance_vehicle WHERE damage > .7");
- //delete unused vehicles
- $del_old_veh = mysqli_query($db,"DELETE FROM instance_vehicle WHERE DATE(`last_updated`) < CURDATE() - INTERVAL 3 DAY");
- //$del_old_heli = mysqli_query($db,"DELETE FROM instance_vehicle WHERE DATE(`last_updated`) < CURDATE() - INTERVAL 1 DAY and vehicle_id IN (15,53,54,92) ");
- //delete bikes (13,14) taxis (5278,5279) planes (55,61,91,94,338), large heli (15,318,,319,321,328,343,17116,
- //echo "Deleting RESPAWN vehicles bicycles, taxis, planes,\n\n";
- //$reset = mysqli_query($db,"SELECT * FROM v_vehicle WHERE vehicle_id IN (3,13,14,15,21,38,40,50,53,54,55,59,61,62,65,66,67,68,91,94,107,108,129,131,318,319,321,328,343,17116,338,5278,5279)");
- //while ($row = mysqli_fetch_array($reset))
- //{
- // $del_veh = mysqli_query($db,"DELETE FROM instance_vehicle WHERE id = " . $row["instance_vehicle_id"]);
- // echo "--deleted vehicle id ". $row['instance_vehicle_id'] . "\n";
- //}
- //select world vehicle rows which do not exist in instance vehicle. These are the vehicles to respawn.
- $result = mysqli_query($db,"SELECT * from world_vehicle wv WHERE NOT EXISTS (SELECT 1 FROM instance_vehicle iv where wv.id = iv.world_vehicle_id) ORDER BY wv.id ASC LIMIT 500");
- $row_cnt = mysqli_num_rows($result);
- echo "Respawning " . $row_cnt . " vehicles\n\n";
- while ($row = mysqli_fetch_array($result)){
- echo $row['id']. "\n";
- $random_inv = rand ( 1 , 10 );
- echo "--Respawning vehicle ID ". $row['vehicle_id'] ." with Inventory #" . $random_inv . "\n";
- switch ($random_inv) {
- case 1:
- $inserted = mysqli_query($db,"INSERT into instance_vehicle (id, world_vehicle_id, instance_id, worldspace, inventory, parts, fuel, damage, last_updated, created) VALUES (NULL, " . $row['id'] . ", 1, '" . $row['worldspace'] . "', '[[[\"ItemGPS\",\"NVG\",\"Binocular_Vector\"],[1,1,1]],[[], []], [[], []]]', '[]', .5, 0, CURRENT_TIMESTAMP, '0000-00-00 00:00:00')");
- break;
- case 2:
- $inserted = mysqli_query($db,"INSERT into instance_vehicle (id, world_vehicle_id, instance_id, worldspace, inventory, parts, fuel, damage, last_updated, created) VALUES (NULL, " . $row['id'] . ", 1, '" . $row['worldspace'] . "', '[[[],[]],[[\"ItemBloodbag\",\"ItemBandage\",\"ItemMorphine\",\"ItemPainkiller\"], [1,1,1,1]], [[], []]]', '[]', .3, 0, CURRENT_TIMESTAMP, '0000-00-00 00:00:00')");
- break;
- case 3:
- $inserted = mysqli_query($db,"INSERT into instance_vehicle (id, world_vehicle_id, instance_id, worldspace, inventory, parts, fuel, damage, last_updated, created) VALUES (NULL, " . $row['id'] . ", 1, '" . $row['worldspace'] . "', '[[[\"ItemKnife\",\"ItemMatchbox\"],[1,1]],[[\"ItemJerrycanEmpty\"], [1]], [[\"DZ_CivilBackpack_EP1\"], [1]]]', '[]', .7, 0, CURRENT_TIMESTAMP, '0000-00-00 00:00:00')");
- break;
- case 4:
- $inserted = mysqli_query($db,"INSERT into instance_vehicle (id, world_vehicle_id, instance_id, worldspace, inventory, parts, fuel, damage, last_updated, created) VALUES (NULL, " . $row['id'] . ", 1, '" . $row['worldspace'] . "', '[[[\"ItemEtool\",\"ItemMatchbox\"],[1,1]],[[], []], [[], []]]', '[]', .4, 0, CURRENT_TIMESTAMP, '0000-00-00 00:00:00')");
- break;
- case 5:
- $inserted = mysqli_query($db,"INSERT into instance_vehicle (id, world_vehicle_id, instance_id, worldspace, inventory, parts, fuel, damage, last_updated, created) VALUES (NULL, " . $row['id'] . ", 1, '" . $row['worldspace'] . "', '[[[\"ItemKnife\",\"ItemMatchbox\",\"ItemFuelcan\"],[1,1,1]],[[\"ItemTent\"], [1]], [[], []]]', '[]', .2, 0, CURRENT_TIMESTAMP, '0000-00-00 00:00:00')");
- break;
- case 6:
- $inserted = mysqli_query($db,"INSERT into instance_vehicle (id, world_vehicle_id, instance_id, worldspace, inventory, parts, fuel, damage, last_updated, created) VALUES (NULL, " . $row['id'] . ", 1, '" . $row['worldspace'] . "', '[[[\"ItemToolbox\"],[1]],[[], []], [[], []]]', '[]', .4, 0, CURRENT_TIMESTAMP, '0000-00-00 00:00:00')");
- break;
- case 7:
- $inserted = mysqli_query($db,"INSERT into instance_vehicle (id, world_vehicle_id, instance_id, worldspace, inventory, parts, fuel, damage, last_updated, created) VALUES (NULL, " . $row['id'] . ", 1, '" . $row['worldspace'] . "', '[[[\"ItemHatchet\"],[1]],[[], []], [[\"DZ_CivilBackpack_EP1\"], [1]]]', '[]', .8, 0, CURRENT_TIMESTAMP, '0000-00-00 00:00:00')");
- break;
- case 8:
- $inserted = mysqli_query($db,"INSERT into instance_vehicle (id, world_vehicle_id, instance_id, worldspace, inventory, parts, fuel, damage, last_updated, created) VALUES (NULL, " . $row['id'] . ", 1, '" . $row['worldspace'] . "', '[[[\"MeleeMachete\"],[1]],[[\"ItemSodaRabbit\"], [6]], [[\"DZ_CivilBackpack_EP1\"], [1]]]', '[]', .4, 0, CURRENT_TIMESTAMP, '0000-00-00 00:00:00')");
- break;
- case 9:
- $inserted = mysqli_query($db,"INSERT into instance_vehicle (id, world_vehicle_id, instance_id, worldspace, inventory, parts, fuel, damage, last_updated, created) VALUES (NULL, " . $row['id'] . ", 1, '" . $row['worldspace'] . "', '[[[],[]],[[\"Pipebomb\",\"Handgrenade_West\"], [1,2]], [[], []]]', '[]', .3, 0, CURRENT_TIMESTAMP, '0000-00-00 00:00:00')");
- break;
- case 10:
- $inserted = mysqli_query($db,"INSERT into instance_vehicle (id, world_vehicle_id, instance_id, worldspace, inventory, parts, fuel, damage, last_updated, created) VALUES (NULL, " . $row['id'] . ", 1, '" . $row['worldspace'] . "', '[[[\"ItemFlashlightRed\"],[1]],[[\"PartVrotor\"], [1]], [[\"DZ_Assault_Pack_EP1\"], [1]]]', '[]', .5, 0, CURRENT_TIMESTAMP, '0000-00-00 00:00:00')");
- break;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement