Bom, otro code do fundo do baú !
Esse code funciona da seguinte maneira, ao invês de o GM ficar fazendo toda hora, "Utani gran hur" para andar rápido, decidir arrumar direitinho e tirar os bugs deste code, Basta você usar /gmspeed e o número que ficará com a mesma speed até você logar.
A speed vai de 99 até 9999
Em commands.cpp
Em baixo de
{"/info",&Commands::getInfo},
Adicione:
{"/gmspeed",&Commands::GMspeedChanger},
No final de commands.cpp adicione:
bool Commands::GMspeedChanger(Creature* creature, const std::string &cmd, const std::string ¶m){ int a; Player* player = creature->getPlayer(); std::string gambiarra = param.c_str(); std::stringstream baseSpeedValue; std::string aimeudeus; for(a=0; a<param.length(); ++a){ if(!isdigit(param[a])){ aimeudeus = param; aimeudeus.erase(a,1-param.length()); gambiarra.erase(0,1+a); break; } else aimeudeus = param.c_str(); } int newspeed = atoi(aimeudeus.c_str()); if(newspeed > 9999 || newspeed <= 99){ player->sendTextMessage(MSG_STATUS_CONSOLE_BLUE,"Sorry but the speed must be more than 99 and less than 9999."); return false; } if(Player* toChange = game->getPlayerByName(gambiarra)){ toChange->baseSpeed = newspeed; toChange->sendChangeSpeed(creature, creature->getSpeed()); baseSpeedValue << "GM "<<player->getName()<< " changed your speed to: "<<toChange->baseSpeed<<"."<<std::endl; toChange->sendTextMessage(MSG_STATUS_CONSOLE_BLUE,baseSpeedValue.str().c_str()); player->sendTextMessage(MSG_STATUS_CONSOLE_BLUE,"Done."); return true; } else{ player->baseSpeed = newspeed; player->sendChangeSpeed(creature, creature->getSpeed()); baseSpeedValue << "You changed your speed to: "<<player->baseSpeed<<"."<<std::endl; player->sendTextMessage(MSG_STATUS_CONSOLE_BLUE,baseSpeedValue.str().c_str()); return true; } return false; }
Em commands.h depois de:
bool getInfo(Creature* creature, const std::string& cmd, const std::string& param);
Adicione:
bool GMspeedChanger(Creature* creature, const std::string &cmd, const std::string ¶m);
Depois disso dê Ctrl+f11 para dar rebuild. (recomendo usar isso a qualquer code adicionado.)
Pronto, agora basta você ir na pasta commands.xml do seu OTserv.
E adicionar lá
<command cmd="/gmspeed" access="3" />
thankz
Obs: Feita na versão nova SVN e testada na versão evolutions 0.7.8 também.
Comentem