From 565e6e3a3da70de072a691007c02db14f3cb2bb9 Mon Sep 17 00:00:00 2001 From: Lee <42119604+Leesneaks@users.noreply.github.com> Date: Tue, 2 Feb 2021 14:13:36 +0000 Subject: [PATCH] Delete char with house #149 Patch to stop players deleting themselves if they have a house Fixes #149 --- system/pages/account/delete_character.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/system/pages/account/delete_character.php b/system/pages/account/delete_character.php index 25fef4c5..00a3300b 100644 --- a/system/pages/account/delete_character.php +++ b/system/pages/account/delete_character.php @@ -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.'; }