• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

How to add House in the character information?

Make a query by wich u join houses table and players table by their ids if there are no rows he owns no house, if there is 1 row retrieve the data and display it in a way u like :)

Still make the query yourself.
 
he's no scripter <...>
 
Make a query by wich u join houses table and players table by their ids if there are no rows he owns no house, if there is 1 row retrieve the data and display it in a way u like :)

Still make the query yourself.

I requsted for it...
 
PHP:
$houses = $SQL->query('SELECT houses.name AS name FROM houses WHERE houses.owner IN (SELECT players.id FROM players WHERE players.account_id = ' . $player->getAccount() . ');');

foreach($houses as $k=>$house)
{
    $main_content .= "
    <TR BGCOLOR=\"".$config['site'][($k % 2 == 1 ? 'light' : 'dark').'border']."\">
        <TD>
            House:
        </TD>
        <TD>
            ".$house['name']."
        </TD>
    </TR>";
}
 
Thanks, Almost good :) But look I have 2 characters on 1 account (name: Yulps and Bezik) and on page (characters.php) i see that Yulps owns house "Harbour Place 1 (Shop)" and Bezik owns this house too.
It's not true:
Code:
You see an open door.
It belongs to house 'Harbour Place 1 (Shop)'. Yulps owns this house.

Can someone fix it? query to sql should download info from player, not from whole account.
Also could someone add query to get town ID(town name) where house is located?
Like here:
Tibia - Free Multiplayer Online Role Playing Game - Community
Code:
House:	Central Circle 4 [B](Edron)[/B]

Thanks in advance :)
 
PHP:
$houses = $SQL->query('SELECT houses.name AS name, houses.town AS town FROM houses WHERE houses.owner = ' . $player->getId() . ' LIMIT 1;');

foreach($houses as $k=>$house)
{
    $main_content .= "
    <TR BGCOLOR=\"".$config['site'][($k % 2 == 1 ? 'light' : 'dark').'border']."\">
        <TD>
            House:
        </TD>
        <TD>
            " . $house['name'] . " (" . $towns_list[0][$house['town']] . ")
        </TD>
    </TR>";
}
 
Back
Top