Tymofek
New Member
i ripped this from the source, and i think that may work, not as i wish, but the best i can xD
i want to insert this (that i ripped) just before the ghost part
the idea is that if in DB in table players column invisible the value is 0 when use the command
player get invisible,
and change the value to 1
else if the value is 1 then
go back to normal
and change the value to 0
i inserted the "conditions" in this code, but am sure they are no supposed to be like that
the lines that for sure are not gonna work and need to be helped are:
inv = (SELECT `invisible` FROM `players` WHERE `id` = "..getPlayerName(cid)..");
if (inv = 1 )
(UPDATE `players` SET `invisible` = 0 WHERE `id` = "..getPlayerId(cid).." )
else if (inv = 0 )
{
(UPDATE `players` SET `invisible` = 1 WHERE `id` = "..getPlayerId(cid).." )
i hope you can finish what i think i have started xD
telme how do i insert the condition like this
[CPP]
bool TalkAction:
layerghost(Creature* creature, const std::string&, const std::string&)
{
Player* player = creature->getPlayer();
if(!player)
return false;
inv = (SELECT `invisible` FROM `players` WHERE `id` = "..getPlayerName(cid)..");
if (inv = 1 )
{
(UPDATE `players` SET `invisible` = 0 WHERE `id` = "..getPlayerId(cid).." )
IOLoginData::getInstance()->updateOnlineStatus(player->getGUID(), true);
for(AutoList<Player>::iterator pit = Player::autoList.begin(); pit != Player::autoList.end(); ++pit)
{
if(!pit->second->canSeeCreature(player))
pit->second->notifyLogIn(player);
}
for(it = list.begin(); it != list.end(); ++it)
{
if((tmpPlayer = (*it)->getPlayer()) && !tmpPlayer->canSeeCreature(player))
tmpPlayer->sendMagicEffect(player->getPosition(), MAGIC_EFFECT_TELEPORT);
}
player->removeCondition(condition);
g_game.internalCreatureChangeVisible(creature, VISIBLE_GHOST_APPEAR);
}
SpectatorVec::iterator it;
SpectatorVec list = g_game.getSpectators(player->getPosition());
Player* tmpPlayer = NULL;
Condition* condition = NULL;
else if (inv = 0 )
{
(UPDATE `players` SET `invisible` = 1 WHERE `id` = "..getPlayerId(cid).." )
player->addCondition(condition);
g_game.internalCreatureChangeVisible(creature, VISIBLE_GHOST_DISAPPEAR);
for(it = list.begin(); it != list.end(); ++it)
{
if((tmpPlayer = (*it)->getPlayer()) && !tmpPlayer->canSeeCreature(player))
tmpPlayer->sendMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
}
for(AutoList<Player>::iterator pit = Player::autoList.begin(); pit != Player::autoList.end(); ++pit)
{
if(!pit->second->canSeeCreature(player))
pit->second->notifyLogOut(player);
}
IOLoginData::getInstance()->updateOnlineStatus(player->getGUID(), false);
if(player->isTrading())
g_game.internalCloseTrade(player);
player->clearPartyInvitations();
if(player->getParty())
player->getParty()->leave(player);
}
return true;
}
[/CPP]
i want to insert this (that i ripped) just before the ghost part
the idea is that if in DB in table players column invisible the value is 0 when use the command
player get invisible,
and change the value to 1
else if the value is 1 then
go back to normal
and change the value to 0
i inserted the "conditions" in this code, but am sure they are no supposed to be like that
the lines that for sure are not gonna work and need to be helped are:
inv = (SELECT `invisible` FROM `players` WHERE `id` = "..getPlayerName(cid)..");
if (inv = 1 )
(UPDATE `players` SET `invisible` = 0 WHERE `id` = "..getPlayerId(cid).." )
else if (inv = 0 )
{
(UPDATE `players` SET `invisible` = 1 WHERE `id` = "..getPlayerId(cid).." )
i hope you can finish what i think i have started xD
telme how do i insert the condition like this
[CPP]
bool TalkAction:
{
Player* player = creature->getPlayer();
if(!player)
return false;
inv = (SELECT `invisible` FROM `players` WHERE `id` = "..getPlayerName(cid)..");
if (inv = 1 )
{
(UPDATE `players` SET `invisible` = 0 WHERE `id` = "..getPlayerId(cid).." )
IOLoginData::getInstance()->updateOnlineStatus(player->getGUID(), true);
for(AutoList<Player>::iterator pit = Player::autoList.begin(); pit != Player::autoList.end(); ++pit)
{
if(!pit->second->canSeeCreature(player))
pit->second->notifyLogIn(player);
}
for(it = list.begin(); it != list.end(); ++it)
{
if((tmpPlayer = (*it)->getPlayer()) && !tmpPlayer->canSeeCreature(player))
tmpPlayer->sendMagicEffect(player->getPosition(), MAGIC_EFFECT_TELEPORT);
}
player->removeCondition(condition);
g_game.internalCreatureChangeVisible(creature, VISIBLE_GHOST_APPEAR);
}
SpectatorVec::iterator it;
SpectatorVec list = g_game.getSpectators(player->getPosition());
Player* tmpPlayer = NULL;
Condition* condition = NULL;
else if (inv = 0 )
{
(UPDATE `players` SET `invisible` = 1 WHERE `id` = "..getPlayerId(cid).." )
player->addCondition(condition);
g_game.internalCreatureChangeVisible(creature, VISIBLE_GHOST_DISAPPEAR);
for(it = list.begin(); it != list.end(); ++it)
{
if((tmpPlayer = (*it)->getPlayer()) && !tmpPlayer->canSeeCreature(player))
tmpPlayer->sendMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
}
for(AutoList<Player>::iterator pit = Player::autoList.begin(); pit != Player::autoList.end(); ++pit)
{
if(!pit->second->canSeeCreature(player))
pit->second->notifyLogOut(player);
}
IOLoginData::getInstance()->updateOnlineStatus(player->getGUID(), false);
if(player->isTrading())
g_game.internalCloseTrade(player);
player->clearPartyInvitations();
if(player->getParty())
player->getParty()->leave(player);
}
return true;
}
[/CPP]