Tudo que zipter98 postou
-
(Resolvido)Ajuda com porta automática
Troque o código por este, teste novamente e informe os números que aparecerão no console. Gostaria de confirmar onde exatamente está o erro. local config = { delay = 400, --Intervalo de tempo entre as "transformações" da porta, em milésimos. door = {621, xxx, 605}, --{ID da porta fechada, ID da porta aberta pela metade, ID da porta aberta}, ids = { [2701] = { --[action_id] = { {x = 1056, y = 1053, z = 7}, --Posições das portas. {x = 1053, y = 1053, z = 7}, }, }, } function onStepIn(cid, item, position, fromPosition) if config.ids[item.actionid] then for _, pos in pairs(config.ids[item.actionid]) do if getTileItemById(pos, config.door[1]).uid > 0 then for i = 1, 2 do addEvent(function() doTransformItem(getTileItemById(pos, i == 1 and config.door[1] or config.door[2]).uid, config.door[i + 1]) end, i * config.delay) end end end end return true end function onStepOut(cid, item, position, fromPosition) if config.ids[item.actionid] then for _, pos in pairs(config.ids[item.actionid]) do local it = getTileItemById(pos, config.door[3]).uid if it > 0 then print(1) if getSpectators(pos, 1, 1) then print(2) return true end end end for _, pos in pairs(config.ids[item.actionid]) do if getTileItemById(pos, config.door[3]).uid > 0 then print(3) for i = 1, 2 do addEvent(function() doTransformItem(getTileItemById(pos, i == 1 and config.door[3] or config.door[2]).uid, config.door[i == 1 and 2 or 1]) end, i * config.delay) end end end end return true end Sobre a reputação, não é necessária. Estou lhe ajudando por prazer, não por interesse.
-
(Resolvido)Ajuda com porta automática
Estranho, testei aqui e funcionou perfeitamente. Caso não haja ninguém em volta da porta, ela se fechará (assim como no vídeo que a PxG demonstra este "sistema"). Talvez seja isso.
-
(Resolvido)Ajuda com porta automática
Por padrão, coloquei um intervalo de 400 milésimos entre as "transformações" da porta. Caso este tempo não lhe agrade, basta mudá-lo onde foi indicado no código. local config = { delay = 400, --Intervalo de tempo entre as "transformações" da porta, em milésimos. door = {621, xxx, 605}, --{ID da porta fechada, ID da porta aberta pela metade, ID da porta aberta}, ids = { [2701] = { --[action_id] = { {x = 1056, y = 1053, z = 7}, --Posições das portas. {x = 1053, y = 1053, z = 7}, }, }, } function onStepIn(cid, item, position, fromPosition) if config.ids[item.actionid] then for _, pos in pairs(config.ids[item.actionid]) do if getTileItemById(pos, config.door[1]).uid > 0 then for i = 1, 2 do addEvent(function() doTransformItem(getTileItemById(pos, i == 1 and config.door[1] or config.door[2]).uid, config.door[i + 1]) end, i * config.delay) end end end end return true end function onStepOut(cid, item, position, fromPosition) if config.ids[item.actionid] then for _, pos in pairs(config.ids[item.actionid]) do local it = getTileItemById(pos, config.door[3]).uid if it > 0 then if getSpectators(pos, 1, 1) then return true end end end for _, pos in pairs(config.ids[item.actionid]) do if getTileItemById(pos, config.door[3]).uid > 0 then for i = 1, 2 do addEvent(function() doTransformItem(getTileItemById(pos, i == 1 and config.door[3] or config.door[2]).uid, config.door[i == 1 and 2 or 1]) end, i * config.delay) end end end end return true end
-
(Resolvido)Ajuda com porta automática
O actionid você coloca nos tiles, não na porta. E obviamente vai dar erro, você esqueceu de configurar o actionid no index da tabela ids. Troque: [actionid] = { por: [2701] = {
-
[PEDIDO] Script com pedido de Storage
local config = { money = 1000, -- Dinheiro que vai custar item = 7618, -- ID do item que vai vender count = 20, -- Quantidade storage = 43560, } function onUse(cid, item, fromPosition, itemEx, toPosition) local pos = getCreaturePosition(cid) if item.itemid == 1945 then if getPlayerStorageValue(cid, config.storage) > -1 then if doPlayerRemoveMoney(cid, config.money) then doPlayerAddItem(cid, config.item, config.count) doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Você acaba de comprar "..config.count.." "..getItemNameById(config.item)..".") doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE) else doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Desculpe, mais você nao tem dinheiro suficiente.") doSendMagicEffect(pos, CONST_ME_POFF) end else return doPlayerSendCancel(cid, "Você não completou a quest.") end end return true end
-
(Resolvido)Ajuda com porta automática
É essa parte que você citou que falta configurar. Se deu erro, é porque você fez alguma coisa errada. ;s E cada actionid representa 2 posições diferentes. Se todos estes que você colocou na tag forem para a mesma posição, recomendo deixar apenas um. Exemplo de como a tabela ficaria com 3 actionids: ids = { [2701] = { --[action_id] = { {x = 1056, y = 1053, z = 7}, --Posições das portas. {x = 1053, y = 1053, z = 7}, }, [2702] = { --[action_id] = { {x = 1410, y = 1540, z = 7}, --Posições das portas. {x = 1411, y = 1540, z = 7}, }, [2703] = { --[action_id] = { {x = 1781, y = 1150, z = 7}, --Posições das portas. {x = 1783, y = 1150, z = 7}, }, },
-
(Resolvido)Ajuda com porta automática
Você coloca o action ID nos tiles que os jogadores pisarão para a porta ser transformada. local config = { door = {xxx, xxx}, --{ID da porta fechada, ID da porta aberta}, ids = { [actionid] = { --[action_id] = { {x = x, y = y, z = z}, --Posições das portas. {x = x, y = y, z = z}, }, }, } function onStepIn(cid, item, position, fromPosition) if config.ids[item.actionid] then for _, pos in pairs(config.ids[item.actionid]) do local it = getTileItemById(pos, config.door[1]).uid if it > 0 then doTransformItem(it, config.door[2]) end end end return true end function onStepOut(cid, item) if config.ids[item.actionid] then for _, pos in pairs(config.ids[item.actionid]) do local it = getTileItemById(pos, config.door[2]).uid if it > 0 then if getSpectators(pos, 1, 1) then return true end end end for _, pos in pairs(config.ids[item.actionid]) do local it = getTileItemById(pos, config.door[2]).uid if it > 0 then doTransformItem(it, config.door[1]) end end end return true end Tags: <movevent type="StepIn" actionid="xxx" event="script" value="nome_do_arquivo.lua"/> <movevent type="StepOut" actionid="xxx" event="script" value="nome_do_arquivo.lua"/> Não se esqueça de substituir o xxx pelo(s) actionid(s). Para adicionar mais actionids na tag, basta separá-los por ; (ponto e vírgula). Ex.: <movevent type="StepIn" actionid="1234;1278;6091" event="script" value="nome_do_arquivo.lua"/> <movevent type="StepOut" actionid="1234;1278;6091" event="script" value="nome_do_arquivo.lua"/>
- Tópico do quote
-
[Pedido] Salario para Tutores
Seria melhor fazer isso por globalevent. Caso, por exemplo, um tutor não tenha condições de logar no dia do pagamento, seria uma tremenda injustiça ganhar os premium points apenas no próximo mês. Supondo que seu sistema de pontos seja igual ao citado pelo Lyon, escrevi este pequeno código que, à 00:00 de todo dia 1º, os tutores do servidor recebam uma quantidade configurável de premium points. local config = { tutorId = 3, --Group ID do tutor. day = "1", --Dia do mês que receberá o salário. pPoints = xxx, --Premium points. } function onTime() if os.date("%d") == config.day then local tutors = db.getResult("SELECT account_id FROM players WHERE group_id = "..config.tutorId) if tutors:getID() ~= -1 then repeat db.executeQuery("UPDATE accounts SET premium_points = premium_points + "..config.pPoints.." WHERE id = "..tutors:getDataInt("account_id")) until not tutors:next() tutors:free() end end return true end Tag: <globalevent name="Salary" time="00:00" event="script" value="nome_do_arquivo.lua"/>
-
Dúvida CreatureScript EXP
local function playerAddExp(cid, exp) doPlayerAddExp(cid, exp) doSendAnimatedText(getThingPos(cid), exp, 215) end function onDeath(cid, corpse, deathList) --if not isCreature(cid) then return true end if isSummon(cid) or not deathList or getCreatureName(cid) == "Evolution" then return true end --alterado v1.8 -------------Edited Golden Arena------------------------- --alterado v1.7 \/\/ if getPlayerStorageValue(cid, 22546) == 1 then setGlobalStorageValue(22548, getGlobalStorageValue(22548)-1) if corpse.itemid ~= 0 then doItemSetAttribute(corpse.uid, "golden", 1) end --alterado v1.8 end if getPlayerStorageValue(cid, 22546) == 1 and getGlobalStorageValue(22548) == 0 then local wave = getGlobalStorageValue(22547) for _, sid in ipairs(getPlayersOnline()) do if isPlayer(sid) and getPlayerStorageValue(sid, 22545) == 1 then if getGlobalStorageValue(22547) < #wavesGolden+1 then doPlayerSendTextMessage(sid, 20, "Wave "..wave.." will begin in "..timeToWaves.."seconds!") doPlayerSendTextMessage(sid, 28, "Wave "..wave.." will begin in "..timeToWaves.."seconds!") addEvent(creaturesInGolden, 100, GoldenUpper, GoldenLower, false, true, true) addEvent(doWave, timeToWaves*1000) elseif getGlobalStorageValue(22547) == #wavesGolden+1 then doPlayerSendTextMessage(sid, 20, "Você foi o último sobrevivente da Golden arena tome sua recompensa!") doPlayerAddItem(sid, 2152, getPlayerStorageValue(sid, 22551)*2) --premio setPlayerStorageValue(sid, 22545, -1) doTeleportThing(sid, getClosestFreeTile(sid, posBackGolden), false) setPlayerRecordWaves(sid) end end end if getGlobalStorageValue(22547) == #wavesGolden+1 then endGoldenArena() end end --------------------------------------------------- /\/\ local givenexp = getWildPokemonExp(cid) ---local killer = getItemAttribute(corpse.uid, "corpseowner") if givenexp > 0 then for a = 1, #deathList do local pk = deathList[a] --- local list = getSpectators(getThingPosWithDebug(pk), 30, 30, false) if isCreature(pk) then local expTotal = math.floor(givenexp * getDamageMapPercent(pk, cid)) local party = getPartyMembers(pk) if isInParty(pk) and getPlayerStorageValue(pk, 4875498) <= -1 then expTotal = math.floor(expTotal/#party) --alterado v1.6.1 for i = 1, #party do if isInArray(list, party[i]) then playerAddExp(party[i], expTotal * 3 * (isPremium(party[i]) and 1.5 or 1)) end end end elseif not isInParty(pk) then playerAddExp(pk, math.floor(3 * givenexp * getDamageMapPercent(pk, cid) * (isPremium(pk) and 1.5 or 1))) end end end end if isNpcSummon(cid) then local master = getCreatureMaster(cid) doSendMagicEffect(getThingPos(cid), getPlayerStorageValue(cid, 10000)) doCreatureSay(master, getPlayerStorageValue(cid, 10001), 1) doRemoveCreature(cid) return false end if corpse.itemid ~= 0 then --alterado v1.8 doItemSetAttribute(corpse.uid, "level", getPokemonLevel(cid)) doItemSetAttribute(corpse.uid, "gender", getPokemonGender(cid)) end return true end
-
NPC "Pather" (não sou bom com nomes)
Provavelmente o número de passos que o NPC daria até chegar neste destino mais longo supera 50. Troque: local path = getCreaturePathTo(getNpcCid(), config.places[place], 50) para: local path = getCreaturePathTo(getNpcCid(), config.places[place], 250) E mude: path = getCreaturePathTo(npc, npcPos, 50) para: path = getCreaturePathTo(npc, npcPos, 250) Assim, o valor máximo de passos será 250.
- NPC "Pather" (não sou bom com nomes)
-
Usar comando 1x na conta
Storages globais são resetadas quando o servidor é reiniciado. Uma das inúmeras opções para fazer isso é usando as funções disponibilizadas neste tópico.
-
(Resolvido)NPC de teleport
local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onThink() npcHandler:onThink() end function onCreatureSay(cid, type, msg) local toPos = {x = x, y = y, z = z} --Para onde o jogador será teleportado. selfSay("Suma daqui!") doTeleportThing(cid, toPos) return true end npcHandler:addModule(FocusModule:new())
- (Resolvido)Script com problema
- (Resolvido)Evoluir Pokemon Com Talkaction
- (Resolvido)Evoluir Pokemon Com Talkaction
-
(Resolvido)Evoluir Pokemon Com Talkaction
Claro. local evolutions = { --["Pokemon_name"] = "Evolution_name", ["Alakazam"] = "Mega Alakazam", } local effect = xxx --Animação/efeito. function onSay(cid, words) if #getCreatureSummons(cid) > 0 then local poke = getCreatureSummons(cid)[1] if evolutions[getCreatureName(poke)] then local position, lookDir, pokeName = getThingPos(poke), getCreatureLookDirection(poke), getCreatureName(poke) doPlayerSendTextMessage(cid, 27, "Your "..pokeName.." transformed into a "..evolutions[pokeName].."!") doRemoveCreature(poke) doSummonMonster(cid, evolutions[pokeName]) local newPoke = getCreatureSummons(cid)[1] doTeleportThing(newPoke, position) doSendMagicEffect(position, effect) doCreatureSetLookDir(newPoke, lookDir) adjustStatus(newPoke, getPlayerSlotItem(cid, 8).uid, true, false) else return doPlayerSendCancel(cid, "This pokemon can't transform.") end else return doPlayerSendCancel(cid, "You do not have summons.") end return true end
- (Resolvido)Invasao diferente
- (Resolvido)Evoluir Pokemon Com Talkaction
- (Resolvido)Evoluir Pokemon Com Talkaction
-
(Resolvido)[Pedido 2 Scripts] Double ex por x player online e /anuncio.
Double loot você pode fazer em lua por gambiarra ou com algumas modificações nas sources (C++). Talvez mais tarde eu atualize o código com isso. data/creaturescripts/scripts: local config = { count = 100, --Número mínimo de jogadores online para ter double experience. rate = 2.0, --Rate de EXP. storage = 4091, } function onLogin(cid) if getGlobalStorageValue(config.storage) < 1 then if #getPlayersOnline() >= config.count then broadcastMessage(config.count.." jogadores online! Double experience ativada!") setGlobalStorageValue(config.storage, 1) for _, pid in pairs(getPlayersOnline()) do doPlayerSetExperienceRate(pid, config.rate) end end else doPlayerSetExperienceRate(cid, config.rate) end return true end function onLogout(cid) if getGlobalStorageValue(config.storage) > -1 then if #getPlayersOnline() - 1 < config.count then broadcastMessage("A double experience foi desativada. :/") setGlobalStorageValue(config.storage, -1) for _, pid in pairs(getPlayersOnline()) do doPlayerSetExperienceRate(pid, 1.0) end end end return true end Tags: <event type="login" name="ExpLogin" event="script" value="nome_do_arquivo.lua"/> <event type="logout" name="ExpLogout" event="script" value="nome_do_arquivo.lua"/>
-
(Resolvido)Evoluir Pokemon Com Talkaction
Se for base PDA: local evolutions = { --["Pokemon_name"] = "Evolution_name", ["Alakazam"] = "Mega Alakazam", } function onSay(cid, words) if #getCreatureSummons(cid) > 0 then local poke = getCreatureSummons(cid)[1] if evolutions[getCreatureName(poke)] then local position, lookDir, pokeName = getThingPos(poke), getCreatureLookDirection(poke), getCreatureName(poke) doPlayerSendTextMessage(cid, 27, "Your "..pokeName.." transformed into a "..evolutions[pokeName].."!") doRemoveCreature(poke) doSummonMonster(cid, evolutions[pokeName]) local newPoke = getCreatureSummons(cid)[1] doTeleportThing(newPoke, position) doCreatureSetLookDir(newPoke, lookDir) adjustStatus(newPoke, getPlayerSlotItem(cid, 8).uid, true, false) else return doPlayerSendCancel(cid, "This pokemon can't transform.") end else return doPlayerSendCancel(cid, "You do not have summons.") end return true end Coloquei apenas o que você pediu.
-
(Resolvido)[AJUDA] Alavanca com 2 funçoes.
Tipo assim? local config = { stoneId = xxx, --ID da pedra que aparecerá. toPosition = {x = x, y = y, z = z}, --Para onde o jogador será teleportado. } function onUse(cid, item) doPlayerSendTextMessage(cid, 27, "You were teleported.") doCreateItem(config.stoneId, 1, getThingPos(cid)) doTeleportThing(cid, config.toPosition) doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945) return true end
- (Resolvido)Porta que só abre com certo Item (Pokemon)