Ir para conteúdo

Danyel Varejao

Membro
  • Registro em

  • Última visita

Solutions

  1. Danyel Varejao's post in (Resolvido)ERRO GRAVISSIMO was marked as the answer   
    Substitua para essa:
    Cylinder* Player::__queryDestination(int32_t& index, const Thing* thing, Item** destItem, uint32_t& flags) { if(!index /*drop to capacity window*/ || index == INDEX_WHEREEVER) { *destItem = NULL; const Item* item = thing->getItem(); if(!item) return this; std::list<std::pair<Container*, int32_t> > containers; std::list<std::pair<Cylinder*, int32_t> > freeSlots; bool autoStack = !((flags & FLAG_IGNOREAUTOSTACK) == FLAG_IGNOREAUTOSTACK); for(int32_t i = SLOT_FIRST; i < SLOT_LAST; ++i) { if(Item* invItem = inventory[i]) { if(invItem == item || invItem == tradeItem) continue; if(autoStack && item->isStackable() && __queryAdd(i, item, item->getItemCount(), 0) == RET_NOERROR && invItem->getID() == item->getID() && invItem->getItemCount() < 100) { *destItem = invItem; index = i; return this; } if(Container* container = invItem->getContainer()) { if(!autoStack && container->__queryAdd(INDEX_WHEREEVER, item, item->getItemCount(), flags) == RET_NOERROR) { index = INDEX_WHEREEVER; return container; } containers.push_back(std::make_pair(container, 0)); } } else if(!autoStack) { if(__queryAdd(i, item, item->getItemCount(), 0) == RET_NOERROR) { index = i; return this; } } else freeSlots.push_back(std::make_pair(this, i)); } while(!containers.empty()) { Container* tmpContainer = containers.front().first; int32_t level = containers.front().second; containers.pop_front(); if(!tmpContainer) continue; for(uint32_t n = 0; n < tmpContainer->capacity(); ++n) { if(Item* tmpItem = tmpContainer->getItem(n)) { if(tmpItem == item || tmpItem == tradeItem) continue; if(autoStack && item->isStackable() && tmpContainer->__queryAdd(n, item, item->getItemCount(), 0) == RET_NOERROR && tmpItem->getID() == item->getID() && tmpItem->getItemCount() < 100) { index = n; *destItem = tmpItem; return tmpContainer; } if(Container* container = tmpItem->getContainer()) { if(!autoStack && container->__queryAdd(INDEX_WHEREEVER, item, item->getItemCount(), flags) == RET_NOERROR) { index = INDEX_WHEREEVER; return container; } containers.push_back(std::make_pair(container, level + 1)); } } else { if(!autoStack) { if(tmpContainer->__queryAdd(n, item, item->getItemCount(), 0) == RET_NOERROR) { index = n; return tmpContainer; } } else freeSlots.push_back(std::make_pair(tmpContainer, n)); break; // one slot to check is definitely enough. } } } if(autoStack) { while(!freeSlots.empty()) { Cylinder* tmpCylinder = freeSlots.front().first; int32_t i = freeSlots.front().second; freeSlots.pop_front(); if(!tmpCylinder) continue; if(tmpCylinder->__queryAdd(i, item, item->getItemCount(), flags) == RET_NOERROR) { index = i; return tmpCylinder; } } } return this; } Thing* destThing = __getThing(index); if(destThing) *destItem = destThing->getItem(); if(Cylinder* subCylinder = dynamic_cast<Cylinder*>(destThing)) { index = INDEX_WHEREEVER; *destItem = NULL; return subCylinder; } return this; } Seu problema era uma configuração no config.lua de máximo de backpacks que iriam achar.
    Foi removido as linhas:
    int32_t deepness = g_config.getNumber(ConfigManager::PLAYER_DEEPNESS); if(deepness < 0 || level < deepness) containers.push_back(std::make_pair(container, level + 1));  
  2. Danyel Varejao's post in (Resolvido)[Erro] função creature:moveTo was marked as the answer   
    @Rayo o erro apresentado é que você não possui a função creature:moveTo(pos) em sua source, verifique se seguiu o tutorial corretamente e compilou sua source.
  3. Danyel Varejao's post in (Resolvido)[Creaturescript] Como travar um player se tiver tal storage? was marked as the answer   
    Em game.cpp procure por:
    bool Game::playerMove(uint32_t playerId, Direction dir) Dentro dessa função terá isso daqui:
    if(player->getNoMove()) { player->sendCancelWalk(); return false; } Logo abaixo adicione isso:
    std::string value; player->getStorage("6000", value); int32_t playerStorage = atoi(value.c_str()); if(playerStorage > 0) { player->sendCancelWalk(); return false; } Feche, salve, compile novamente e teste.
  4. Danyel Varejao's post in (Resolvido)[Pedido] Comando para evento was marked as the answer   
    Veja se é isso que fiz.
     
    Lib
    Pega_Pega = { Storage_Open = 20000, Storage_Player = 20001, Time_Event = 30, -- Tempo em segundos Position_Go = {x = 149, y = 388, z = 7}, Position_Finish = {x = 144, y = 388, z = 7}, Winners = { [1] = {ItemID = 2160, Count = 20}, [2] = {ItemID = 2160, Count = 10}, [3] = {ItemID = 2160, Count = 5} } } function Open_PegaPega(cid, Time) if getGlobalStorageValue(Pega_Pega.Storage_Open) >= os.time() then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Pega-Pega] O evento já está ocorrendo.") else setGlobalStorageValue(Pega_Pega.Storage_Open, os.time() + Time) doBroadcastMessage("[Pega-Pega] Foi iniciado, todos os players tem ".. Time .." segundos para utilizar o comando /evento.") end end function Close_PegaPega(WinnersArray) for i, Name in pairs(WinnersArray) do local Player = getCreatureByName(Name) if isPlayer(Player) then doPlayerAddItem(Player, Pega_Pega.Winners[i].ItemID, Pega_Pega.Winners[i].Count) doPlayerSendTextMessage(Player, MESSAGE_STATUS_WARNING, "[Pega-Pega] Você venceu o evento em ".. i .."º lugar e ganhou ".. Pega_Pega.Winners[i].Count .."x ".. getItemNameById(Pega_Pega.Winners[i].ItemID) ..".") end end for i, pid in pairs(getPlayersOnline()) do if getPlayerStorageValue(pid, Pega_Pega.Storage_Player) == 1 then doTeleportThing(pid, Pega_Pega.Position_Finish, true) doSendMagicEffect(getThingPos(pid), CONST_ME_TELEPORT) setPlayerStorageValue(pid, Pega_Pega.Storage_Player, -1) end end doBroadcastMessage("[Pega-Pega] O evento foi encerrado e os ganhadores foram: 1º, 2º e 3º: ".. table.concat(WinnersArray, ', ') ..".") end function Enter_PegaPega(cid) if getGlobalStorageValue(Pega_Pega.Storage_Open) >= os.time() then if getPlayerStorageValue(cid, Pega_Pega.Storage_Player) == -1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Pega-Pega] Você entrou no evento.") setPlayerStorageValue(cid, Pega_Pega.Storage_Player, 1) doTeleportThing(cid, Pega_Pega.Position_Go, true) doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT) else doPlayerSendCancel(cid, "[Pega-Pega] Você já está no evento.") doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) end else doPlayerSendCancel(cid, "[Pega-Pega] O evento não está aberto.") end end Talkaction Enter_PegaPega.lua
    function onSay(cid, words, param, channel) if not getTilePzInfo(getPlayerPosition(cid)) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Pega-Pega] Só pode usar o comando em area protect zone.") return true end if getPlayerAccess(cid) >= 3 then doTeleportThing(cid, Pega_Pega.Position_Go, true) else Enter_PegaPega(cid) end return true end Talkaction Close_PegaPega.lua
    function onSay(cid, words, param, channel) local CommandParam = string.explode(param, ",") if not CommandParam[1] or CommandParam[1] == "" then doPlayerSendCancel(cid, "Digite o nome do 1º lugar a vencer o evento.") elseif not CommandParam[2] or CommandParam[2] == "" then doPlayerSendCancel(cid, "Digite o nome do 2º lugar a vencer o evento.") elseif not CommandParam[3] or CommandParam[3] == "" then doPlayerSendCancel(cid, "Digite o nome do 3º lugar a vencer o evento.") else Close_PegaPega({CommandParam[1], CommandParam[2], CommandParam[3]}) end return true end Talkaction Open_PegaPega.lua
    function onSay(cid, words, param, channel) Open_PegaPega(cid, Pega_Pega.Time_Event) return true end Talkactions.xml tags
    <talkaction log="yes" words="/evento" event="script" value="Enter_PegaPega.lua"/> <talkaction log="yes" access="3" words="/fechareventopega-pega" event="script" value="Close_PegaPega.lua"/> <talkaction log="yes" access="3" words="/abrireventopega-pega" event="script" value="Open_PegaPega.lua"/>  
  5. Danyel Varejao's post in (Resolvido)(PEDIDO) alguém poderia me ajudar nesse script da anihi was marked as the answer   
    local config = { money = 1000, daily = "no", level = 5, storage = 30015, areas = { [1] = { topLeftPos = {x = 1736, y = 1855, z = 8}, bottomRightPos = {x = 1736, y = 1855, z = 8}, }, [2] = { topLeftPos = {x = 1736, y = 1855, z = 8}, bottomRightPos = {x = 1736, y = 1855, z = 8}, }, }, entry = { {x = 1736, y = 1855, z = 8}, }, destination = { {x = 1737, y = 1868, z = 8}, }, TOWERPosition = { {x = 1737, y = 1869, z = 8}, } } config.daily = getBooleanFromString(config.daily) local function CheckAnihilationInUse() for i = 1, #config.areas do for x = config.areas[i].topLeftPos.x, config.areas[i].bottomRightPos.x do for y = config.areas[i].topLeftPos.y, config.areas[i].bottomRightPos.y do for z = config.areas[i].topLeftPos.z, config.areas[i].bottomRightPos.z do local creature = getTopCreature({x = x, y = y, z = z}).uid if isPlayer(creature) then return true end end end end end return false end local function RemoveMonsters() local monsters = {} for i = 1, #config.areas do for x = config.areas[i].topLeftPos.x, config.areas[i].bottomRightPos.x do for y = config.areas[i].topLeftPos.y, config.areas[i].bottomRightPos.y do for z = config.areas[i].topLeftPos.z, config.areas[i].bottomRightPos.z do local position = {x = x, y = y, z = z, stackpos = 253} local creature = getThingfromPos(position) if isMonster(creature.uid) then table.insert(monsters, creature.uid) end end end end end for i = 1, #monsters do doRemoveCreature(monsters[i]) end end function onUse(cid, item, fromPosition, itemEx, toPosition) if(item.itemid == 1946) then if(config.daily) then doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE) else doTransformItem(item.uid, item.itemid - 1) end return true end if(item.itemid ~= 1945) then return true end if CheckAnihilationInUse() then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "A arena esta em uso, espere.") return true end local players = {} for _, position in ipairs(config.entry) do local pid = getTopCreature(position).uid if(pid == 0 or not isPlayer(pid) or getCreatureStorage(pid, config.storage) > 0 or getPlayerLevel(pid) < config.level or getPlayerMoney(cid) < config.money) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "No minimo players de level ".. config.level .." e possuir ".. config.money .." gold coins.") return true end table.insert(players, pid) end RemoveMonsters() for i = 1, #config.TOWERPosition do doSummonCreature("Destroyer TOWER", config.TOWERPosition[i]) end for i, pid in ipairs(players) do doSendMagicEffect(config.entry[i], CONST_ME_POFF) doTeleportThing(pid, config.destination[i], false) doSendMagicEffect(config.destination[i], CONST_ME_ENERGYAREA) end doTransformItem(item.uid, item.itemid + 1) return true end  
  6. Danyel Varejao's post in (Resolvido)(PEDIDO) Script porta que só passa quem matou os monstros da lista was marked as the answer   
    1º Em data/creaturescripts/scripts adicione um arquivo chamado Quest_Bosses.lua e cole isso dentro:
    local Configs = { Bosses = { ["Nome do boss"] = 60000, ["Nome do boss"] = 60001, ["Nome do boss"] = 60002, ["Nome do boss"] = 60003, ["Nome do boss"] = 60004, ["Nome do boss"] = 60005, ["Nome do boss"] = 60006, ["Nome do boss"] = 60007, ["Nome do boss"] = 60008, ["Nome do boss"] = 60009, ["Nome do boss"] = 60010, } } function onDeath(cid, corpse, deathList) for Name, Storage in pairs(Configs.Bosses) do if getCreatureName(cid) == Name then for i = 1, #deathList do setPlayerStorageValue(deathList[i], Storage, 1) end end end registerCreatureEvent(cid, "Quest_Bosses") return true end 2º Configure o script pra o nome dos boss corretamente, Exemplo: ["Rat"], ["Orc"] etc
    3º Em data/creaturescripts/scripts/login.lua adicione isso dps de qualquer registerCreatureEvent
    registerCreatureEvent(cid, "Quest_Bosses") 4º Em data/creaturescripts/creaturescripts.xml adicione essa tag:
    <event type="death" name="Quest_Bosses" event="script" value="Quest_Bosses.lua"/> 5º Em data/actions/scripts cria um arquivo chamado Quest_Bosses.lua e cole isso:
    local Configs = { Door_AID = 6000, Bosses = { [1] = {60000, "Nome do Boss1"}, [2] = {60001, "Nome do Boss2"}, [3] = {60002, "Nome do Boss3"}, [4] = {60003, "Nome do Boss4"}, [5] = {60004, "Nome do Boss5"}, [6] = {60005, "Nome do Boss6"}, [7] = {60006, "Nome do Boss7"}, [8] = {60007, "Nome do Boss8"}, [9] = {60008, "Nome do Boss9"}, [10] = {60009, "Nome do Boss10"}, [11] = {60010, "Nome do Boss11"}, } } local function CheckKillBosses(cid) for i = 1, #Configs.Bosses do if getPlayerStorageValue(cid, Configs.Bosses[i][1]) < 0 then return false end end return true end local function EmptyBosses(cid) local Table = {} for i = 1, #Configs.Bosses do if getPlayerStorageValue(cid, Configs.Bosses[i][1]) < 0 then table.insert(Table, Configs.Bosses[i][2]) end end return table.concat(Table, ', ') end function onUse(cid, item, fromPosition, itemEx, toPosition) local Player_Pos = getThingPos(cid) if item.aid == Configs.Door_AID then if CheckKillBosses(cid) then if Player_Pos.x == toPosition.x then if Player_Pos.y < toPosition.y then Player_Pos.y = toPosition.y + 1 else Player_Pos.y = toPosition.y - 1 end elseif Player_Pos.y == toPosition.y then if Player_Pos.x < toPosition.x then Player_Pos.x = toPosition.x + 1 else Player_Pos.x = toPosition.x - 1 end end doTeleportThing(cid, Player_Pos, true) doSendMagicEffect(Player_Pos, CONST_ME_TELEPORT) else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Falta voce matar: ".. EmptyBosses(cid) ..".") end end return true end 6º Em data/actions/actions.xml adicione a tag:
    <action actionid="6000" event="script" value="Quest_Bosses.lua"/>  
    7º Configure o nome dos bosses corretamente e não esqueça de colocar a porta com ActionID 6000 no seu remeres map editor!
    8º No xml de todos os bosses coloque isso antes de </monster>:
    <script> <event name="Quest_Bosses"/> </script> Caso tenha alguma dúvida ou não funcione só falar!
  7. Danyel Varejao's post in (Resolvido)Spell que acumula storage was marked as the answer   
    Não entendi muito bem oque voce quis, mas testa ai
     
    Script do ataque.
    local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE) setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ICEATTACK) setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLICE) setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, -10, -1, -20, 5, 5, 1.4, 2.1) local Configs = { Storage = 12202, -- Storage da marca Time = 5, -- Tempo em segundos de cada marca } local function RemoveMark(cid) if isPlayer(cid) then setPlayerStorageValue(cid, Configs.Storage, getPlayerStorageValue(cid, Configs.Storage) - 1) end return true end local function AddMark(cid) if isPlayer(cid) then if getPlayerStorageValue(cid, Configs.Storage) <= 5 then setPlayerStorageValue(cid, Configs.Storage, getPlayerStorageValue(cid, Configs.Storage) + 1) addEvent(RemoveMark, Configs.Time * 1000, cid) end end return true end function onCastSpell(cid, var) local target = getCreatureTarget(cid) if isPlayer(target) then AddMark(target) end return doCombat(cid, combat, var) end  
    Script pra remover as marcas
    local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false) local Configs = { Storage = 12202, -- Storage da marca Damages_Per_Mark = 50, } function onCastSpell(cid, var) local Damage = getPlayerStorageValue(cid, Configs.Storage) * Configs.Damages_Per_Mark if getPlayerStorageValue(cid, Configs.Storage) > 0 then doCreatureAddHealth(cid, -Damage) setPlayerStorageValue(cid, Configs.Storage, 0) end return doCombat(cid, combat, var) end  
    Não testei, caso aconteça algo de errado me avise!
  8. Danyel Varejao's post in (Resolvido)Error CreatureScript - Item Por Level e Vocação was marked as the answer   
    Isso é um sistema de autoloot...
    Certo, o erro mudou agr coloca isso daqui na mesma lib:
     
    function countTable(table) local y = 0 if type(table) == "table" then for _ in pairs(table) do y = y + 1 end return y end return false end  
  9. Danyel Varejao's post in (Resolvido)Como crio item para da points no site? was marked as the answer   
    Cria um arquivo chamado Points.lua em data/lib e cole isto:
     
    function getAccountPoints(cid) local Result = db.getResult('select `premium_points` from accounts where name = \''..getPlayerAccount(cid)..'\'') if(Result:getID() == -1) then return false end local Points = Result:getDataInt("premium_points") Result:free() return tonumber(Points) end function doAccountAddPoints(cid, Count) return db.query("UPDATE `accounts` SET `premium_points` = '".. getAccountPoints(cid) + Count .."' WHERE `name` ='"..getPlayerAccount(cid).."'") end function doAccountRemovePoints(cid, Count) return db.query("UPDATE `accounts` SET `premium_points` = '".. getAccountPoints(cid) - Count .."' WHERE `name` ='"..getPlayerAccount(cid).."'") end  
    Em seguida vá até a pasta data/actions/actions.xml e cole isto, lembrando que o id do item está configurado para 2345:
     
    <action itemid="2345" event="script" value="Add_Points.lua"/> Em seguida vá até a pasta data/actions/scripts e cria um arquivo chamado Add_Points.lua e cole isto dentro:

     
    local Configs = { Count = 1 } function onUse(cid, item, fromPosition, itemEx, toPosition) doAccountAddPoints(cid, Configs.Count) doCreatureSay(cid, "Congratulations, your received ".. Configs.Count .." premium points!", TALKTYPE_ORANGE_1) doSendMagicEffect(getThingPos(cid), 28) doRemoveItem(item.uid, 1) return true end  
    Caso tenha te ajudado marque como melhor resposta, obrigado.

Informação Importante

Confirmação de Termo