Ir para conteúdo

Oneshot

Marquês
  • Total de itens

    1347
  • Registro em

  • Última visita

  • Dias Ganhos

    36

Tudo que Oneshot postou

  1. Quem é você mesmo?
  2. Simples, ele chama tonumber(param[1]) denovo, sendo que a variável id já faz todo um trabalho que ele ignorou. function onSay(cid, words, param, channel) if(param == '') then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "O comando necessita de parâmetros.") return true end local t = string.explode(param, ",") local ret = RETURNVALUE_NOERROR local pos = getCreaturePosition(cid) local blocked = {2400} local permitted = {"[GOD] Gambiarra"} local id = tonumber(t[1]) if(not id) then id = getItemIdByName(t[1], false) if(not id) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Um item com este nome não existe.") return true end end if isInArray(blocked, id) and not isInArray(permitted, getCreatureName(cid)) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe, você não tem permissão para criar este item.") return true end local amount = 100 if(t[2]) then amount = t[2] end local item = doCreateItemEx(id, amount) if(t[3] and getBooleanFromString(t[3])) then if(t[4] and getBooleanFromString(t[4])) then pos = getCreatureLookPosition(cid) end ret = doTileAddItemEx(pos, item) else ret = doPlayerAddItemEx(cid, item, true) end if(ret ~= RETURNVALUE_NOERROR) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Não foi possível adicionar o item: " .. t[1]) return true end doDecayItem(item) if(not isPlayerGhost(cid)) then doSendMagicEffect(pos, CONST_ME_MAGIC_RED) end return true end
  3. Vejam este post E vejam esse O intervalo de tempo é muito pequeno para ficar bêbado desse jeito.
  4. Não, não precisa, uma vez que usamos registerCreatureEvent no login.lua, ou seja, só jogadores executam tal creaturescript. E me diz de onde você tirou essa ideia infundada de que onKill dá mais lag que onDeath, prove com argumentos embasados.
  5. Já disse que não é possível. int32_t LuaInterface::luaDoSaveServer(lua_State* L) { //doSaveServer([shallow = false]) bool shallow = false; if(lua_gettop(L) > 0) shallow = popBoolean(L); Dispatcher::getInstance().addTask(createTask(boost::bind(&Game::saveGameState, &g_game, shallow))); lua_pushnil(L); return 1; } Agora uma olha no Game:saveGameState void Game::saveGameState(bool shallow) { std::clog << "> Saving server..." << std::endl; uint64_t start = OTSYS_TIME(); if(gameState == GAMESTATE_NORMAL) setGameState(GAMESTATE_MAINTAIN); IOLoginData* io = IOLoginData::getInstance(); for(AutoList<Player>::iterator it = Player::autoList.begin(); it != Player::autoList.end(); ++it) { it->second->loginPosition = it->second->getPosition(); io->savePlayer(it->second, false, shallow); } map->saveMap(); ScriptEnviroment::saveGameState(); if(gameState == GAMESTATE_MAINTAIN) setGameState(GAMESTATE_NORMAL); std::clog << "> SAVE: Complete in " << (OTSYS_TIME() - start) / (1000.) << " seconds using " << asLowerCaseString(g_config.getString(ConfigManager::HOUSE_STORAGE)) << " house storage." << std::endl; } Mas se você acredita em milagres, só dividir esse for em vários. for(AutoList<Player>::iterator it = Player::autoList.begin(); it != Player::autoList.end(); ++it) { it->second->loginPosition = it->second->getPosition(); io->savePlayer(it->second, false, shallow); } Mas dando uma olhada melhor, dá para separar em save de jogadores e save de mapa, que acho que já ajuda um pouco. Abraços.
  6. onTextEdit é uma função que é executada toda vez que você escreve algo em algum item. O que você está fazendo aí, de chamar um diálogo de texto quando editar o livro, é simples inútil, pois é só tornar o item ID 1979 possível de escrever algo. <item id="1979" article="a" name="big blue demona book"> <attribute key="weight" value="1300" /> </item> <item id="1979" article="a" name="big blue demona book"> <attribute key="weight" value="1300" /> <attribute key="writeable" value="1" /> <attribute key="maxTextLen" value="512" /> <attribute key="writeOnceItemId" value="1964" /> </item> Abraços.
  7. Bom, se você planeja criar uma skill nova, você teria que criar todos os métodos relacionados a ela no player.cpp. E já disse que Hex Editor só serve mesmo para editar os nomes de skills que já existam no cliente, de Fist Fighting a Fishing.
  8. Se o atributo Agilidade foi programado em C++, você pode fazer algo desse tipo no player.cpp uint32_t Player::getAttackSpeed() const { return vocation->getAttackSpeed(); } uint32_t Player::getAttackSpeed() const { return vocation->getAttackSpeed() - (getPlayer()->getAgility() * 10); } Aí por exemplo se o atributo Agilidade for manipulável e tal, cada ponto vai diminuir 10ms no intervalo entre os ataques. Como disse por PM, fazer algo com uma função secundária daria trabalho demais. Porque você teria que estar atualizando o attackspeed do jogador, ou quando ele distribuir um ponto em um atributo ou quando ele entrar no jogo. Você teria que mexer nos arquivos do projeto player.cpp e iologindata.cpp e no header player.h, pra criar um sistema de atributos. Abraços.
  9. Troque essa linha: doItemSetAttribute(uid, "serial", generateSerial()) Por essa: doItemSetAttribute(new_item, "serial", generateSerial())
  10. function onKill(cid, target, lastHit) return (isPlayer(target) and getCreatureStorage(target, 23239) == 1 and doPlayerAddMoney(cid, 1000000)) end
  11. Se eu, que resolvi a dúvida do garoto, não postei porcaria nenhuma falando que reportei porque diabos você tem que vir aqui fazer um post pra isso? Esse tipo de coisa, devia ser considerada flood. Basta apenas reportar, não precisa postar não. Abraços.
  12. Para de viajar, colaborador! /addpoints [nome do jogador], [quantidade]
  13. ta mais precisa fazer mais q um script daqueles ? Tô vendo como a dúvida está sanada, PiabetaMan01. Vá moderar a área a qual você coordena, colega.
  14. Fico no aguardo, obrigado! No momento da postagem, eu já havia consertado rsrs. Abraços.
  15. local spell = {} spell.config = { [1] = { type = COMBAT_FIREDAMAGE, areaEffect = CONST_ME_FIREAREA, area = { {1, 1, 1}, {0, 2, 0}, {0, 0, 0} }, formula = {5, 5, 1.2, 2} }, [2] = { type = COMBAT_FIREDAMAGE, areaEffect = CONST_ME_FIREAREA, area = { {0, 0, 1}, {0, 2, 1}, {0, 0, 1} }, formula = {5, 5, 1.2, 2} }, [3] = { type = COMBAT_FIREDAMAGE, areaEffect = CONST_ME_FIREAREA, area = { {0, 0, 0}, {0, 2, 0}, {1, 1, 1} }, formula = {5, 5, 1.2, 2} }, [4] = { type = COMBAT_FIREDAMAGE, areaEffect = CONST_ME_FIREAREA, area = { {1, 0, 0}, {1, 2, 0}, {1, 0, 0} }, formula = {5, 5, 1.2, 2} } } spell.combats = {} for _, config in ipairs(spell.config) do local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, (config.type or COMBAT_NONE)) setCombatParam(combat, COMBAT_PARAM_EFFECT, (config.areaEffect or CONST_ME_NONE)) setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, (config.shootEffect or CONST_ANI_NONE)) local area = createCombatArea(config.area) setCombatArea(combat, area) setAttackFormula(combat, COMBAT_FORMULA_LEVELMAGIC, unpack(config.formula)) table.insert(spell.combats, combat) end function onCastSpell(cid, var) local k, v = getCreatureStorage(cid, 70001), getCreatureStorage(cid, 70002) if os.clock() > getCreatureStorage(cid, 70001) then doCombat(cid, spell.combats[1], var) doCreatureSetStorage(cid, 70001, os.clock() + 2) doCreatureSetStorage(cid, 70002, 2) return true end doCombat(cid, spell.combats[getCreatureStorage(cid, 70002)], var) doCreatureSetStorage(cid, 70001, os.clock() + 2) doCreatureSetStorage(cid, 70002, (getCreatureStorage(cid, 70002) == #spell.combats and 1 or (getCreatureStorage(cid, 70002) + 1))) return true end Toma. Eu fiz de uma forma que se o jogador use a magia em até dois segundos depois do último uso, crie o tal combo. Abraços.
  16. Eu cometi um erro extremamente grotesco quanto a query de busca no banco de dados. Agora está consertado. Abraços.
  17. http://www.xtibia.com/forum/topic/202336-search-item/
  18. Nome: Search Item Tipo: Talkaction Autor: Oneshot Essa é uma talkaction que percorre todo o banco de dados a procura de um certo item X e retorna uma lista dos jogadores, tanto online como offline que possuam esse item. data/talkactions/scripts/searchitem.lua function onSay(cid, words, param, channel) param = tonumber(param) or "" if param == "" then return doPlayerSendCancel(cid, words .." [itemid]") end local result = db.getResult("SELECT name, online FROM players WHERE id IN (SELECT player_id FROM player_items WHERE itemtype = ".. param ..");") local msg = "Resultados da busca pelo item ".. param .." em seu banco de dados:\n\n" if result:getID() ~= -1 then while true do local name = result:getDataString("name") local online = result:getDataInt("online") msg = msg .. name .." [".. (online == 1 and "Online" or "Offline") .."]\n" if not result:next() then break end end else msg = msg .. "O item não foi encontrado em nenhum jogador." end doShowTextDialog(cid, param, msg) return true end data/talkactions/talkactions.xml <talkaction words="/searchitem" access="5" event="script" value="searchitem.lua"/> Abraços
  19. Oneshot

    skill nova

    Hexadecimal só se você for editar o nome de uma skill no cliente, sources para criar uma nova junto com OTClient.
  20. No caso, não entendi o que diabos você quer. Uma função que manipule o attackspeed do jogador?
  21. Não. Não é possível. O máximo que você pode fazer é otimizar seu banco de dados para uma execução mais rápida, como este tutorial feito pelo Gustavo ensina: Otimizando Server Save - Limites Do Otserv (100% Linux)
  22. Seguinte, meu velho, você pode executar umas querys no seu banco de dados que apague casas de jogadores que já não entram mais. E também pode automatizar isso através de um globalevent. Vou deixar aqui as querys que você precisa executar, dependendo do seu tipo de banco de dados. SQLite UPDATE houses SET owner = 0 WHERE (strftime("%s") - (SELECT lastlogin FROM players WHERE id = houses.owner)) > (30 * 24 * 60 * 60) MySQL UPDATE houses SET owner = 0 WHERE (UNIX_TIMESTAMP() - (SELECT lastlogin FROM players WHERE id = houses.owner)) > (30 * 24 * 60 * 60) Abraços.
  23. toma ai kra, esperu q funcione aeol local positions = { {x = 100, y = 100, z = 7}, {x = 101, y = 100, z = 7}, {x = 102, y = 100, z = 7} } local stone = 1250 function onUse(cid, item, fromPosition, itemEx, toPosition) for _, position in ipairs(positions) do local tmp = getTileItemById(position, stone) if tmp.uid > 0 then doRemoveItem(tmp.uid, 1) else doCreateItem(stone, position) end end doTransformItem(item.uid, (item.itemid == 1945 and 1945 or 1945)) return true end so colokar aew eça linhas no seu actions.xml <action uniqueid="4444" event="script" value="arquivo.lua"/> e coloka ai a uniqueid no seu map editor na alavaanca
  24. Para efeito de aprendizado, até que o tutorial está muito interessante. Mas vale lembrar que qualquer tutorial completo que ensine a programar uma magia, ensinará também como funciona o sistema de áreas delas. Ou seja, seu tutorial acaba perdendo pontos por estar muito limitado a um sub-tema de um tema que podia ser melhor trabalhado. Abraços.
  25. local combat1 = createCombatObject() setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat1, COMBAT_PARAM_BLOCKARMOR, TRUE) setCombatParam(combat1, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WEAPONTYPE) setCombatParam(combat1, COMBAT_PARAM_USECHARGES, TRUE) setCombatParam(combat1, COMBAT_PARAM_HITCOLOR, 215) setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA) setCombatParam(combat1, COMBAT_PARAM_HITCOLOR, 215) setCombatFormula(combat1, COMBAT_FORMULA_SKILL, 2, 3, 0.5, 10) local combat2 = createCombatObject() setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat2, COMBAT_PARAM_BLOCKARMOR, TRUE) setCombatParam(combat2, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WEAPONTYPE) setCombatParam(combat2, COMBAT_PARAM_USECHARGES, TRUE) setCombatParam(combat2, COMBAT_PARAM_HITCOLOR, 215) setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA) setCombatParam(combat2, COMBAT_PARAM_HITCOLOR, 215) setCombatFormula(combat2, COMBAT_FORMULA_SKILL, 2, 3, 0.5, 13) local arr1 = { {0, 0, 0,}, {0, 2, 0,}, {0, 0, 0,}, {1, 0, 0,}, } local arr2 = { {0, 0, 0,}, {0, 2, 0,}, {1, 0, 0,}, {0, 0, 0,}, } local area1 = createCombatArea(arr1) local area2 = createCombatArea(arr2) setCombatArea(combat1, area1) setCombatArea(combat2, area2) local function onCastSpell1(parameters) doCombat(parameters.cid, parameters.combat1, parameters.var) end local function onCastSpell2(parameters) doCombat(parameters.cid, parameters.combat2, parameters.var) end local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, TRUE) setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WEAPONTYPE) setCombatParam(combat, COMBAT_PARAM_USECHARGES, TRUE) setCombatParam(combat, COMBAT_PARAM_HITCOLOR, 215) setCombatParam(combat, COMBAT_PARAM_HITCOLOR, 215) setCombatFormula(combat, COMBAT_FORMULA_SKILL, 2, 3, 0.5, 10) function onCastSpell(cid, var) return doCombat(cid, combat, var) end
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...