Jump to content

Question about unsummon horse :)


Recommended Posts

ACMD(do_user_horse_back)
{
	CItem* pCostumeMount = ch->GetWear(WEAR_COSTUME_MOUNT);
	if (pCostumeMount->IsEquipped())
	{
	if (ch->GetHorse() != NULL)
		ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("HAS_UNEQUIPPED_MOUNT_ITEM"));
		ch->UnequipItem(pCostumeMount);
		ch->HorseSummon(false);
		return;
	}

	if (!pCostumeMount->IsEquipped() && ch->GetHorse() != NULL)
	{
		ch->HorseSummon(false);
		ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¸»À» µ¹·Áº¸³Â½À´Ï´Ù."));
	}

	else if (ch->IsHorseRiding() == true)
	{
		ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¸»¿¡¼­ ¸ÕÀú ³»·Á¾ß ÇÕ´Ï´Ù.")); //Du musst absteigen.
	}
	else
	{
		ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¸»À» ¸ÕÀú ¼ÒȯÇØÁÖ¼¼¿ä.")); // Bitte ruf zuerst Dein Pferd.
	}
}

 

Hello Community,

 

To explain you my situation i'll describe my problem shortly.

I've implemented the horse appearance via database table & i need to unequip the "Costume Mount" Item if i use strg + B <-

the problem is, i do not know anything about c++ my method is working == Player wears costume_mount uses strg +b and the Mount (Which is defined as a horse) unsummons.

 

 

But if i summon my horse (not the mounts, which are defined as horse i mean the horse you get by horselevel) && use this command core crashes.

 

In this spoiler i've posted my function without my changes. :D

 

ACMD(do_user_horse_back)
{
	if (ch->GetHorse() != NULL)
	{
		ch->HorseSummon(false);
		ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¸»À» µ¹·Áº¸³Â½À´Ï´Ù."));
	}
	else if (ch->IsHorseRiding() == true)
	{
		ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¸»¿¡¼­ ¸ÕÀú ³»·Á¾ß ÇÕ´Ï´Ù."));
	}
	else
	{
		ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¸»À» ¸ÕÀú ¼ÒȯÇØÁÖ¼¼¿ä."));
	}
}
Link to comment
Share on other sites

vor 9 Stunden schrieb Tasho:

I don't really understand what exactly you do there, but you should check if pointer isn't NULL.


CItem* pCostumeMount = ch->GetWear(WEAR_COSTUME_MOUNT);
if (!pCostumeMount)
	return;

 

Let me explain you my Situation a bit more detailed.

I've defined the Mounts as Horse, and just because i dont want the new costume_mount slot being useless i kept the mount in there Slots. Since they're Horses, if you run the Command "do_user_horse_back" it doesn't unequip the weared mount (which is defined as horse) because you Dont usually wear the Horsebooks.

 

May you Please Show me the Solution? I' m Not able to implement the null Pointer Check also i dont think my Code is fine :D

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now


×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.