TRBizeps 49 Posted January 28, 2018 Share Posted January 28, 2018 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. 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 More sharing options...
Tasho 244 Posted January 28, 2018 Share Posted January 28, 2018 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; 1 Link to comment Share on other sites More sharing options...
TRBizeps 49 Posted January 29, 2018 Author Share Posted January 29, 2018 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 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now