Ir para conteúdo
  • Cadastre-se
  1. FlamesAdmin

    FlamesAdmin

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.


  • Conteúdo Similar

    • Por looktsx
      Salve Rapaziada tudo bom .
      queria ajuda pra cria um teleport ou uma alavanca com tempo ..
      depois do player usa o teleport ou a lavanca ele so poderá usa depois de tal determinado tempo.
       
      SERVIDOR 12.91
      Se alguem poder me ajuda vou fica grato ,
      des de ja agradeço a todos.
      ..
    • Por willian646
      O evento é totalmente baseado no Foxy Quiz proveniente do GLA, no entanto é apenas uma base para vocês alterarem como acharem melhor.
      Para começar será necessario que você crie um arquivo em talkactions>scripts para entrar no evento, como por exemplo : participar.lua
      e entao colocar sua tag em talkactions.xml, como por exemplo: 
      <talkaction words="!participar;/participar" script="!participar.lua"/> Tendo feito isso você irá colar esse codigo dentro desse arquivo: 
      function onSay(cid, words, param)pos = {x=1236, y=1125, z=15} --POSIÇAO QUE O PLAYER IRÁ COM O COMANDO if getGlobalStorageValue(88788) == 1 then doSendMagicEffect(getPlayerPosition(cid),19) doTeleportThing(cid,pos) else doPlayerSendCancel(cid, "Desculpe mas o evento esta fechado !") end return true end Agora iremos para o script principal, vá em global events>scripts e crie o arquivo pokequiz.lua em seguida coloque sua tag em globalevents.xml como por exemplo: 
      <globalevent name="Pokequiz" interval="10" event="script" value="pokequiz.lua"/> Lembrando que o intervalo de inicio do evento é com vcs, Tendo feito isso abra o arquivo e cole o  seguinte código dentro : 
      quizstrg = 88788 local wave = 0 local CPpos = {x=1051, y=1047, z=7} --POSIÇAO QUE O PLAYER IRÁ SE ERRAR function wave_acresc() wave = wave + 1 addEvent(Quiz, 5000) end function Quiz() if wave == 1 then doBroadcastMessage("Na serie pokemon RAYQUAZA possui mega evolucao ?", RED) addEvent(Resposta, 10000) elseif wave == 2 then doBroadcastMessage("Na serie pokemon ARCEUS e considerado um pokemon RARO ?", RED) addEvent(Resposta, 10000) elseif wave == 3 then doBroadcastMessage("Na serie pokemon MEW criou os 3 caes lendarios ?", RED) addEvent(Resposta, 10000) elseif wave == 4 then doBroadcastMessage("Na serie pokemon ARCEUS tem o poder de mudar de tipo livremente ?", RED) addEvent(Resposta, 10000) elseif wave == 5 then doBroadcastMessage("Na serie pokemon GIRATINA possui 2 formas sendo elas alterada e fantasma ?", RED) addEvent(Resposta, 10000) elseif wave == 6 then doBroadcastMessage("Na serie pokemon DIALGA e PALKIA sao rivais ?", RED) addEvent(Resposta, 10000) elseif wave == 7 then doBroadcastMessage("Na serie pokemon CELEBI possui a habilidade de viajar entre dimensoes ?", RED) addEvent(Resposta, 10000) elseif wave == 8 then doBroadcastMessage("Na serie pokemon SOLGALEO e a primeira evolucao de cosmog ?", RED) addEvent(Resposta, 10000) elseif wave == 9 then doBroadcastMessage("Na serie pokemon MAGEARNA e uma das ultra beasts ?", RED) addEvent(Resposta, 10000) elseif wave == 10 then doBroadcastMessage("Na serie pokemon a cor original de MAGEARNA e laranja ?", RED) addEvent(Resposta, 10000) elseif wave == 11 then doBroadcastMessage("O evento Quiz terminou !", RED) addEvent(winPlayers, 5000) end end function Resposta() if wave == 1 then addEvent(TPFalso, 5000) elseif wave == 2 then addEvent(TPVerdadeiro, 5000) elseif wave == 3 then addEvent(TPVerdadeiro, 5000) elseif wave == 4 then addEvent(TPFalso, 5000) elseif wave == 5 then addEvent(TPVerdadeiro, 5000) elseif wave == 6 then addEvent(TPFalso, 5000) elseif wave == 7 then addEvent(TPVerdadeiro, 5000) elseif wave == 8 then addEvent(TPVerdadeiro, 5000) elseif wave == 9 then addEvent(TPVerdadeiro, 5000) elseif wave == 10 then addEvent(TPFalso, 5000) end end function TPFalso() for _, sid in ipairs(getPlayersOnline()) do local posi = {x=1236, y=1122, z=15} local posf = {x=1243, y=1128, z=15} local pos = getPlayerPosition(sid) if isInArea(pos, posi, posf) then doTeleportThing(sid,CPpos) end addEvent(wave_acresc, 5000) end end function TPVerdadeiro() for _, sid in ipairs(getPlayersOnline()) do local posi = {x=1228, y=1122, z=15} local posf = {x=1235, y=1128, z=15} local pos = getPlayerPosition(sid) if isInArea(pos, posi, posf) then doTeleportThing(sid,CPpos) end addEvent(wave_acresc, 5000) end end function winPlayers() for _, sid in ipairs(getPlayersOnline()) do local posi = {x=1228, y=1122, z=15} local posf = {x=1243, y=1128, z=15} local pos = getPlayerPosition(sid) if isInArea(pos, posi, posf) then doTeleportThing(sid,CPpos) doPlayerAddItem(sid,2159, 10) end wave = 0 setGlobalStorageValue(88788, 0) end end --AVISOS DE INICIO function finalEventWarning() if getGlobalStorageValue(quizstrg) == 1 then setGlobalStorageValue(88788, 2) doBroadcastMessage("O evento Quiz fechou, a primeira pergunta surgira em 30 segundos.", RED) addEvent(wave_acresc, 30000) end end function secondEventWarning() if getGlobalStorageValue(quizstrg) == 1 then doBroadcastMessage("O evento Quiz ira iniciar em 1 minuto, usem o comando !participar ou /participar.", RED) addEvent(finalEventWarning, 60000) end end function firstEventWarning() if getGlobalStorageValue(quizstrg) == 1 then doBroadcastMessage("O evento Quiz ira iniciar em 3 minutos, usem o comando !participar ou /participar.", RED) addEvent(secondEventWarning, 120000) end end function onThink(interval, lastExecution) if getGlobalStorageValue(quizstrg) == 0 then setGlobalStorageValue(88788, 1) doBroadcastMessage("O evento Quiz ira iniciar em 5 minutos, usem o comando !participar ou /participar.", RED) addEvent(firstEventWarning, 120000) end return true end Já ia me esquecendo, a unica coisa ao qual vocês devem mudar de acordo com as coordenadas do seu mapa e área do evento são as funções TPVerdadeiro , TPFalso, winPlayers , elas servem para indicar qual área é a errada e teleportar quem tiver nessa área pro cp, caso o lado errado seja o esquerdo então será usado a função  TPVerdadeiro, e é a msm coisa para o outro lado, no caso da winPlayers é toda a área do evento.
       
      Aqui vai um exemplo: 
       
      E é isso rapaziada, não sei se já possui algum evento parecido por essas bandas, mas eu não encontrei ,então fiz  e resolvi contribuir com a comunidade, peço que se for repostar em algum outro lugar dê os devidos créditos, obg e até a próxima.
    • Por L3K0T
      TUTORIAL BY L3K0T
       
      EXPLICAÇÃO/RESUMO:
      Bom galera esse sistema foi fixado por mim e resolvi trazer pra vocês o UPDATE contendo 2 moveitem pra funcionar perfeitamente ao seu jogo, esses sistemas tem a obrigação de parar players que jogam lixo na porta da sua casa, em cima do seu depot, em teleportes, e aonde você não queira. "somente dono, sub, e convidados podem jogar lixo ou mover items da sua casa" é um pacotão completo e revisado que vai evitar engraçadinhos bugar seu server.
       
      lixo no dp vídeo spoiler;;
       
      lixo house vídeo  spoiler;;
       
       
      Tutorial:
      1° abra seu creatureevents.cpp com o editor de sua preferencia. "eu uso notepad++"
       
      Ache o TERCEIRO CREATURE_EVENT_PREPAREDEATH; 
      case CREATURE_EVENT_PREPAREDEATH: return "cid, deathList"; em baixo coloca:
      case CREATURE_EVENT_MOVEITEM: return "moveItem, frompos, topos, cid"; case CREATURE_EVENT_MOVEITEM2: return "cid, item, count, toContainer, fromContainer, fromPos, toPos"; ache o SEGUNDO CREATURE_EVENT_PREPAREDEATH:
      case CREATURE_EVENT_PREPAREDEATH: return "onPrepareDeath"; em baixo coloca:
      case CREATURE_EVENT_MOVEITEM: return "onMoveItem"; case CREATURE_EVENT_MOVEITEM2: return "onMoveItem2"; ache o PRIMEIRO CREATURE_EVENT_PREPAREDEATH:
      else if(tmpStr == "preparedeath") m_type = CREATURE_EVENT_PREPAREDEATH; em baixo coloca:
      else if(tmpStr == "moveitem") m_type = CREATURE_EVENT_MOVEITEM; else if(tmpStr == "moveitem2") m_type = CREATURE_EVENT_MOVEITEM2; ache:
      bool CreatureEvents::playerLogout(Player* player, bool forceLogout) { //fire global event if is registered bool result = true; for(CreatureEventList::iterator it = m_creatureEvents.begin(); it != m_creatureEvents.end(); ++it) { if((*it)->getEventType() == CREATURE_EVENT_LOGOUT && (*it)->isLoaded() && !(*it)->executeLogout(player, forceLogout) && result) result = false; } return result; } em baixo coloca: ATENÇÃO PRA TFS 0.4 USE ESSE ABAIXO
      uint32_t CreatureEvent::executeMoveItem2(Player* player, Item* item, uint8_t count, const Position& fromPos, const Position& toPos, Item* toContainer, Item* fromContainer, int16_t fstack) { //onMoveItem(cid, item, count, toContainer, fromContainer, fromPos, toPos) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(player->getPosition()); std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(player) << std::endl; env->streamThing(scriptstream, "item", item, env->addThing(item)); scriptstream << "local count = " << count << std::endl; env->streamThing(scriptstream, "toContainer", toContainer, env->addThing(toContainer)); env->streamThing(scriptstream, "fromContainer", fromContainer, env->addThing(fromContainer)); env->streamPosition(scriptstream, "fromPos", fromPos, fstack); env->streamPosition(scriptstream, "toPos", toPos, 0); scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ char desc[30]; sprintf(desc, "%s", player->getName().c_str()); env->setEvent(desc); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(player->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(player)); LuaInterface::pushThing(L, item, env->addThing(item)); lua_pushnumber(L, count); LuaInterface::pushThing(L, toContainer, env->addThing(toContainer)); LuaInterface::pushThing(L, fromContainer, env->addThing(fromContainer)); LuaInterface::pushPosition(L, fromPos, fstack); LuaInterface::pushPosition(L, toPos, 0); bool result = m_interface->callFunction(7); m_interface->releaseEnv(); return result; } } else { std::clog << "[Error - CreatureEvent::executeMoveItem] Call stack overflow." << std::endl; return 0; } } uint32_t CreatureEvents::executeMoveItems(Creature* actor, Item* item, const Position& frompos, const Position& pos) { for(CreatureEventList::iterator it = m_creatureEvents.begin(); it != m_creatureEvents.end(); ++it) { if((*it)->getEventType() == CREATURE_EVENT_MOVEITEM) { if(!(*it)->executeMoveItem(actor, item, frompos, pos)) return 0; } } return 1; } uint32_t CreatureEvent::executeMoveItem(Creature* actor, Item* item, const Position& frompos, const Position& pos) { if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(pos); std::stringstream scriptstream; env->streamThing(scriptstream, "moveItem", item, env->addThing(item)); env->streamPosition(scriptstream, "position", frompos, 0); env->streamPosition(scriptstream, "position", pos, 0); scriptstream << "local cid = " << env->addThing(actor) << std::endl; scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ char desc[35]; sprintf(desc, "%s", player->getName().c_str()); env->setEventDesc(desc); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(pos); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); LuaInterface::pushThing(L, item, env->addThing(item)); LuaInterface::pushPosition(L, frompos, 0); LuaInterface::pushPosition(L, pos, 0); lua_pushnumber(L, env->addThing(actor)); bool result = m_interface->callFunction(4); m_interface->releaseEnv(); return result; } } else { std::clog << "[Error - CreatureEvent::executeMoveItem] Call stack overflow." << std::endl; return 0; } }  
       
      ATENÇÃO PRA TFS 0.3.6 USE ESSE ABAIXO
      uint32_t CreatureEvent::executeMoveItem2(Player* player, Item* item, uint8_t count, const Position& fromPos, const Position& toPos, Item* toContainer, Item* fromContainer, int16_t fstack) { //onMoveItem(cid, item, count, toContainer, fromContainer, fromPos, toPos) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(player->getPosition()); std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(player) << std::endl; env->streamThing(scriptstream, "item", item, env->addThing(item)); scriptstream << "local count = " << count << std::endl; env->streamThing(scriptstream, "toContainer", toContainer, env->addThing(toContainer)); env->streamThing(scriptstream, "fromContainer", fromContainer, env->addThing(fromContainer)); env->streamPosition(scriptstream, "fromPos", fromPos, fstack); env->streamPosition(scriptstream, "toPos", toPos, 0); scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ char desc[30]; sprintf(desc, "%s", player->getName().c_str()); env->setEvent(desc); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(player->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(player)); LuaScriptInterface::pushThing(L, item, env->addThing(item)); lua_pushnumber(L, count); LuaScriptInterface::pushThing(L, toContainer, env->addThing(toContainer)); LuaScriptInterface::pushThing(L, fromContainer, env->addThing(fromContainer)); LuaScriptInterface::pushPosition(L, fromPos, fstack); LuaScriptInterface::pushPosition(L, toPos, 0); bool result = m_interface->callFunction(7); m_interface->releaseEnv(); return result; } } else { std::clog << "[Error - CreatureEvent::executeMoveItem] Call stack overflow." << std::endl; return 0; } } uint32_t CreatureEvents::executeMoveItems(Creature* actor, Item* item, const Position& frompos, const Position& pos) { // fire global event if is registered for(CreatureEventList::iterator it = m_creatureEvents.begin(); it != m_creatureEvents.end(); ++it) { if(it->second->getEventType() == CREATURE_EVENT_MOVEITEM){ if(!it->second->executeMoveItem(actor,item,frompos,pos)) return 0; } } return 1; } uint32_t CreatureEvent::executeMoveItem(Creature* actor, Item* item, const Position& frompos, const Position& pos) { if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(pos); std::stringstream scriptstream; env->streamThing(scriptstream, "moveItem", item, env->addThing(item)); env->streamPosition(scriptstream, "position", frompos, 0); env->streamPosition(scriptstream, "position", pos, 0); scriptstream << "local cid = " << env->addThing(actor) << std::endl; scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ char desc[35]; sprintf(desc, "%s", player->getName().c_str()); env->setEventDesc(desc); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(pos); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); LuaScriptInterface::pushThing(L, item, env->addThing(item)); LuaScriptInterface::pushPosition(L, frompos, 0); LuaScriptInterface::pushPosition(L, pos, 0); lua_pushnumber(L, env->addThing(actor)); bool result = m_interface->callFunction(4); m_interface->releaseEnv(); return result; } } else { std::clog << "[Error - CreatureEvent::executeMoveItem] Call stack overflow." << std::endl; return 0; } } 2°  agora em creatureevetns.h
       
      Ache:
      CREATURE_EVENT_PREPAREDEATH, em baixo coloca:
      CREATURE_EVENT_MOVEITEM, CREATURE_EVENT_MOVEITEM2, ache:
      uint32_t executePrepareDeath(Creature* creature, DeathList deathList); em baixo coloca:
      uint32_t executeMoveItem(Creature* actor, Item* item, const Position& frompos, const Position& pos); uint32_t executeMoveItem2(Player* player, Item* item, uint8_t count, const Position& fromPos, const Position& toPos, Item* toContainer, Item* fromContainer, int16_t fstack); ache:
      bool playerLogout(Player* player, bool forceLogout); em baixo coloca:
      uint32_t executeMoveItems(Creature* actor, Item* item, const Position& frompos, const Position& pos);  
      3° agora em game.cpp
       
      ache:
      if(!canThrowObjectTo(mapFromPos, mapToPos) && !player->hasCustomFlag(PlayerCustomFlag_CanThrowAnywhere)) { player->sendCancelMessage(RET_CANNOTTHROW); return false; } ReturnValue ret = internalMoveItem(player, fromCylinder, toCylinder, toIndex, item, count, NULL); if(ret == RET_NOERROR) return true; player->sendCancelMessage(ret); return false; } troque por:
      if(!canThrowObjectTo(mapFromPos, mapToPos) && !player->hasCustomFlag(PlayerCustomFlag_CanThrowAnywhere)) { player->sendCancelMessage(RET_CANNOTTHROW); return false; } bool success = true; CreatureEventList moveitemEvents = player->getCreatureEvents(CREATURE_EVENT_MOVEITEM2); for(CreatureEventList::iterator it = moveitemEvents.begin(); it != moveitemEvents.end(); ++it) { Item* toContainer = toCylinder->getItem(); Item* fromContainer = fromCylinder->getItem(); if(!(*it)->executeMoveItem2(player, item, count, fromPos, toPos, (toContainer ? toContainer : 0), (fromContainer ? fromContainer : 0), fromStackpos) && success) success = false; } if(!success) return false; if(!g_creatureEvents->executeMoveItems(player, item, mapFromPos, mapToPos)) return false; ReturnValue ret = internalMoveItem(player, fromCylinder, toCylinder, toIndex, item, count, NULL); if(ret == RET_NOERROR) return true; player->sendCancelMessage(ret); return false; } Feito isso é só compilar sua source no modo REDUILD pra que as funções funcione.
       
       
      NO SERVIDOR:
       
      Agora no seu otserv vai em creturescripts, vai no arquivo login.lua e registra e event:
      registerCreatureEvent(cid, "MoveItem") registerCreatureEvent(cid, "MoveItem2") em creaturescript .xml
      <event type="moveitem" name="MoveItem" event="script" value="houseprotecao.lua"/> <event type="moveitem2" name="MoveItem2" event="script" value="moveitem2.lua"/> script do houseprotecao.lua "move item1
       
      function onMoveItem(moveItem, frompos, position, cid) if position.x == CONTAINER_POSITION then return true end local house = getHouseFromPos(frompos) or getHouseFromPos(position) --correção 100% if type(house) == "number" then local owner = getHouseOwner(house) if owner == 0 then return false, doPlayerSendCancel(cid, "Isso não é Possível.") end if owner ~= getPlayerGUID(cid) then local sub = getHouseAccessList(house, 0x101):explode("\n") local guest = getHouseAccessList(house, 0x100):explode("\n") local isInvited = false if (#sub > 0) and isInArray(sub, getCreatureName(cid)) then isInvited = true end if (#guest > 0) and isInArray(guest, getCreatureName(cid)) then isInvited = true end if not isInvited then return false, doPlayerSendCancel(cid, "Desculpe, você não está invitado.") end end end return true end script do moveitem2.lua "moveitem2
      local depottiles = {} --piso pra n jogar local depots = {2589} --id dos dps local group = 3 --id dos group 6 é todos. local function checkIfThrow(pos,topos) if topos.x == 0xffff then return false end local thing = getThingFromPos(pos) if isInArray(depottiles,thing.itemid) then if not isInArea(topos,{x=pos.x-1,y=pos.y-1,z=pos.z},{x=pos.x+1,y=pos.y+1, z=pos.z}) then return true end else for i = 1, #depots do if depots[i] == getTileItemById(topos,depots[i]).itemid or getTileInfo(topos).actionid == 7483 then return true end end end return false end function onMoveItem2(cid, item, count, toContainer, fromContainer, fromPos, toPos) if isPlayer(cid) then local pos = getThingPos(cid) if getPlayerGroupId(cid) > group then return true end if checkIfThrow({x=pos.x,y=pos.y,z=pos.z,stackpos=0},toPos) then doPlayerSendCancel(cid,"Não jogue item ai!!") doSendMagicEffect(getThingPos(cid),CONST_ME_POFF) return false end end return true end  
      OUTROS:
      bloquear item usando moveitem2
      if moveItem.itemid == IDDOITEM then doPlayerSendTextMessage(cid,25,'você bloqueou um item para não move no jogo!') return false end  
      ajudei?? REP+
       
      CRÉDITOS:
      @L3K0T
      Fir3element
      Summ
      Wise
      GOD Wille
       
       
      BUGs mesmo adicionado está jogando item em cima do depot, solta o puff de efeito mais não barra, bom isso pode ocorrer por questão de ter coisas adicionadas no game.cpp como o "push delay item" por exemplo e para resolver isso, tive que deixar assim.
       
       
      if(!canThrowObjectTo(mapFromPos, mapToPos) && !player->hasCustomFlag(PlayerCustomFlag_CanThrowAnywhere)) { player->sendCancelMessage(RET_CANNOTTHROW); return false; } // Anti-Push feature Prevention System by Xampy // /* Corrigido ElfBot Anti-Push (Anti-Crash) */ if(g_config.getBool(ConfigManager::ANTI_PUSH)){ //included by Yan Liima std::string antiPushItems = g_config.getString(ConfigManager::ANTI_PUSH_ITEMS); IntegerVec tmpVec = vectorAtoi(explodeString(antiPushItems, ",")); if(tmpVec[0] != 0){ for(IntegerVec::iterator it = tmpVec.begin(); it != tmpVec.end(); ++it){ if(item->getID() == uint32_t(*it) && player->hasCondition(CONDITION_EXHAUST, 1)){ player->sendTextMessage(MSG_STATUS_SMALL, "Please wait a few seconds to move this item."); return false; } } } } int32_t delay = g_config.getNumber(ConfigManager::ANTI_PUSH_DELAY); //by Yan Liima if(Condition* condition = Condition::createCondition(CONDITIONID_DEFAULT, CONDITION_EXHAUST, delay, 0, false, 1)) player->addCondition(condition); /* end */ bool success = true; CreatureEventList moveitemEvents = player->getCreatureEvents(CREATURE_EVENT_MOVEITEM2); for(CreatureEventList::iterator it = moveitemEvents.begin(); it != moveitemEvents.end(); ++it) { Item* toContainer = toCylinder->getItem(); Item* fromContainer = fromCylinder->getItem(); if(!(*it)->executeMoveItem2(player, item, count, fromPos, toPos, (toContainer ? toContainer : 0), (fromContainer ? fromContainer : 0), fromStackpos) && success) success = false; } if(!success) return false; if(!g_creatureEvents->executeMoveItems(player, item, mapFromPos, mapToPos)) return false; ReturnValue ret = internalMoveItem(player, fromCylinder, toCylinder, toIndex, item, count, NULL); if(ret == RET_NOERROR) return true; player->setNextAction(OTSYS_TIME() + g_config.getNumber(ConfigManager::ACTIONS_DELAY_INTERVAL) - 10); return true; player->sendCancelMessage(ret); return false; } // Anti-Push feature Prevention System by Xampy //  
    • Por Ghaz
      Fala pessoal tudo bem?
       
      Estou com dificuldades em um script e preciso da ajuda dos magos do LUA rs.
       
      Tenho um script que quando o player morre (onDeath), ele faz algumas coisas e depois ele chama uma função que deveria retornar uma table (array) para eu fazer o for com o ipairs certinho. Segue abaixo o código:
       
       
      Segue abaixo a função getPlayersInArea:
       
       
      Acontece que no código de cima (do primeiro spoiler) eu dou um print no retorno da função getPlayersInArea, porém ela não tá me retornando a table, tá me retornando só: 2
       
       
       
      Alguém consegue me ajudar em, como raios eu faço a função retornar a lista de players ao invés da quantidade? Acredito que ta retornando o count da table, e não os itens do array.
       
       
      Agradeço desde já, valeu tchurma!
    • Por sannn
      --[[ /////////////////////////////////////////////////////////////////////////////////////////////////////// Discord: San#7791 -- Loja System 2.0 -- TFS 0.3.6 -- para adicionar qualquer item na loja: basta adicionar na tabelinha, seguindo o exemplo do vip! valor = quantidade de DIAMOND a ser cobrada; itemID = item a ser recebido; quantidade = quantidade de itens a ser recebidos; msg = mensagem que o player vai receber após comprar! Feito por San Discord: San#7791 exemplo de como comprar: !loja vip podendo ser adicionado a modules também. tag talkactions.xml // <talkaction words="!loja" case-sensitive="no" event="script" value="Loja System 2.0.lua"/> ////////////////////////////////////////////////////////////////////////////////////////////////////// depois de tantos sistemas com mil elseifs, vim trazer esta contribuição simples, para facilitar a vida de muitos adms! Contribuição pra comunidade =D ]]-- LOJA_CANCEL = "Você não possui diamantes o suficiente." LOJA_INVALID = "Não temos este item a venda na loja!" INVALID = "Comando incorreto" DIAMOND = 2145 -- item que será cobrado; tabelinha = { ["vip"] = {valor = 5, itemID = 2160, quantidade = 1, msg = "Obrigado por comprar um VIP em nossa loja!"}, -- coloque sempre minusculo o nome ! ["vip"]... etc } function onSay(cid, words, param, channel) local msg = string.lower(param) -- Não mexa! if msg == "" then doPlayerSendTextMessage(cid, 22, INVALID) return true end -- verificação if tabelinha[msg] == nil then doPlayerSendTextMessage(cid, 22, INVALID) return true end -- verificação if tabelinha[msg].valor then if getPlayerItemCount(cid, DIAMOND) >= tabelinha[msg].valor then doPlayerRemoveItem(cid, DIAMOND, tabelinha[msg].valor) doPlayerAddItem(cid, tabelinha[msg].itemID, tabelinha[msg].quantidade) doPlayerSendTextMessage(cid, 20, tabelinha[msg].msg) else doPlayerSendTextMessage(cid, 22, LOJA_CANCEL) return true end else doPlayerSendTextMessage(cid, 22, LOJA_INVALID) end return true end  
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo