diff --git a/system/libs/CreateCharacter.php b/system/libs/CreateCharacter.php
index f2e7687e..5aa87ad4 100644
--- a/system/libs/CreateCharacter.php
+++ b/system/libs/CreateCharacter.php
@@ -103,7 +103,7 @@ class CreateCharacter
if(empty($errors))
{
- $number_of_players_on_account = $account->getPlayersList()->count();
+ $number_of_players_on_account = $account->getPlayersList(false)->count();
if($number_of_players_on_account >= config('characters_per_account'))
$errors[] = 'You have too many characters on your account ('.$number_of_players_on_account.'/'.config('characters_per_account').')!';
}
diff --git a/system/libs/pot/OTS_Account.php b/system/libs/pot/OTS_Account.php
index 77225258..bee164ca 100644
--- a/system/libs/pot/OTS_Account.php
+++ b/system/libs/pot/OTS_Account.php
@@ -726,7 +726,7 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
* @return OTS_Players_List List of players from current account.
* @throws E_OTS_NotLoaded If account is not loaded.
*/
- public function getPlayersList()
+ public function getPlayersList($withDeleted = true)
{
if( !isset($this->data['id']) )
{
@@ -737,6 +737,15 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
$filter = new OTS_SQLFilter();
$filter->compareField('account_id', (int) $this->data['id']);
+ if(!$withDeleted) {
+ global $db;
+ if($db->hasColumn('players', 'deletion')) {
+ $filter->compareField('deletion', 0);
+ } else {
+ $filter->compareField('deleted', 0);
+ }
+ }
+
// creates list object
$list = new OTS_Players_List();
$list->setFilter($filter);
diff --git a/system/templates/account.create_character.html.twig b/system/templates/account.create_character.html.twig
index f8796a94..8d823b2f 100644
--- a/system/templates/account.create_character.html.twig
+++ b/system/templates/account.create_character.html.twig
@@ -2,7 +2,7 @@ Please choose a name{% if config.character_samples|length > 1 %}, vocation{% end
{% if config.character_towns|length > 1 %}, town{% endif %}
and sex for your character.
In any case the name must not violate the naming conventions stated in the {{ config.lua.serverName }} Rules, or your character might get deleted or name locked.
-{% if account_logged.getPlayersList()|length >= config.characters_per_account %}
+{% if account_logged.getPlayersList(false)|length >= config.characters_per_account %}
You have maximum number of characters per account on your account. Delete one before you make new.
{% endif %}