Delete char with house #149

Patch to stop players deleting themselves if they have a house
Fixes #149
This commit is contained in:
Lee 2021-02-02 14:13:36 +00:00
parent 855e9aa3b9
commit 565e6e3a3d

View File

@ -35,6 +35,13 @@ if(isset($_POST['deletecharactersave']) && $_POST['deletecharactersave'] == 1) {
}
}
if($db->hasColumn('houses', 'id')) {
$house = $db->query('SELECT `id` FROM `houses` WHERE `owner` = '.$player->getId());
if($house->rowCount() > 0) {
$errors[] = 'You cannot delete a character when they own a home.';
}
}
if(empty($errors) && $password_verify != $account_logged->getPassword()) {
$errors[] = 'Wrong password to account.';
}