Ir para conteúdo

zipter98

Membro
  • Registro em

  • Última visita

Solutions

  1. zipter98's post in (Resolvido)[PEDIDO] Uma arma, várias munições. was marked as the answer   
    local ar1 = createCombatArea{     {0, 0, 0, 0, 0, 0, 0},     {0, 0, 0, 0, 0, 0, 0},     {0, 0, 1, 1, 1, 0, 0},     {0, 0, 1, 3, 1, 0, 0},     {0, 0, 1, 1, 1, 0, 0},     {0, 0, 0, 0, 0, 0, 0},     {0, 0, 0, 0, 0, 0, 0} } local ar2 = createCombatArea{     {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},     {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},     {0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},     {0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},     {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},     {1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1},     {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},     {0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},     {0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},     {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},     {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0} } local ar3 = createCombatArea{     {0, 0, 0, 0, 0, 0, 0, 0, 0},     {0, 0, 0, 0, 0, 0, 0, 0, 0},     {0, 0, 0, 1, 1, 1, 0, 0, 0},     {0, 0, 1, 1, 1, 1, 1, 0, 0},     {0, 0, 1, 1, 3, 1, 1, 0, 0},     {0, 0, 1, 1, 1, 1, 1, 0, 0},     {0, 0, 0, 1, 1, 1, 0, 0, 0},     {0, 0, 0, 0, 0, 0, 0, 0, 0},     {0, 0, 0, 0, 0, 0, 0, 0, 0} }   function doPlayerShootBazooka(cid, target, times, delay, area, min, max, effect, dist_effect, exhaust, rounds)     if rounds == nil then rounds = 1 end     exhaustion.set(cid, 57193, exhaust)     doSendDistanceShoot(getCreaturePosition(cid), getThingPos(target), dist_effect)     doAreaCombatHealth(cid, COMBAT_FIREDAMAGE, getThingPos(target), area, -min, -max, effect)     if rounds == times then         return true     end     addEvent(doPlayerShootBazooka, shots_delay, cid, target, times, delay, area, min, max, effect, dist_effect, exhaust, rounds+1) end   function onUse(cid, item, fromPosition, itemEx, toPosition)     local weapons = { -- [ID da arma] = {tiros, delay_dos_tiros, ammo, area, dano_min, dano_max, efeito, distance_effect, exhaustion},         [2449] = {             shots = 1,             shots_delay = 50,              area = ar1,             exha = 5,             ammo = {                 --Configure aqui as munições da arma.                 [11399] = {min = 25600, max = 35720, effect = 23, dist_effect = 35},                 [itemid] = {min = minDamage, max = maxDamage, effect = effect, dist_effect = distanceEffect},                 [itemid] = {min = minDamage, max = maxDamage, effect = effect, dist_effect = distanceEffect},                 [itemid] = {min = minDamage, max = maxDamage, effect = effect, dist_effect = distanceEffect},             },         },     }     local gun = weapons[item.itemid]          if gun then         if getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid ~= item.itemid then             doPlayerSendCancel(cid, "O lançador deve estar equipado no slot da arma.") return true         elseif getPlayerStorageValue(cid, 18391) == 1 then             doPlayerSendCancel(cid, "Você não pode atirar enquanto dirige.") return true         elseif getPlayerStorageValue(cid, 18393) == 1 then             doPlayerSendCancel(cid, "Você não pode atirar com o capacete.") return true         elseif exhaustion.check(cid, 57193) then             doPlayerSendCancel(cid, "Você está exausto.") return true         elseif getPlayerSlotItem(cid, CONST_SLOT_AMMO).uid < 1 then             return doPlayerSendCancel(cid, "A munição deve estar equipada no slot da munição.")         elseif not gun.ammo[getPlayerSlotItem(cid, CONST_SLOT_AMMO).itemid] then             return doPlayerSendCancel(cid, "Wrong ammo for this gun.")         elseif getPlayerItemCount(cid, getPlayerSlotItem(cid, CONST_SLOT_AMMO).itemid) < gun.shots then             doPlayerSendCancel(cid, "Você não possui munição.") return true         end         local ammo = gun.ammo[getPlayerSlotItem(cid, CONST_SLOT_AMMO).itemid]         doPlayerRemoveItem(cid, getPlayerSlotItem(cid, CONST_SLOT_AMMO).itemid, gun.shots)          doPlayerShootBazooka(cid, itemEx.uid, gun.shots, gun.shots_delay, gun.area, ammo.min, ammo.max, ammo.effect, ammo.dist_effect, gun.exha)     end     return true end
  2. zipter98's post in (Resolvido)O que tem de errado? was marked as the answer   
    local mounts = {     --[itemid] = {name = "monster", storage = storage, mountId = xxx, chance = xxx},      [13937] = {name = "donkey", storage = 5918, mountId = 13, chance = 50},        --Sendo a chance (de funcionar) em porcentagem. } function onUse(cid, item, frompos, itemEx, topos)     local target = mounts[item.itemid]     if target then         if getPlayerStorageValue(cid, target.storage) > -1 then             return doPlayerSendTextMessage(cid, 19, "Sorry, you already have that ride.")         elseif not isMonster(itemEx.uid) then             return doPlayerSendCancel(cid, "Use this in a monster.")         elseif getCreatureName(itemEx.uid):lower() ~= target.name then             return doPlayerSendCancel(cid, "Use this in "..target.name..".")         end         if math.random(1, 100) <= target.chance then             doPlayerAddMount(cid, target.mountId)             doRemoveCreature(itemEx.uid)             doPlayerSendTextMessage(cid, 19, "The strange wheel seems to vibrate and slowly starts turning continuosly.")             setPlayerStorageValue(cid, target.mountId, 1)         else             doPlayerSendCancel(cid, "Fail!")             doRemoveItem(item.uid, 1)         end     end     return true end
  3. zipter98's post in (Resolvido)[Pedido 2 Scripts] Double ex por x player online e /anuncio. was marked as the answer   
    Use este código e informe tudo o que for imprimido no console.
    PS: Não se esqueça de reiniciar o servidor.
    local function playerAddExp(cid, exp) print("EXP adicionada: "..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)) print("EXP sem bonus: "..expTotal) if getGlobalStorageValue(4091) > -1 then print("Bonus ativado.") expTotal = math.floor(expTotal * getGlobalStorageValue(4091)) print("Nova EXP: "..expTotal) end 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 if getPlayerLevel(pk) <= 50 then playerAddExp(party[i], expTotal * 200) elseif getPlayerLevel(pk) >= 51 and getPlayerLevel(pk) <= 75 then playerAddExp(party[i], expTotal * 130) elseif getPlayerLevel(pk) >= 76 and getPlayerLevel(pk) <= 100 then playerAddExp(party[i], expTotal * 80) elseif getPlayerLevel(pk) >= 101 and getPlayerLevel(pk) <= 150 then playerAddExp(party[i], expTotal * 40) elseif getPlayerLevel(pk) >= 151 and getPlayerLevel(pk) <= 250 then playerAddExp(party[i], expTotal * 20) elseif getPlayerLevel(pk) >= 251 and getPlayerLevel(pk) <= 350 then playerAddExp(party[i], expTotal * 10) elseif getPlayerLevel(pk) >= 351 then playerAddExp(party[i], expTotal * 5) end end end elseif not isInParty(pk) then print("Adicionando EXP: "..expTotal) if getPlayerLevel(pk) <= 50 then playerAddExp(pk, math.floor(200 * expTotal)) elseif getPlayerLevel(pk) >= 51 and getPlayerLevel(pk) <= 75 then playerAddExp(pk, math.floor(130 * expTotal)) elseif getPlayerLevel(pk) >= 76 and getPlayerLevel(pk) <= 100 then playerAddExp(pk, math.floor(80 * expTotal)) elseif getPlayerLevel(pk) >= 101 and getPlayerLevel(pk) <= 150 then playerAddExp(pk, math.floor(40 * expTotal)) elseif getPlayerLevel(pk) >= 151 and getPlayerLevel(pk) <= 250 then playerAddExp(pk, math.floor(20 * expTotal)) elseif getPlayerLevel(pk) >= 251 and getPlayerLevel(pk) <= 350 then playerAddExp(pk, math.floor(10 * expTotal)) elseif getPlayerLevel(pk) >= 351 then playerAddExp(pk, math.floor(5 * expTotal)) return true end 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
  4. zipter98's post in (Resolvido)Medal of Honour was marked as the answer   
    local medalId = xxx                          --ID da Medal of Honour. local toPosition = {x = x, y = y, z = z}     --Para onde o jogador será teleportado. function getItemsInContainerById(container, itemid) -- Function By Kydrai     local items = {}     if isContainer(container) and getContainerSize(container) > 0 then         for slot=0, (getContainerSize(container)-1) do             local item = getContainerItem(container, slot)             if isContainer(item.uid) then                 local itemsbag = getItemsInContainerById(item.uid, itemid)                 for i=0, #itemsbag do                     table.insert(items, itemsbag[i])                 end             else                 if itemid == item.itemid then                     table.insert(items, item.uid)                 end             end         end     end     return items end function onUse(cid)     if #getItemsInContainerById(getPlayerSlotItem(cid, 3).uid, medalId) < 1 then         local medalCheck         for i = 1, 10 do             if getPlayerSlotItem(cid, i).itemid == medalId then                 medalCheck = true                 break             end         end         if not medalCheck then             return doPlayerSendCancel(cid, "You can't pass here without a "..getItemNameById(medalId)..".")         end     end     doTeleportThing(cid, toPosition)     return true end
  5. zipter98's post in (Resolvido)Spell sumon por level was marked as the answer   
    Se não se importa, escrevi uma versão deste script mais simplificada e de melhor manipulação.
    PS: Resolvi postá-la apenas para demonstrar uma outra maneira de escrever o mesmo código, não para remover os créditos do Stinger.
    local config = {     maxSummons = 1,         --Limite de summons.     summons = {         [25] = "Rat",       --[level] = "summon",         [50] =  "Dragon",         [75] =  "Dragon Lord",         [100] =  "Demon",     }, } function onCastSpell(cid)     if #getCreatureSummons(cid) < config.maxSummons then         local summon         for level, summonName in pairs(config.summons) do             if getPlayerLevel(cid) >= level then                 summon = summonName             end         end         if summon then             doConvinceCreature(cid, doSummonCreature(summon, getThingPos(cid)))             doCreatureSay(getCreatureSummons(cid)[#getCreatureSummons(cid)], "Cheguei", TALKTYPE_ORANGE_1)         end     else         doSendMagicEffect(getThingPos(cid), 12)         doPlayerSendTextMessage(cid, 19, "Voce so pode invocar "..config.maxSummons.." summons.")     end     return true end
  6. zipter98's post in (Resolvido)[Pedido] Recompensa Diferente was marked as the answer   
    local config = {     storage = 5820,     levels = {         [20] = {                                  --[level] = {             [1] = {itemid, itemid, itemid, ...},  --[vocation_id] = {items},         },         [40] = {                                  --[level] = {             [1] = {itemid, itemid, itemid, ...},  --[vocation_id] = {items},         },     }, } function onAdvance(cid, skill, oldLevel, newLevel)     local level     for prizeLevel, prizes in pairs(config.levels) do         if newLevel >= prizeLevel and getPlayerStorageValue(cid, config.storage + prizeLevel) < 1 then             level = prizeLevel             break         end     end     if level then         local set = config.levels[level][getPlayerVocation(cid)]         if set then             local parcel, str = doCreateItemEx(ITEM_PARCEL), ""             for i = 1, #set do                 if str == "" then                     str = "1x "..getItemNameById(set[i])                 else                     str = str..(i == #set and " e " or ", ").."1x "..getItemNameById(set[i])                 end                 doAddContainerItem(parcel, set[i], 1)             end             doPlayerSendMailByName(getCreatureName(cid), parcel, 1)             setPlayerStorageValue(cid, config.storage, 1)             doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Graças a sua determinação em atingir o level "..newLevel..", você foi premiado com "..str..". Um parcel foi enviado ao depot de sua cidade principal.")         end     end     return true end Testei o código em meu servidor, e está funcionando perfeitamente.
  7. zipter98's post in (Resolvido)[AJUDA] Preciso de ajuda nesse script was marked as the answer   
    Troque:
    setGlobalStorageValue(984, storage + 1) por:
    setGlobalStorageValue(984, storage984 + 1)
  8. zipter98's post in (Resolvido)systema pokemon boss was marked as the answer   
    data/globalevents/scripts:
    local config = { time = 2, --Tempo, em horas, para o monstro nascer. name = "Regigigas", --Nome do monstro. position = {x = x, y = y, z = z}, --Posição onde o monstro irá nascer. } function onStartup() addEvent(function() doCreateMonster(config.name, config.position) broadcastMessage(config.name.." spawned!") end, config.time * 60 * 60 * 1000) return true end Tag:
    <globalevent name="mSpawn" type="startup" event="script" value="nome_do_arquivo.lua"/> data/creaturescripts/scripts:
    local config = { time = 2, --Tempo, em horas, para o monstro nascer. name = "Regigigas", --Nome do monstro. position = {x = x, y = y, z = z}, --Posição onde o monstro irá nascer. } function onDeath(cid) if getCreatureName(cid) == config.name then addEvent(function() doCreateMonster(config.name, config.position) broadcastMessage(config.name.." spawned!") end, config.time * 60 * 60 * 1000) end return true end Tag:
    <event type="death" name="mDeath" event="script" value="nome_do_arquivo.lua"/> Registre no arquivo .XML do monstro:
    <script> <event name="mDeath"/> </script>
  9. zipter98's post in (Resolvido)[Ajuda] Storage dos teleports was marked as the answer   
    Unique IDs da tabela teleports + 100 (se o UID for inferior a 14500).
  10. zipter98's post in (Resolvido)Systema !Fly [PokeTibia] was marked as the answer   
    local configuration = {     storage = 918311,     fly_storage = 17000,    --Storage do Fly no seu servidor. } function isWalkable(pos, creature, proj, pz)-- by Nord     if getTopCreature(pos).uid > 0 and creature then return false end     if getTileInfo(pos).protection and pz then return false, true end     local n = not proj and 3 or 2     for i = 0, 255 do         pos.stackpos = i         local tile = getTileThingByPos(pos)         if tile.itemid ~= 0 and not isCreature(tile.uid) then             if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then                 return false             end         end     end     return true end   function autoWalk(cid, id)     if not isCreature(cid) then          if id then             return db.executeQuery("UPDATE player_storage SET value = -1 WHERE key = 918311 AND player_id = "..id)         end     elseif getPlayerStorageValue(cid, configuration.storage) < 1 then         return true     end     local topos = getPosByDir(getThingPos(cid), getCreatureLookDir(cid))     if topos then         if getPlayerStorageValue(cid, configuration.storage) < 1 or getPlayerStorageValue(cid, configuration.fly_storage) < 1 then             if getPlayerStorageValue(cid, configuration.fly_storage) < 1 then                 setPlayerStorageValue(cid, configuration.storage, -1)             end             return true         elseif isWalkable(topos) then             if getTileThingByPos({x = topos.x, y = topos.y, z = topos.z, stackpos = 0}).itemid == 0 then                 doCombatAreaHealth(cid, 0, topos, 0, 0, 0, CONST_ME_NONE)                 doCreateItem(11676, 1, topos)             end             doTeleportThing(cid, topos)         else             setPlayerStorageValue(cid, configuration.storage, -1)             doPlayerSendTextMessage(cid, 27, "Há algum objeto à sua frente impedindo a passagem.")             doPlayerSetNoMove(cid, false)             return true         end     else         doPlayerSendCancel(cid, "Sorry, not possible.")         setPlayerStorageValue(cid, configuration.storage, -1)         doPlayerSetNoMove(cid, false)         return true     end     addEvent(autoWalk, 500, cid, id) end function onSay(cid, words)     if getPlayerStorageValue(cid, configuration.fly_storage) < 1 then         doPlayerSendCancel(cid, "Para usar este comando, você deve estar em Fly.")     elseif getPlayerStorageValue(cid, configuration.storage) >= 1 then         setPlayerStorageValue(cid, configuration.storage, -1)         doPlayerSendTextMessage(cid, 27, "Comando !fly desativado.")         doPlayerSetNoMove(cid, false)     else         doPlayerSendTextMessage(cid, 27, "Comando !fly ativado.")         setPlayerStorageValue(cid, configuration.storage, 1)         doPlayerSetNoMove(cid, true)         autoWalk(cid, getPlayerGUID(cid))     end     return true end Em data/actions/scripts, order.lua: Abaixo de: doCreatureSay(cid, ""..getPokeName(getCreatureSummons(cid)[1])..", let me get down!", 1) adicione: doPlayerSetNoMove(cid, false) Escrevi este código há mais de 1 ano, mas suponho que ainda funcione como deve.
  11. zipter98's post in (Resolvido)[Resolvido] [Pedido] Sistema de potion que heala na hora. was marked as the answer   
    local potions = {     --[potion_id] = percent,           [12347] = 30,     [12348] = 60, } function onUse(cid, item, fromPosition, itemEx, toPosition)     if not isCreature(itemEx.uid) or not isSummon(itemEx.uid) then         return doPlayerSendCancel(cid, "Voce so pode usar potion em Pokemon's!")     elseif getCreatureMaster(itemEx.uid) ~= cid then         return doPlayerSendCancel(cid, "Voce so pode usar potion em seus Pokemon's!")     elseif getCreatureHealth(itemEx.uid) == getCreatureMaxHealth(itemEx.uid) then         return doPlayerSendCancel(cid, "Este Pokemon esta totalmente curado.")     elseif getPlayerStorageValue(cid, 52481) >= 1 then         return doPlayerSendCancel(cid, "Voce nao pode usar isto em duelo.")     end     local health = getCreatureMaxHealth(itemEx.uid) * potions[item.itemid] / 100     doPlayerSendTextMessage(cid, 27, "Your pokemon was healed.")     doSendMagicEffect(getThingPos(itemEx.uid), 172)     doSendAnimatedText(getThingPos(itemEx.uid), "+"..health, math.random(1, 255))     doCreatureAddHealth(itemEx.uid, health)     doRemoveItem(item.uid, 1)     return true end
  12. zipter98's post in (Resolvido)Erro ao remover uma porta de uma posição. was marked as the answer   
    Mude:
    doRemoveItem(item.uid) por: doRemoveItem(getTileItemById(configuration.pos, configuration.porta).uid)
  13. zipter98's post in (Resolvido)[AJUDA] Script que boss apareçe 2 vezes por dias em x Horario was marked as the answer   
    Muda a segunda tag para:

    <globalevent name="TheHornedFox1" time="19:00" event="script" value="TheHornedFox.lua"/> Nomes de globalevents não podem se repetir.
  14. zipter98's post in (Resolvido)[erro] Experience Weapon System. was marked as the answer   
    Abaixo de:
    function onKill(cid, target, lastHit) adicione:
       if not isMonster(target) then         return true     end
  15. zipter98's post in (Resolvido)Scripts não funciona. was marked as the answer   
    elseif spell == "Air Vortex" then     local config = {         hurricane = function(cid)             if not isCreature(cid) then return true end             if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return false end             if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end             doMoveInArea2(cid, 42, bombWee1, FLYINGDAMAGE, min, max, spell)           end,         Pull = function(cid)             local pid = getSpectators(getThingPos(cid), 7, 5)             if pid and #pid > 0 then                 for i = 1, #pid do                     if pid[i] ~= cid and ehMonstro(pid[i]) then                         doTeleportThing(pid[i], getClosestFreeTile(cid, getThingPos(cid)))                     end                 end             end         end,     }     config.Pull(cid)     doSetCreatureOutfit(cid, {lookType = 1661}, 10000)     setPlayerStorageValue(cid, 3644587, 1)     addEvent(setPlayerStorageValue, 17*600, cid, 3644587, -1)         for i = 1, 17 do         addEvent(config.hurricane, i * 600, cid)         addEvent(sendDistanceShootWithProtect, 200, cid, getThingPosWithDebug(target), getThingPosWithDebug(cid), 38)         stopNow(cid, 8 * 1000) --alterado v1.4 --alterado v1.4     end
  16. zipter98's post in (Resolvido)Ajuda com porta automática was marked as the answer   
    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"/>
  17. zipter98's post in (Resolvido)[AJUDA] Alavanca com 2 funçoes. was marked as the answer   
    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
  18. zipter98's post in (Resolvido)Porta que só abre com certo Item (Pokemon) was marked as the answer   
    Action: local config = {     itens = {11641, 1},          --ID do item/quantidade que deve "dar" a porta.     time = 8,                    --Tempo, em segundos, para a porta fechar.     storage = 90561, } function onUse(cid, item, fromPosition, itemEx, toPosition)     if getPlayerStorageValue(cid, config.storage) > -1 then         return doPlayerSendCancel(cid, "You already passed through the door.")     elseif getPlayerItemCount(cid, config.itens[1]) < config.itens[2] then         return doPlayerSendCancel(cid, "You need "..config.itens[2].." "..getItemNameById(config.itens[1]).." to open the door.")     end     local guid, name, itemid = getPlayerGUID(cid), getCreatureName(cid), item.itemid + 1     addEvent(function()         item = getTileItemById(toPosition, itemid).uid         if item > 0 then             doItemSetAttribute(item, "aid", 7815)             doTransformItem(item, itemid - 1)         end         if isPlayer(cid) then             setPlayerStorageValue(cid, config.storage, 1)         else             cid = getPlayerByName(name)             if isCreature(cid) then                 setPlayerStorageValue(cid, config.storage, 1)             else                 db.executeQuery("UPDATE player_storage SET value = 1 WHERE key = "..config.storage.." AND player_id = "..guid)             end         end     end, config.time * 1000)     doPlayerRemoveItem(cid, config.itens[1], config.itens[2])     doPlayerSendTextMessage(cid, 27, "You sacrificed "..config.itens[2].." "..getItemNameById(config.itens[1]).." to open the door.")     doTransformItem(item.uid, item.itemid + 1)     doItemSetAttribute(item.uid, "aid", 7816)     return true end Tag: <action actionid="7815" event="script" value="nome_do_arquivo.lua"/> Movement: local storage = 90561 function onStepIn(cid, item, position, fromPosition)     if not isPlayer(cid) then         return true     end     if getPlayerStorageValue(cid, storage) > -1 then         return doPlayerSendCancel(cid, "You cannot pass through the door.") and doTeleportThing(cid, fromPosition)     end     return true end Tag: <movevent type="StepIn" actionid="7816" event="script" value="nome_do_arquivo.lua"/>
  19. zipter98's post in (Resolvido)Spell: Contagem de Players em 20 SQM was marked as the answer   
    local area = 20              --Área (SQM). function onCastSpell(cid)     local count = 0     for _, pid in pairs(getSpectators(getThingPos(cid), area, area)) do         if isPlayer(pid) then             count = count + 1         end     end     doPlayerSendTextMessage(cid, 27, "Há "..count.." player"..(count > 1 and "s" or "").." na área onde você está.")     return true end
  20. zipter98's post in (Resolvido)Item sem mira was marked as the answer   
    function onUse(cid, item)     local summon = getCreatureSummons(cid)[1]     if not summon then         return doPlayerSendCancel(cid, "Summon a pokemon.")     elseif getLevel(summon) >= 150 then         return doPlayerSendCancel(cid, "Seu pokemon não pode subir mais leveis com o rare candy.")     elseif getCreatureName(summon) == "Evolution" then         return doPlayerSendCancel(cid, "Seu pokemon está evoluindo!")     elseif getHappiness(summon) < 50 then         return doSendMagicEffect(getThingPos(summon), 168)     end     doPlayerSendTextMessage(cid, 27, "Você usou um rare candy em seu "..getPokeName(summon)..".")      doCreatureSay(cid, getPokeName(summon)..", comeu um rare candy!", TALKTYPE_SAY)     doRemoveItem(item.uid, 1)     local pb = getPlayerSlotItem(cid, 8)     local level = getItemAttribute(pb.uid, "level")     local exp = getItemAttribute(pb.uid, "exp")     local neededexp = getItemAttribute(pb.uid, "nextlevelexp")     doCreatureSay(summon, "Humm.", TALKTYPE_ORANGE_1)     doItemSetAttribute(pb.uid, "rarecandy", level + 1)     doItemSetAttribute(pb.uid, "exp", exp + neededexp)     doPlayerSendTextMessage(cid, 27, "Seu "..getPokeName(summon).." pokemon comeu um rare candy!")     doSendFlareEffect(getThingPos(summon))     doSendAnimatedText(getThingPos(summon), "Level Up!", 215)     adjustPokemonLevel(pb.uid, cid, pb.itemid, true)     return true end
  21. zipter98's post in (Resolvido)[Ajuda] Erro na script was marked as the answer   
    Nem precisava de spoiler para um código tão pequeno.

    CONFIG = {     [1] = {message = "Está perdido? Este é o mapa do server : http://pyrusot.comunidades.net/index.php!", color = 19},     [2] = {message = "Duvidas? Faça suas duvidas no Help Channel", color = 21},     [3] = {message = "Quando você conseguir algo importante RELOGE para nao perder STAFF NAO SE RESPONSABILIZA", color = 21},     [4] = {message = "AutoLoot :digite /aloot add:nome do item-> para adicionar à lista digite /aloot check-> para checar sua lista de itens digite /aloot delete:nome do item-> para deletar o item da lista Obs.:máximo 30 itens na lista", color = 21},     [5] = {message = "para ser rank 5 basta falar o comando /clan nomedoclan,5 so da para ser 1 clan não da para mudar novamente", color = 21}, } function onThink()     getRandom = math.random(1, #CONFIG)     return doBroadcastMessage(CONFIG[getRandom].message, CONFIG[getRandom].color) end
  22. zipter98's post in (Resolvido)System Catapult + erro was marked as the answer   
    Falta de atenção minha...
    Agora sim eu testei. Se não funcionar, bem, você configurou algo errado.
    local config = {     catapults = {         --[actionid] = "direção",         [6801] = "sul",         [6802] = "norte",     },     distance = 6,                   --Quantas posições o jogador vai "pular" (só funciona com números pares). Distância máxima: 14.     directions = {         ["norte"] = 0,         ["leste"] = 1,         ["sul"] = 2,         ["oeste"] = 3,     }, } function onUse(cid, item, fromPosition, itemEx, toPosition)     if config.distance % 2 ~= 0 then         return doPlayerSendCancel(cid, "Sorry, the catapult isn't available right now.") and print("Trade catapult distance for a odd number.")     elseif not config.catapults[item.actionid] then         return doPlayerSendCancel(cid, "Sorry, this catapult isn't available right now.") and print("Catapult without actionid or it isn't configured in table.")     end     local direction = config.directions[config.catapults[item.actionid]]     for i = 1, config.distance do         addEvent(function()             if getPlayerLookDir(cid) ~= direction then                 doCreatureSetLookDirection(cid, direction)             end             local newPos = getPosByDir(i ~= 1 and getThingPos(cid) or toPosition, direction)             newPos.z = i <= config.distance / 2 and newPos.z - 1 or newPos.z + 1             if i < config.distance then                 doAreaCombatHealth(0, 0, newPos, 0, 0, 0, 255)                 doCreateItem(460, 1, newPos)             end             doTeleportThing(cid, newPos)         end, i * 120)     end     return true end EDIT: Vi acima que você comentou ter removido a linha que cria o void. NÃO remova-a, por favor.

    doCreateItem(460, 1, newPos)
  23. zipter98's post in (Resolvido)Sistema rare! was marked as the answer   
    local price = {itemid, count}            --Troque itemid pelo ID do item que será cobrado, e count pela quantia. local items = {     --[itemid] = {chance, count},        >> Onde itemid é o ID do item, chance, obviamente, a chance dele ser sorteado, e count, a quantidade.     --Exemplo:                           >> Para adicionar mais items, siga o modelo indicado acima. [itemid] = {chance, count},     --[2160] = {50, 10},                 >> Assim, o item de ID 2160 teria 50% de chance de ser sorteado. Quantidade -> 10.     [8303] = {70, 5},          [8302] = {70, 5},     [7422] = {30, 1}, } function onUse(cid)     local _table = {}     local number = math.random(1, 100)     local item = 0     if doPlayerRemoveItem(cid, price[1], price[2]) then         for itemid, chance in pairs(items) do             if item == 0 then                 table.insert(_table, itemid)                 item = itemid             else                 local new_chance = math.abs(chance[1] - number)                 local old_chance = math.abs(items[item][1] - number)                 if new_chance < old_chance then                     if #_table > 0 then                         _table = {}                     end                     table.insert(_table, itemid)                     item = itemid                 elseif new_chance == old_chance then                     table.insert(_table, itemid)                 end             end         end         if item ~= 0 then             if #_table > 1 then                 item = _table[math.random(1, #_table)]             end             local count = items[item][2]             if not isItemStackable(item) then                 if count > 1 then                     for i = 1, count do                         doPlayerAddItem(cid, item, 1)                     end                 else                     doPlayerAddItem(cid, item, 1)                 end             else                 doPlayerAddItem(cid, item, count)             end             broadcastMessage(getCreatureName(cid).." apostou e ganhou "..getItemNameById(item)..".")             doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You received: "..count.."x "..getItemNameById(item)..(count > 1 and "s" or "")..".")         end     else         return doPlayerSendCancel(cid, "You do not have "..price[2].." "..getItemNameById(price[1])..".")     end     return true end
  24. zipter98's post in (Resolvido)Um Script de um evento Diario was marked as the answer   
    Optei por fazer uma premiação justa - assim, é possível que haja mais de um ganhador em alguma(s) colocação(ões). Se isto ocorrer, o prêmio em dinheiro será dividido automaticamente entre os ganhadores.
    Ex.:
    Número sorteado: 48
    Jogadores participando do evento: {Fulano, escolheu número 32}, {Ciclano, número 47}, {Error, número 49}, {Troglodita, número 30}, {zipter, número 29}.
    Assim, a colocação ficará:
    [1 lugar] = Ciclano e Error (o dinheiro será dividido entre ambos)
    [2 lugar] = Fulano
    [3 lugar] = Troglodita
    A configuração, como pode ver, é simples:
       winners = {         [colocação] = {cash = prêmio_em_dinheiro, items = {ID do item prêmio, quantidade do item prêmio}},        }, Enfim, vamos ao código:
    Talkaction:
    local storages = {8932, 8931} local price = 100000              --Preço para participar do sorteio. function onSay(cid, words, param)     if getGlobalStorageValue(storages[1]) < 1 then         return doPlayerSendCancel(cid, "Event is not on.")     elseif getPlayerStorageValue(cid, storages[2]) > -1 then         return doPlayerSendCancel(cid, "You already chose your number.")     elseif param == "" or not tonumber(param) or tonumber(param) < 1 or tonumber(param) > 100 then         return doPlayerSendCancel(cid, "/sorteio 1-100")     elseif getPlayerMoney(cid) < price then         return doPlayerSendCancel(cid, "You do not have enough money ("..price..").")     end     setPlayerStorageValue(cid, storages[2], tonumber(param))     doPlayerRemoveMoney(cid, price)     doPlayerSendTextMessage(cid, 27, "Agora você está participando do evento, seu número: "..param..", Aguarde o resultado, Boa sorte!")     return true end Tag: <talkaction words="/sorteio" event="script" value="nome_do_arquivo.lua"/> Globalevent: local config = {     days = {"Monday", "Tuesday", "Saturday"},                 --Dias que o evento ocorrerá.     time = 5,                                                 --Tempo para o sorteio ocorrer.     winners = {         --[place] = {cash = xxx, items = {itemid, count}},        },     storages = {8931, 8932}, } function getRuffleNumbers(a)     local z = {}     local c = {}     for _, cid in pairs(getPlayersOnline()) do         if getPlayerStorageValue(cid, config.storages[1]) > -1 then             table.insert(z, math.abs(getPlayerStorageValue(cid, config.storages[1]) - a))         end     end     for i = 1, #config.winners do         for j = 1, #z do             if not table.find(c, z[j]) then                 if not c[i] then                     c[i] = z[j]                 else                     if z[j] < c[i] then                         c[i] = z[j]                     end                 end             end         end     end     return c end function onTime()     if isInArray(config.days, os.date("%A")) then         broadcastMessage("O evento do sorteio iniciou, diga /sorteio numero(de 1 a 100) para escolher seu numero, em aproximadamente 5 minutos saira o resultado!")         setGlobalStorageValue(config.storages[2], 1)         addEvent(function()             local a = math.random(1, 100)             if #getRuffleNumbers(a) < 1 then                 broadcastMessage("Ninguém participou do sorteio. :/")                 setGlobalStorageValue(config.storages[2], -1)             else                 broadcastMessage("E o número sorteado foi... "..a.."! Os ganhadores foram:")                 local c = getRuffleNumbers(a)                    for i = 1, #c do                     local players, p, gold = {}, "", 0                     gold = config.winners[i].cash                     for _, cid in pairs(getPlayersOnline()) do                         if getPlayerStorageValue(cid, config.storages[1]) > -1 then                             if getPlayerStorageValue(cid, config.storages[1]) == math.abs(c[i] - a) or getPlayerStorageValue(cid, config.storages[1]) == math.abs(c[i] + a) then                                 table.insert(players, cid)                                 doPlayerAddItem(cid, config.winners[i].items[1], config.winners[i].items[2])                             end                             setPlayerStorageValue(cid, config.storages[1], -1)                         end                     end                         for j = 1, #players do                         gold = math.floor(config.winners[i].cash / #players)                         doPlayerAddMoney(players[j], gold)                         if p == "" then                             p = getCreatureName(players[j])                         else                             p = p..(j == #players and " and" or ",").." "..getCreatureName(players[j])                         end                     end                     broadcastMessage(i.." lugar: "..p.." - cash: "..gold.." - item: "..config.winners[i].items[2].."x "..getItemNameById(config.winners[i].items[1])..".")                 end             end             local query = db.getResult("SELECT id, online FROM players")             if query:getID() == -1 then                 return true             end             repeat                 local online = query:getDataInt("online")                 local i = query:getDataInt("id")                 if online < 1 then                     db.executeQuery("UPDATE player_storage SET value = -1 WHERE key = "..config.storages[1].." AND value > -1 AND player_id = "..i)                 end             until not query:next()             query:free()         end, config.time * 60 * 1000)     end     return true end Tag: <!-- Coloque, em time, o horário 5 minutos antes do sorteio ser realizado. --> <!-- Por exemplo, se colocar 19:55, o sorteio vai ser realizado as 20:00. --> <globalevent name="Sorteio" time="19:55" event="script" value="nome_do_arquivo.lua"/> OBS: Testei o código apenas em situações hipotéticas (como aquele exemplo no começo do post) num depurador de lua.
  25. zipter98's post in (Resolvido)[AJUDA] starter.lua was marked as the answer   
    Mude:
    local storage = 90561 para: local storage = 66966 Ou poste o código do teleporte (data/movements/scripts). Você não preferiria que o jogador fosse automaticamente teleportado ao pegar o pokémon inicial, ao invés de ter que passar por um teleporte? Se sim, delete o teleporte e troque o código da action por este: local pokemons = {     [4230] = "Torchic",              [4231] = "Mudkip",     [4232] = "Treecko",     [4233] = "Charmander",     [4234] = "Squirtle",     [4235] = "Bulbasaur", }             local toPos = {x = x, y = y, z = z}     --Para onde o jogador será teleportado. local storage = 90561 function onUse(cid, item)     if pokemons[item.actionid] and getPlayerStorageValue(cid, storage) < 1 then         doPlayerSendTextMessage(cid, 27, "Parabéns!! Você pegou seu Pokemon Inicial!! BEM-VINDO AO POKEMON  ENTRE NO TELEPORT")         setPlayerStorageValue(cid, storage, 1)         doSendMagicEffect(getThingPos(cid), 29)         doPlayerAddItem(cid, 2392, 100)         doPlayerAddItem(cid, 12344, 100)         doTeleportThing(cid, toPos)         addPokeToPlayer(cid, pokemons[item.actionid], false, false, nil, 0, "super", false)      end     return true end

Informação Importante

Confirmação de Termo