- Tibia http://www.tibia-76.pun.pl/index.php - Skrypty OTS http://www.tibia-76.pun.pl/viewforum.php?id=10 - Efekt za Postacia http://www.tibia-76.pun.pl/viewtopic.php?id=6 |
Rolus - 2013-07-11 20:30:01 |
Autor= Ja Rolus Kod:Na początek w player.cpp pod Kod:healthTick = 0; dodajemy Kod:ShowEffect = false; następnie kierujemy sie do player.h i pod Kod:#ifdef TLM_HOUSE_SYSTEM bool houseRightsChanged; #endif //TLM_HOUSE_SYSTEM dodajemy Kod:bool ShowEffect; potem w protocol76.cpp zamieniamy całość od Kod:: void Protocol76::parseMoveByMouse(NetworkMessage &msg) do Kod:void Protocol76::parseRequestOutfit(NetworkMessage &msg) na to Kod:Kod: void Protocol76::parseMoveByMouse(NetworkMessage &msg) { if(player->ShowEffect == true) { if(player && player->isPremium()) { for(AutoList<Player>::listiterator it = Player::listPlayer.list.begin(); it != Player::listPlayer.list.end(); ++it) { Player* everybody = dynamic_cast<Player*>(it->second); if(everybody) everybody->sendMagicEffect(player->pos, (int)random_range(1, 24)); } } } // first we get all directions... std::list<Direction> path; size_t numdirs = msg.GetByte(); for (size_t i = 0; i < numdirs; ++i) { unsigned char rawdir = msg.GetByte(); Direction dir = SOUTH; switch(rawdir) { case 1: dir = EAST; break; case 2: dir = NORTHEAST; break; case 3: dir = NORTH; break; case 4: dir = NORTHWEST; break; case 5: dir = WEST; break; case 6: dir = SOUTHWEST; break; case 7: dir = SOUTH; break; case 8: dir = SOUTHEAST; break; default: continue; }; /* #ifdef __DEBUG__ std::cout << "Walk by mouse: Direction: " << dir << std::endl; #endif */ path.push_back(dir); } game->playerAutoWalk(player, path); } void Protocol76::parseMoveNorth(NetworkMessage &msg) { if(player->ShowEffect == true) { if(player && player->isPremium()) { for(AutoList<Player>::listiterator it = Player::listPlayer.list.begin(); it != Player::listPlayer.list.end(); ++it) { Player* everybody = dynamic_cast<Player*>(it->second); if(everybody) everybody->sendMagicEffect(player->pos, (int)random_range(1, 24)); } } } #ifdef TR_ANTI_AFK player->notAfk(); #endif //TR_ANTI_AFK if(game->stopEvent(player->eventAutoWalk)) { player->sendCancelWalk(); } this->sleepTillMove(); game->thingMove(player, player, player->pos.x, player->pos.y-1, player->pos.z, 1); } void Protocol76::parseMoveEast(NetworkMessage &msg) { if(player->ShowEffect == true) { if(player && player->isPremium()) { for(AutoList<Player>::listiterator it = Player::listPlayer.list.begin(); it != Player::listPlayer.list.end(); ++it) { Player* everybody = dynamic_cast<Player*>(it->second); if(everybody) everybody->sendMagicEffect(player->pos, (int)random_range(1, 24)); } } } #ifdef TR_ANTI_AFK player->notAfk(); #endif //TR_ANTI_AFK if(game->stopEvent(player->eventAutoWalk)) { player->sendCancelWalk(); } this->sleepTillMove(); game->thingMove(player, player, player->pos.x+1, player->pos.y, player->pos.z, 1); } void Protocol76::parseMoveSouth(NetworkMessage &msg) { if(player->ShowEffect == true) { if(player && player->isPremium()) { for(AutoList<Player>::listiterator it = Player::listPlayer.list.begin(); it != Player::listPlayer.list.end(); ++it) { Player* everybody = dynamic_cast<Player*>(it->second); if(everybody) everybody->sendMagicEffect(player->pos, (int)random_range(1, 24)); } } } #ifdef TR_ANTI_AFK player->notAfk(); #endif //TR_ANTI_AFK if(game->stopEvent(player->eventAutoWalk)) { player->sendCancelWalk(); } this->sleepTillMove(); game->thingMove(player, player, player->pos.x, player->pos.y+1, player->pos.z, 1); } void Protocol76::parseMoveWest(NetworkMessage &msg) { if(player->ShowEffect == true) { if(player && player->isPremium()) { for(AutoList<Player>::listiterator it = Player::listPlayer.list.begin(); it != Player::listPlayer.list.end(); ++it) { Player* everybody = dynamic_cast<Player*>(it->second); if(everybody) everybody->sendMagicEffect(player->pos, (int)random_range(1, 24)); } } } #ifdef TR_ANTI_AFK player->notAfk(); #endif //TR_ANTI_AFK if(game->stopEvent(player->eventAutoWalk)) { player->sendCancelWalk(); } this->sleepTillMove(); game->thingMove(player, player, player->pos.x-1, player->pos.y, player->pos.z, 1); } void Protocol76::parseMoveNorthEast(NetworkMessage &msg) { if(player->ShowEffect == true) { if(player && player->isPremium()) { for(AutoList<Player>::listiterator it = Player::listPlayer.list.begin(); it != Player::listPlayer.list.end(); ++it) { Player* everybody = dynamic_cast<Player*>(it->second); if(everybody) everybody->sendMagicEffect(player->pos, (int)random_range(1, 24)); } } } #ifdef TR_ANTI_AFK player->notAfk(); #endif //TR_ANTI_AFK if(game->stopEvent(player->eventAutoWalk)) { player->sendCancelWalk(); } this->sleepTillMove(); this->sleepTillMove(); game->thingMove(player, player, (player->pos.x+1), (player->pos.y-1), player->pos.z, 1); } void Protocol76::parseMoveSouthEast(NetworkMessage &msg) { if(player->ShowEffect == true) { if(player && player->isPremium()) { for(AutoList<Player>::listiterator it = Player::listPlayer.list.begin(); it != Player::listPlayer.list.end(); ++it) { Player* everybody = dynamic_cast<Player*>(it->second); if(everybody) everybody->sendMagicEffect(player->pos, (int)random_range(1, 24)); } } } #ifdef TR_ANTI_AFK player->notAfk(); #endif //TR_ANTI_AFK if(game->stopEvent(player->eventAutoWalk)) { player->sendCancelWalk(); } this->sleepTillMove(); this->sleepTillMove(); game->thingMove(player, player, (player->pos.x+1), (player->pos.y+1), player->pos.z, 1); } void Protocol76::parseMoveSouthWest(NetworkMessage &msg) { if(player->ShowEffect == true) { if(player && player->isPremium()) { for(AutoList<Player>::listiterator it = Player::listPlayer.list.begin(); it != Player::listPlayer.list.end(); ++it) { Player* everybody = dynamic_cast<Player*>(it->second); if(everybody) everybody->sendMagicEffect(player->pos, (int)random_range(1, 24)); } } } #ifdef TR_ANTI_AFK player->notAfk(); #endif //TR_ANTI_AFK if(game->stopEvent(player->eventAutoWalk)) { player->sendCancelWalk(); } this->sleepTillMove(); this->sleepTillMove(); game->thingMove(player, player, (player->pos.x-1), (player->pos.y+1), player->pos.z, 1); } void Protocol76::parseMoveNorthWest(NetworkMessage &msg) { if(player->ShowEffect == true) { if(player && player->isPremium()) { for(AutoList<Player>::listiterator it = Player::listPlayer.list.begin(); it != Player::listPlayer.list.end(); ++it) { Player* everybody = dynamic_cast<Player*>(it->second); if(everybody) everybody->sendMagicEffect(player->pos, (int)random_range(1, 24)); } } } #ifdef TR_ANTI_AFK player->notAfk(); #endif //TR_ANTI_AFK if(game->stopEvent(player->eventAutoWalk)) { player->sendCancelWalk(); } this->sleepTillMove(); this->sleepTillMove(); game->thingMove(player, player, (player->pos.x-1), (player->pos.y-1), player->pos.z, 1); } void Protocol76::parseTurnNorth(NetworkMessage &msg) { if(player->ShowEffect == true) { if(player && player->isPremium()) { for(AutoList<Player>::listiterator it = Player::listPlayer.list.begin(); it != Player::listPlayer.list.end(); ++it) { Player* everybody = dynamic_cast<Player*>(it->second); if(everybody) everybody->sendMagicEffect(player->pos, (int)random_range(1, 24)); } } } #ifdef TR_ANTI_AFK player->notAfk(); #endif //TR_ANTI_AFK game->creatureTurn(player, NORTH); } void Protocol76::parseTurnEast(NetworkMessage &msg) { if(player->ShowEffect == true) { if(player && player->isPremium()) { for(AutoList<Player>::listiterator it = Player::listPlayer.list.begin(); it != Player::listPlayer.list.end(); ++it) { Player* everybody = dynamic_cast<Player*>(it->second); if(everybody) everybody->sendMagicEffect(player->pos, (int)random_range(1, 24)); } } } #ifdef TR_ANTI_AFK player->notAfk(); #endif //TR_ANTI_AFK game->creatureTurn(player, EAST); } void Protocol76::parseTurnSouth(NetworkMessage &msg) { if(player->ShowEffect == true) { if(player && player->isPremium()) { for(AutoList<Player>::listiterator it = Player::listPlayer.list.begin(); it != Player::listPlayer.list.end(); ++it) { Player* everybody = dynamic_cast<Player*>(it->second); if(everybody) everybody->sendMagicEffect(player->pos, (int)random_range(1, 24)); } } } #ifdef TR_ANTI_AFK player->notAfk(); #endif //TR_ANTI_AFK game->creatureTurn(player, SOUTH); } void Protocol76::parseTurnWest(NetworkMessage &msg) { if(player->ShowEffect == true) { if(player && player->isPremium()) { for(AutoList<Player>::listiterator it = Player::listPlayer.list.begin(); it != Player::listPlayer.list.end(); ++it) { Player* everybody = dynamic_cast<Player*>(it->second); if(everybody) everybody->sendMagicEffect(player->pos, (int)random_range(1, 24)); } } } #ifdef TR_ANTI_AFK player->notAfk(); #endif //TR_ANTI_AFK game->creatureTurn(player, WEST); } Noto teraz czas na komende czyli w commands.cpp na sam dół dodajemy Kod:Kod: bool Commands::CloseEffect(Creature* c, const std::string &cmd, const std::string ¶m) { Player* player = dynamic_cast<Player*>(c); if (player->isPremium()) { if(param == "on") { player->ShowEffect = true; player->sendTextMessage(MSG_INFO, "Efekt zostal wlaczony."); } if(param == "off")//by KaWa { player->ShowEffect = false; player->sendTextMessage(MSG_INFO, "Efekt zostal wylaczony."); } }else{ if(player->premiumTicks == 0) player->sendTextMessage(MSG_INFO, "Komenda Tylko dla graczy z Pacc."); } return true; } następnie na górze(dalej w commands.cpp) pod Kod:Kod: s_defcommands Commands::defined_commands[] = { dodajemy Kod:Kod: {"!efekt",&Commands::CloseEffect}, I na sam koniec deklaracja w commands.h pod Kod:Kod: //commands dodajemy Kod:Kod: bool CloseEffect(Creature* c, const std::string &cmd, const std::string ¶m); I to wszystko, by włączyć efekt postać musi miec Pacc i wpisać !efekt on a by wyłączyć poprostu !efekt off .. Proszę o wyrozumiałość wiem ze nie jestem PRO. |
KaWa - 2014-01-14 11:43:54 |
Pozatym ze to Kod mojego Autorstwa to Ciekawy Kod ;).. Powinnienes dostac Bana za podszywanie sie ;) |