Jump to content

About server crash on my custom script


Guest OSIRIS
 Share

Recommended Posts

hi all;

i've wroted a script about custom event. and i trying to adding items on player's party. here's the code :

void JustDied(Unit * killer)
   {
       Group * killerGroup = ((Player *)killer)->GetGroup();
       if (killerGroup)
       {
           DoScriptText(SAY_CONGRULATIONS, m_creature, killer);
           for(GroupReference * itr = killerGroup->GetFirstMember(); itr != NULL; itr = itr->next())
           {
               Player * receiver = itr->getSource();
               // possible fix crash i think
               if (!receiver)
                   continue;

               if (receiver)
               {
                   // Item bla_bla_bla
                   int32 count = 1;
                   uint32 itemid = ITEM_BLA_BLA_BLA;

                   //now we can add items
                   uint32 noSpaceForCount = 0;

                   // check space and find places
                   ItemPosCountVec dest;
                   uint8 msg = receiver->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemid, count, &noSpaceForCount);

                   if(count == 0 || dest.empty())
                       continue;

                   Item * item = receiver->StoreNewItem(dest, itemid, true, Item::GenerateItemRandomPropertyId(itemid));
                   if (count > 0 && item)
                       receiver->SendNewItem(item, count, false, true);
                   else
                       continue;
               }
           }
       }
   }

server crashed after first player's have taked the item. also there isn't any crashlog about this situation. the server don't give me any crashlog.

anybody have an idea? thanks ..

Link to comment
Share on other sites

 Share

×
×
  • Create New...

Important Information

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. Privacy Policy Terms of Use