I am trying to develop a system in c ++ as a study mode but I am having some problems.
I created the code below but when it is executed the item is not "moved" to the player and the server is crashed after I leaving from the body.
So I printed step to see where is the error and why, but the print returns with valid informations.
So, someone can tell me why it dont works?
Print information:
The problem is here;
When I remove this line, everything work perfectly. (Prints and internalRemoveItem).
So idk why dont work.
If know some away to do it more easily, tell me how and if possible with exemples.
Thanks for u support
I created the code below but when it is executed the item is not "moved" to the player and the server is crashed after I leaving from the body.
C++:
if (player->canOpenCorpse(corpseOwner)) {
//std::cout << "You can make loot system here. Items: "; //Print for list loot on monster.
for (Item* item : container->getItemList()) { //Int the items for show in table the loot.
std::cout << item->getName() << '\n';
if (item->getName() == "cheese") { //If item has the same name of cheese then...
//So lets added the item for player!
std::cout << "Name: " << item->getName() << ", Id: " << item->getID() << ", Quanty: " << item->getItemCount() << '\n';
g_game.internalPlayerAddItem(player, item, true, CONST_SLOT_WHEREEVER);
g_game.internalRemoveItem(item);
}
}
}
So I printed step to see where is the error and why, but the print returns with valid informations.
So, someone can tell me why it dont works?
Print information:
Code:
Name: cheese, Id: 2696, Quanty: 1
The problem is here;
C++:
g_game.internalPlayerAddItem(player, item, true, CONST_SLOT_WHEREEVER);
When I remove this line, everything work perfectly. (Prints and internalRemoveItem).
So idk why dont work.
If know some away to do it more easily, tell me how and if possible with exemples.
Thanks for u support
Last edited: