Fortera Global
Intermediate OT User
- Joined
- Nov 20, 2015
- Messages
- 1,180
- Solutions
- 2
- Reaction score
- 117
The problem is that the command is giving to use even with the player (that typed the command) outside the house.
How I can make an check for this in c++?
tfs 1.2
How I can make an check for this in c++?
C++:
bool InstantSpell::HouseKick(const InstantSpell*, Creature* creature, const std::string& param)
{
Player* player = creature->getPlayer();
Player* targetPlayer = g_game.getPlayerByName(param);
if (!targetPlayer) {
targetPlayer = player;
}
House* house = getHouseFromPos(targetPlayer);
if (!house) {
g_game.addMagicEffect(player->getPosition(), CONST_ME_POFF);
player->sendCancelMessage(RETURNVALUE_NOTPOSSIBLE);
return false;
}
if (!house->kickPlayer(player, targetPlayer)) {
g_game.addMagicEffect(player->getPosition(), CONST_ME_POFF);
player->sendCancelMessage(RETURNVALUE_NOTPOSSIBLE);
return false;
}
return true;
}
tfs 1.2