Postado Maio 27, 2017 8 anos function onSay(player, words, param) if not player:getGroup():getAccess() then return true end if player:getAccountType() < ACCOUNT_TYPE_GOD then return false end local itemCount = cleanMap() if itemCount > 0 then player:sendTextMessage(MESSAGE_STATUS_WARNING, "Cleaned " .. itemCount .. " item" .. (itemCount > 1 and "s" or "") .. " from the map.") end return false end O titulo do topico ja diz tudo, vocês podem conferir meu script de /clean
Postado Maio 27, 2017 8 anos Isso tem que alterar nas sources em map.cpp uint32_t Map::clean() { uint64_t start = OTSYS_TIME(); uint32_t count = 0, tiles = 0; if (g_game.getGameState() == GAME_STATE_NORMAL) { g_game.setGameState(GAME_STATE_MAINTAIN); } for (int32_t z = 0; z < (int32_t)MAP_MAX_LAYERS; z++) { for (uint32_t y = 1; y <= mapHeight; y++) { for (uint32_t x = 1; x <= mapWidth; x++) { Tile* tile = getTile(x, y, z); if (!tile || tile->hasFlag(TILESTATE_HOUSE) || !tile->getItemList()) { continue; } ++tiles; TileItemVector* itemList = tile->getItemList(); ItemVector::iterator it = itemList->begin(), end = itemList->end(); while (it != end) { if ((*it)->isCleanable()) { g_game.internalRemoveItem(*it, -1); it = itemList->begin(); end = itemList->end(); ++count; } else { ++it; } } } } } if (g_game.getGameState() == GAME_STATE_MAINTAIN) { g_game.setGameState(GAME_STATE_NORMAL); } std::cout << "> CLEAN: Removed " << count << " item" << (count != 1 ? "s" : "") << " from " << tiles << " tile" << (tiles != 1 ? "s" : "") << " in " << (OTSYS_TIME() - start) / (1000.) << " seconds." << std::endl; return count; }
Postado Maio 27, 2017 8 anos Autor 7 horas atrás, PsyMcKenzie disse: Isso tem que alterar nas sources em map.cpp uint32_t Map::clean() { uint64_t start = OTSYS_TIME(); uint32_t count = 0, tiles = 0; if (g_game.getGameState() == GAME_STATE_NORMAL) { g_game.setGameState(GAME_STATE_MAINTAIN); } for (int32_t z = 0; z < (int32_t)MAP_MAX_LAYERS; z++) { for (uint32_t y = 1; y <= mapHeight; y++) { for (uint32_t x = 1; x <= mapWidth; x++) { Tile* tile = getTile(x, y, z); if (!tile || tile->hasFlag(TILESTATE_HOUSE) || !tile->getItemList()) { continue; } ++tiles; TileItemVector* itemList = tile->getItemList(); ItemVector::iterator it = itemList->begin(), end = itemList->end(); while (it != end) { if ((*it)->isCleanable()) { g_game.internalRemoveItem(*it, -1); it = itemList->begin(); end = itemList->end(); ++count; } else { ++it; } } } } } if (g_game.getGameState() == GAME_STATE_MAINTAIN) { g_game.setGameState(GAME_STATE_NORMAL); } std::cout << "> CLEAN: Removed " << count << " item" << (count != 1 ? "s" : "") << " from " << tiles << " tile" << (tiles != 1 ? "s" : "") << " in " << (OTSYS_TIME() - start) / (1000.) << " seconds." << std::endl; return count; } eu fiz isso mas dava erro na hora compilar, existe algum outro jeito?
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.