Autor= Ja Rolus
Kod pod Clienta = 7.6
Kod polega na tym ze po wpisaniu komendy !efekt on za postacią która się rusza będą widoczne rożne efekty (np. NM_ME_FIRE_AREA). Kod jest ten pod komendę ponieważ może niektórych denerwować a także 'zamulac' grę.
Noto tak
Na początek w player.cpp pod
healthTick = 0;
dodajemy
ShowEffect = false;
następnie kierujemy sie do player.h i pod
#ifdef TLM_HOUSE_SYSTEM bool houseRightsChanged; #endif //TLM_HOUSE_SYSTEM
dodajemy
bool ShowEffect;
potem w protocol76.cpp zamieniamy całość od
: void Protocol76::parseMoveByMouse(NetworkMessage &msg)
do
void Protocol76::parseRequestOutfit(NetworkMessage &msg)
na to
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: 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: s_defcommands Commands::defined_commands[] = {
dodajemy
Kod: {"!efekt",&Commands::CloseEffect},
I na sam koniec deklaracja w commands.h pod
Kod: //commands
dodajemy
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.
Offline
Pozatym ze to Kod mojego Autorstwa to Ciekawy Kod .. Powinnienes dostac Bana za podszywanie sie
Spojrz w kod Idioto
"if(param == "off")//by KaWa"
Ostatnio edytowany przez KaWa (2014-01-14 11:44:59)
Offline