• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

[C++] Invisible

slaw

Software Developer
Joined
Aug 27, 2007
Messages
3,888
Solutions
134
Reaction score
1,370
Location
Germany
GitHub
slawkens
Someone know how to make Invisible on 8.0 in TFS? Becouse there is only one for 8.1, but i really fast need for 8.0 ;(


I tried make it from Devland
Devland invisible:
Code:
bool Commands::setInvisible(Creature* c, const std::string &cmd, const std::string &param)
{
	Player* gm = c->getPlayer();
	Outfit_t outfit;
	if(!gm)
		return false;

     if (gm->gmInvisible) {

        outfit.lookType = 75;

		g_game.playerChangeOutfit(gm, outfit);
        gm->gmInvisible = false;
        gm->sendTextMessage(MSG_EVENT_ADVANCE,"You are Visible again.");
        c->getTile()->onUpdateTile();
     }
     else
     {

   		Outfit_t outfit;
		outfit.lookTypeEx = 4390;

		g_game.playerChangeOutfit(gm, outfit);
        gm->gmInvisible = true;
        gm->sendTextMessage(MSG_EVENT_ADVANCE,"You are Invisible.");
        c->getTile()->onUpdateTile();
     }
     return true;
     }
TFS /ghost:
Code:
bool Commands::ghost(Creature* creature, const std::string& cmd, const std::string& param)
{
	Player* player = creature->getPlayer();
	if(player)
	{
		player->ghostMode = !player->ghostMode;
		char buffer[60];
		sprintf(buffer, "You have switched ghost mode mode to: %s.", (player->ghostMode ? "enabled" : "disabled"));
        if(player->ghostMode) 
        {
           const int32_t invisibleOutfit = 280; 
           g_game.internalCreatureChangeOutfit(creature, (const Outfit_t&)invisibleOutfit); 
        } 
		player->sendTextMessage(MSG_INFO_DESCR, buffer);
		return true;
	}
	return false;
}
And this is my finnally code, TFS + Devland:
Code:
bool Commands::ghost(Creature* creature, const std::string& cmd, const std::string& param)
{
	Player* player = creature->getPlayer();
	if(player)
	{
		player->ghostMode = !player->ghostMode;
		char buffer[60];
		sprintf(buffer, "You have switched ghost mode mode to: %s.", (player->ghostMode ? "enabled" : "disabled"));
        if(player->ghostMode) 
        {
           const int32_t invisibleOutfit = 4390; 
           g_game.internalCreatureChangeOutfit(creature, (const Outfit_t&)invisibleOutfit);
          creature->getTile()->onUpdateTile();
        } 
		player->sendTextMessage(MSG_INFO_DESCR, buffer);
		return true;
	}
	return false;

And it wasn't possible to compile, so i needed to change:
Code:
	void onUpdateTile();
I removed it from Private.

But when i'm using /ghost command clien get debug ;<

Please help, i'm newbie in C++, but i'm learning fast ;D
 
Tried, new code was taked from Devland. I don't know why debug, i tried now make it again, copied from devland to Protocol80 somethings etc. But again TFS crash, or client get debug.

HELP. I'm searching working code for Invisible to 8.0 working on TFS ;(
 
Yes, but it wasn't good ;)

Should be like this:
Code:
outfit.lookTypeEx = 4390;

And there is finished code working on 8.0:
Code:
bool Commands::setInvisible(Creature* creature, const std::string &cmd, const std::string &param)
{
	Player* gm = creature->getPlayer();
	Outfit_t outfit;
	if(!gm)
		return false;

     if (gm->gmInvisible) {

        outfit.lookType = 75;

		g_game.internalCreatureChangeOutfit(gm, outfit);
        gm->gmInvisible = false;
        gm->sendTextMessage(MSG_EVENT_ADVANCE,"You are Visible again.");
        creature->getTile()->onUpdateTile();
     }
     else
     {

   		Outfit_t outfit;
		outfit.lookTypeEx = 4390;

		g_game.internalCreatureChangeOutfit(gm, outfit);
        gm->gmInvisible = true;
        gm->sendTextMessage(MSG_EVENT_ADVANCE,"You are Invisible.");
        creature->getTile()->onUpdateTile();
     }
     return true;
}

@KaczooH
Tommorow 100% ;> + lua function cleanMap()
 
Last edited:
Yes, but it wasn't good ;)

Should be like this:
Code:
outfit.lookTypeEx = 4390;

And there is finished code working on 8.0:
Code:
bool Commands::setInvisible(Creature* creature, const std::string &cmd, const std::string &param)
{
    Player* gm = creature->getPlayer();
    Outfit_t outfit;
    if(!gm)
        return false;

     if (gm->gmInvisible) {

        outfit.lookType = 75;

        g_game.internalCreatureChangeOutfit(gm, outfit);
        gm->gmInvisible = false;
        gm->sendTextMessage(MSG_EVENT_ADVANCE,"You are Visible again.");
        creature->getTile()->onUpdateTile();
     }
     else
     {

           Outfit_t outfit;
        outfit.lookTypeEx = 4390;

        g_game.internalCreatureChangeOutfit(gm, outfit);
        gm->gmInvisible = true;
        gm->sendTextMessage(MSG_EVENT_ADVANCE,"You are Invisible.");
        creature->getTile()->onUpdateTile();
     }
     return true;
}

@KaczooH
Tommorow 100% ;> + lua function cleanMap()

what i need to edit to make it works in 7.72 im having bugs with gm invisible when im invisible and i walk trough a player the player get client crash
 
Back
Top