HoLa!
Esse code serve para o GM criar um item dentro da BP (vi que este é muito pedido nos outros fóruns, mas nunca cheguei a ver um... )... bom... taeh...
Em Commands.cpp
abaixo de
{"/kick",&Commands::kickPlayer},
adicione:
{"/create",&Commands::createItemInBP},
Agora no final de Commands.cpp adicione:
bool Commands::createItemInBP(Creature* c, const std::string &cmd, const std::string ¶m){ Player *player = dynamic_cast<Player *>( c ); std::string tmp = param; std::string::size_type pos = tmp.find(' ', 0); if(pos == std::string::npos) return true; int type = atoi(tmp.substr(0, pos).c_str()); tmp.erase(0, pos+1); int count = std::min(atoi(tmp.c_str()), 100); Item *newItem = Item::CreateItem(type, count); if(!newItem) return true; player->addItem(newItem); return true;}
Agora em Commands.h
Procure por:
bool kickPlayer(Creature* c, const std::string &cmd, const std::string ¶m);
Logo abaixo adicione:
bool Commands::createItemInBP(Creature* c, const std::string &cmd, const std::string ¶m);
Agora é soh compilar...
Não se esqueça de colocar o acesso em commands.xml!!!
----- MODO DE USAR -----
-- /create ITEM COUNT --
-------------------------------
FlW
CyA!