• 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!

[C++] removal one condition

GarQet

Own3d!
Joined
Feb 10, 2009
Messages
1,381
Solutions
14
Reaction score
81
Hello OTlanders, I have small request.
I'm looking for a person who removes a requirement of this code.
The condition for removal: If a player has no access (tutor, st, gm, cm, god), then this code will also work for him.
At the moment it works for people with rank higher than a normal player.

Code:
	SpectatorVec::iterator it;
	SpectatorVec list = g_game.getSpectators(player->getPosition());
	Player* tmpPlayer = NULL;

	Condition* condition = NULL;
	if((condition = player->getCondition(CONDITION_GAMEMASTER, CONDITIONID_DEFAULT, GAMEMASTER_INVISIBLE)))
	{

		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(player, VISIBLE_GHOST_APPEAR);
		lua_pushboolean(L, true);
	}
	else if((condition = Condition::createCondition(CONDITIONID_DEFAULT, CONDITION_GAMEMASTER, -1, 0, false, GAMEMASTER_INVISIBLE)))
	{
		player->addCondition(condition);
		g_game.internalCreatureChangeVisible(player, 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);

		lua_pushboolean(L, true);
	}

Thank you in advance and ask for a fast, effective help.
Yours GarQet.
 
This element is responsible for your damage, so it's not this piece of code.

I think we need to find somewhere around here, change the following, but I have no idea how.
Code:
SpectatorVec list = g_game.getSpectators([B]player->getPosition()[/B]);

#Topic
Bump!
 
It's true, but I need to do this in actions not talkactions, so I'm looking for this piece, who is responsible, I need to remove it.
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
      doCreatureExecuteTalkAction(cid, words, acces)
      return true
end
 
I tested it: doCreatureExecuteTalkAction(cid, '/ghost', true) and it isn't working properly.
I see only the text and the character does not disappear:
15:45 You are now invisible.
15:45 You are visible again.
Any ideas?
 
it works here, invisible to both (normal) players and monsters :p

if you want blue shimmer effect, ghostModeInvisibleEffect = true
 
If you don't believe me check it yourself. I'm standing two players next to each other, after using the item one of the players shouldn't see another. Unfortunately it isn't.
All the time I stand by that, without changes in the sources didn't attain the effect of the command /ghost.
Any ideas?
 
Cykotitan, this thing changed in the config is not responsible for player's invisibility :/
I need uch a thing, which will hide the player - will make him invisible.

btw. When GM is using that object he disappears and nobody sees it. And uses it as a player is another player sees the player.
What is wrong?
 
use your brain a little, why do GMs see each other when invisible? because they have same access/ghostAccess!

you need to edit this part of player.cpp to make players with access 0 not visible to eachother when invisible :p:p
[cpp]bool Player::canSeeCreature(const Creature* creature) const
{
if(creature == this)
return true;

if(const Player* player = creature->getPlayer())
return !player->isGhost() || getGhostAccess() >= player->getGhostAccess();

return !creature->isInvisible() || canSeeInvisibility();
}[/cpp]
 
How am I supposed to change this piece of work as mentioned earlier?
The original piece of sources:
Code:
bool Player::canSeeCreature(const Creature* creature) const
{
	if(creature == this)
		return true;

	if(const Player* player = creature->getPlayer())
		return !player->isGhost() || getGhostAccess() >= player->getGhostAccess();

	return !creature->isInvisible() || canSeeInvisibility();
}
Deleting, add on, modify, but to no avail. I cannot do that :P
 
Back
Top