I couldn't find where anyone had addressed this before, so I figured I would share what I am doing.
To stop people from creating tents, filling with gear, killing their selves, and then always having a place to gear up (because the tents duplicate gear every server restart), I created the following:
deployable_fix.php
Then add a call to this script from your restart bat file:
FYI: This also allows players to repack their old tents even after death.
To stop people from creating tents, filling with gear, killing their selves, and then always having a place to gear up (because the tents duplicate gear every server restart), I created the following:
deployable_fix.php
Code:
<?php
/*
argv values
1 = ip
2 = port
3 = username
4 = password
5 = database name
*/
// open a mysql connection
$con=mysqli_connect($argv[1] . ":" . $argv[2], $argv[3], $argv[4], $argv[5]);
//something went wrong
if (mysqli_connect_errno($con)) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// get the owner ids from the deployable table
$q1 = mysqli_query($con,"Select id,owner_id from instance_deployable order by id asc");
//looping through all the deployables
while ($r1 = mysqli_fetch_array($q1)) {
// get the unique_id (so we can change deployable's owner if needed), and whether owner is dead
$q2 = mysqli_query($con,"Select unique_id,is_dead from survivor where id=" . $r1[1]);
$r2 = mysqli_fetch_array($q2);
// The owner is dead
if ($r2[1] == 1) {
// use the unique_id to pull all the owner's instances from survivor table
$q3 = mysqli_query($con,"Select id,is_dead from survivor where unique_id=" . $r2[0] . " order by is_dead asc");
//loop through all the owner instances and find one that is alive, the first one should be alive but we will just be sure
while ($r3 = mysqli_fetch_array($q3)) {
// find one that is alive
if ($r3[1] == 0) {
// update the deployable item with the new owner id
mysqli_query($con,"update instance_deployable set owner_id=" . $r3[0] . " where id=" . $r1[0]);
echo "Corrected deployable: Deployable ID: " . $r1[0] . " New owner ID: " . $r3[0] . " \n";
break;
}
}
}
}
mysqli_close($con);
?>
Then add a call to this script from your restart bat file:
Code:
set dbhost= IP
set dbport= port
set dbuser= username
set dbpass= password
set dbname= database
.path\to\php.exe path\to\deployable_fix.php %dbhost% %dbport% %dbuser% %dbpass% %dbname%
FYI: This also allows players to repack their old tents even after death.