Ir para conteúdo

Vodkart

Héroi
  • Registro em

Solutions

  1. Vodkart's post in (Resolvido)Tem como no tfs 0.4 verificar se o player tem certa storage ? was marked as the answer   
    se for o caso, ao usar a potion era só checar se ele esta com a armor "id" no sloot amor e dobrar o heal...
     
    sobre a storage tem sim, faz pelo movements usando
     
    function onEquip(cid, item, slot) -- ao equipar o item
     
     function onDeEquip(cid, item, slot) -- desequipar o item
  2. Vodkart's post in (Resolvido)Verificar se player está em PvP Arena was marked as the answer   
    Esta é uma mensagem automática! Este tópico foi movido para a área correta.
    Pedimos que você leia as regras do fórum.
     
    muda o script do aol de onPrepareDeath para onDeath
  3. Vodkart's post in (Resolvido)[actions] Ajuda para reformular 1 SCRIPT was marked as the answer   
    local positions = { [1] = {{x = 1290, y = 973, z = 7},{x = 1291, y = 973, z = 7},{x = 1292, y = 973, z = 7}}, [2] = {{x = 1293, y = 973, z = 7},{x = 1294, y = 973, z = 7},{x = 1295, y = 973, z = 7}}, [3] = {{x = 1296, y = 973, z = 7},{x = 1297, y = 973, z = 7},{x = 1298, y = 973, z = 7}}, [4] = {{x = 1298, y = 973, z = 7},{x = 1299, y = 973, z = 7},{x = 1300, y = 973, z = 7}} } local text = {"E por último, o incrivel mundo de garden", "aqui vemos o mapa de althera", "Aqui damos inicio a jornada pelo mapa"} function doTpWithDelay(cid, delay) if delay > 0 then doTeleportThing(cid, positions[getPlayerVocation(cid)][delay]) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,text[delay]) doSendMagicEffect(getThingPos(cid), 2) addEvent(doTpWithDelay, 2000, cid, delay-1) else doCreatureSetNoMove(cid, false) end end function onUse(cid, item, frompos, item2, topos) local var = positions[getPlayerVocation(cid)] if not var then return true end doCreatureSetNoMove(cid, true) doTpWithDelay(cid, #var) return true end  
    n cheguei a testar... o que está entre os "[]" é a voc
  4. Vodkart's post in (Resolvido)[moveevent] Adicionar 'delay' em TELEPORT was marked as the answer   
    @liteon9y
     
    local positions = {{x = 1292, y = 969, z = 4}, {x = 1292, y = 972, z = 3}, {x = 1293, y = 974, z = 2}, {x = 1293, y = 976, z = 2}, {x = 1292, y = 976, z = 3}} local text = {"Feehhc", "Wwoooww", "Wwoooww", "Wwoooww", "Puuffh"} function doTpWithDelay(cid, delay) if delay > 0 then doTeleportThing(cid, positions[delay]) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,text[delay]) doSendMagicEffect(getThingPos(cid), 2) end addEvent(doTpWithDelay, 180, cid, delay-1) end function onUse(cid, item, frompos, item2, topos) doTpWithDelay(cid, #positions) return true end  
  5. Vodkart's post in (Resolvido)[pedido]Script task de pegar itens was marked as the answer   
    entendi
     
    abre o mods e procure por essa linha:
     
    if isPlayer(cid) and isMonster(target) and not isSummon(target) then  
    e deixe essa assim:
     
    if isPlayer(cid) and isMonster(target) then  
     
    alguns servidores não possui essa função nas sources... testa e me avisa!
  6. Vodkart's post in (Resolvido)GlobalEvents [Criar Alavanca com Actionid] was marked as the answer   
    nome do seu script.lua
    local pos, time = {x = 26247, y = 25926, z = 4}, 60 function removeLever() local t = getTileItemById(pos, 9825).uid return t > 0 and doRemoveItem(t) and doSendMagicEffect(pos, CONST_ME_POFF) end function onTimer() local lever = doCreateItem(9825, 1, pos) doItemSetAttribute(lever, "aid", 9900) addEvent(removeLever, time*1000*60) return true end  
    tag
     
    <globalevent name="CreateLever" time="03:00" event="script" value="nome do seu script.lua"/>  
  7. Vodkart's post in (Resolvido)[Pedido] Baú que dá storage e item. was marked as the answer   
    function onUse(cid, item, fromPosition, itemEx, toPosition) local s = 45457 if getPlayerStorageValue(cid, s) > 0 then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Você já terminou a quest!') return true end local r = math.random(1,50) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Parabéns você acabou de completar a Reflect Quest e recebeu ' .. r .. ' crystal coins.') doPlayerAddItem(cid, 2160, r) setPlayerStorageValue(cid, s, 1) return true end  
  8. Vodkart's post in (Resolvido)Ao "morrer" criatura se transforma em outra was marked as the answer   
    function onKill(cid, target) local monsters = { ["larva"] = {chance = 50, next = "bug", msg = {"kill me bitch","hoje nao hoje nao"}}, ["bug"] = {chance = 50, next = "scarab", msg = {"vou renascer","viadoo"}}, ["scarab"] = {chance = 50, next = "ancient scarab", msg = {"fui derrotado","saymon vendedor de rolas"}} } function doRemoveCorpse(pos, creature) for i = 0, 255 do pos.stackpos = i tile = getTileThingByPos(pos) if tile.uid > 0 and isCorpse(tile.uid) then doRemoveItem(tile.uid) end end doSummonCreature(creature, pos) end if isPlayer(cid) and isMonster(target) then local var = monsters[getCreatureName(target)] if var then if var.chance >= math.random(1, 100) then addEvent(doRemoveCorpse, 0, getThingPos(target), var.next) doCreatureSay(target, var.msg[math.random(1, #var.msg)], TALKTYPE_ORANGE_1) end end end return true end  
    <event type="kill" name="BossCorpse" event="script" value="nome do seu script.lua"/>  
     
    registra no Login:
     
    registerCreatureEvent(cid, "BossCorpse")  
     
     
    #EDITADO ARRUMEI ALI O REGISTRO KKKKKK
  9. Vodkart's post in (Resolvido)[AJUDA] EVENTO TEAM BATTLE was marked as the answer   
    function onCombat(cid, target) if isPlayer(cid) and isPlayer(target) then local a,b = getPlayerStorageValue(cid, realTeamBattle.teamStorage),getPlayerStorageValue(target, realTeamBattle.teamStorage) if a > 0 and b > 0 and a == b then return false end end return true end function onTarget(cid, target) if isPlayer(cid) and isPlayer(target) then local a,b = getPlayerStorageValue(cid, realTeamBattle.teamStorage),getPlayerStorageValue(target, realTeamBattle.teamStorage) if a > 0 and b > 0 and a == b then doPlayerSendCancel(cid,"Você não pode atacar seu companheiro de time.") return false end end return true end function onPrepareDeath(cid, deathList) if isPlayer(cid) then local sto = getPlayerStorageValue(cid,realTeamBattle.teamStorage) if sto > 0 then local times = {"Red Assassins", "Blue Norsemen", "Black Hunters", "Green Beggars"} realTeamBattle.broadcast(MESSAGE_STATUS_CONSOLE_ORANGE,"[Team Battle] O jogador "..getCreatureName(cid).." do time "..times[sto].." foi morto!") doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"[Team Battle] You are dead!") realTeamBattle.cleanPlayer(cid) realTeamBattle.checkTeams() end end return true end function onLogin(cid) doPlayerSetStorageValue(cid, realTeamBattle.teamStorage,-1) registerCreatureEvent(cid, "realTeamBattleDeath") registerCreatureEvent(cid, "realTeamBattleCombat") registerCreatureEvent(cid, "realTeamBattleTarget") return true end  
  10. Vodkart's post in (Resolvido)Sistema de loot por baús / chest loot system was marked as the answer   
    local chest_areas = { [8001] = {name = 'Hunt Spider', time = 60, monster = {'Demon', 100}, storage = 178740, container = 1988, items = {{100,2160,1},{50,2173,1},{5,2494,1},{30,2466,1},{80,2495,1},{100,2148,15}}}, [8002] = {name = 'Hunt Spider', time = 60, monster = {'Demon', 100},storage = 178741, container = 1988, items = {{100,2160,1},{5,2160,1},{5,2160,1},{5,2160,1},{5,2160,1},{5,2160,1}}}, [8003] = {name = 'Hunt Dragon', time = 60, monster = {'Demon', 100},storage = 178742, container = 1988, items = {{100,2160,1},{5,2160,1},{5,2160,1},{5,2160,1},{5,2160,1},{5,2160,1}}} } function onUse(cid, item, frompos, item2, topos) local v = chest_areas[item.actionid] if not v then return true end if getPlayerStorageValue(cid, v.storage) >= os.time() then doPlayerSendTextMessage(cid,22,'você só pode pegar outro premio em '..os.date("%d %B %Y %X", getPlayerStorageValue(cid, v.storage))..'.') return true end local items, quest_container, str = v.items, doPlayerAddItem(cid, v.container, 1), 'BackPack from '..v.name..', Your Rewards:\n' for i = 1, table.maxn(items) do local chance, item_id, amount = items[i][1], items[i][2], items[i][3] if chance >= math.random(1, 100) then str = str .. amount .. ' ' .. getItemNameById(item_id) .. ' '..(i ~= table.maxn(items) and ', ' or '.') if isItemStackable(item_id) or amount == 1 then doAddContainerItem(quest_container, item_id, amount) else for i = 1, amount do doAddContainerItem(quest_container, 1) end end end end if v.monster[2] >= math.random(1, 100) then doSummonCreature(v.monster[1], getPlayerPosition(cid)) doCreatureSay(cid, "você não roubará meu tesouro!!", TALKTYPE_ORANGE_1) end doSendMagicEffect(getPlayerPosition(cid), math.random(28,30)) setPlayerStorageValue(cid, v.storage, os.time()+v.time*60) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,'You have found a '..str) return true end  
  11. Vodkart's post in (Resolvido)Suporte nesse script was marked as the answer   
    function onSay(cid, words, param) --[Vocation] = ( Nova Vocation, New Outfit ) local config = { -- Goku [473] = {499, 560}, -- Vegeta [474] = {500, 567}, -- Piccolo [44] = {501, 553}, -- C17 [56] = {531, 559}, -- Gohan [70] = {502, 559}, -- Trunks [490] = {503, 565}, -- Cell [94] = {504, 575}, -- Freeza [110] = {505, 551}, -- Majin Boo [475] = {528, 581}, -- Broly [980] = {506, 558}, -- C18 [151] = {507, 554}, -- Uub [163] = {529, 582}, -- Goten [177] = {508, 561}, -- Chibi Trunks [191] = {509, 561}, -- Cooler [205] = {510, 573}, -- Dende [217] = {511, 552}, -- Tsuful [229] = {512, 569}, -- Bardock [243] = {513, 552}, -- Kuririn [255] = {514, 542}, -- Pan [267] = {515, 543}, -- Kaio [279] = {516, 583}, -- Videl [291] = {530, 605}, -- Janemba [491] = {517, 576}, -- Tenshinhan [315] = {518, 580}, -- Jenk [327] = {519, 562}, -- Raditz [981] = {520, 564}, -- C16 [351] = {521, 555}, -- Turles [382] = {522, 566}, -- Bulma [375] = {523, 578}, -- Shenron [376] = {524, 577}, -- Vegetto [399] = {525, 568}, -- Tapion [476] = {498, 596}, -- Kame [424] = {526, 536}, -- King Vegeta [984] = {497, 563}, -- Kagome [448] = {496, 571}, -- Zaiko [477] = {495, 572}, -- Chilled [492] = {494, 574}, -- C8 [489] = {527, 579}, --Goku Black [540] = {541, 656}, --Golden Freeza [550] = {551, 586}, --Bills [560] = {561, 584}, --Zamasu [854] = {563, 614}, --Goku Black Evo [639] = {640, 655} } local voc = config[getPlayerVocation(cid)] if not voc then return true end local outfit,newvoc = {lookType = voc[2]},voc[1] if getPlayerStorageValue(cid,99023) == 4 then if getPlayerStorageValue(cid, 1240) < os.time() then doCreatureChangeOutfit(cid, outfit) doPlayerSetVocation(cid, newvoc) setPlayerStorageValue(cid,1240,os.time()+5) doPlayerSendTextMessage(cid, 27, "Voce virou GOD") end else return doPlayerSendTextMessage(cid, 27, "Você nao é um GOD...") end return true end  
  12. Vodkart's post in (Resolvido)[REBORN] Npc cobrando item was marked as the answer   
    era só colocar 'and doPlayerRemoveItem(cid, ITEMID,QUANTIDADE) '
     
    coloquei 2160,10
     
    só trocar.
     
     
    o certo era refazer o npc, mas ta ai:
     
    local focus = 0 local talk_start = 0 local target = 0 local following = false local attacking = false function onThingMove(creature, thing, oldpos, oldstackpos) end function onCreatureAppear(creature) end function onCreatureDisappear(cid, pos) if focus == cid then selfSay('???') focus = 0 talk_start = 0 end end function onCreatureTurn(creature) end function msgcontains(txt, str) return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)')) end function onCreatureSay(cid, type, msg) msg = string.lower(msg) if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then selfSay('Olá! Se voce está pronto, diga "reborn".') focus = cid talk_start = os.clock() elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Desculpe, ' .. getCreatureName(cid) .. '! Hey!.') elseif focus == cid then talk_start = os.clock() if msgcontains(msg, 'reborn') and getPlayerStorageValue(cid,30024) == 4 then selfSay('Desculpe, mas voce já é rebornado.') focus = 0 talk_start = 0 elseif msgcontains(msg, 'reborn') and (getPlayerLevel(cid) < 200 and getPlayerStorageValue(cid,30024) ~= 4) or (getPlayerLevel(cid) > 2000 and getPlayerStorageValue(cid,30024) ~= 4) then selfSay('Apenas level 200 até 2000 podem rebornar.') focus = 0 talk_start = 0 elseif msgcontains(msg, 'reborn') then selfSay('Realmente quer isto?') talk_state = 2 --_GOKU_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 2000 and getPlayerVocation(cid) == 15 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,10, 501) talk_state = 0 --_VEGETA_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 30 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,25,510) talk_state = 0 --_PICCOLO_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 43 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,38,519) talk_state = 0 --_C17_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 56 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,50,528) talk_state = 0 --_GOHAN_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 70 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,561,537) talk_state = 0 --_TRUNKS_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 82 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,74,546) talk_state = 0 --_CELL_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 94 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,81,555) talk_state = 0 --_FREEZA_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 110 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,88,564) talk_state = 0 --_MAJIN BOO_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 126 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,98,573) talk_state = 0 --_BROLY_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 138 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,113,582) talk_state = 0 --_C18_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 151 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,50,591) talk_state = 0 --_UUB_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 163 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,128,600) talk_state = 0 --_GOTEN_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 177 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,142,609) talk_state = 0 --_CHIBI TRUNKS_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 191 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,151,611) talk_state = 0 --_COOLER_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 205 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,153,620) talk_state = 0 --_DENDE_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 217 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,169,630) talk_state = 0 --_TSUFUL_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 229 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,180,639) talk_state = 0 --_BARDOCK_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 242 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,194,648) talk_state = 0 --_KURIRIN_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 255 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,205,657) talk_state = 0 --_PAN_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 267 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,212,666) talk_state = 0 --_KAIO_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 279 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,221,675) talk_state = 0 --_VIDEL_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 291 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,227,684) talk_state = 0 --_JANEMBA_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 303 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,234,693) talk_state = 0 --_TENSHINHAN_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 315 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,246,702) talk_state = 0 --_JENK_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 327 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,257,711) talk_state = 0 --_RADITZ_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 339 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,265,720) talk_state = 0 --_C16_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 351 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,277,729) talk_state = 0 --_TURLES_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 363 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,285,738) talk_state = 0 --_BULMA_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 375 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,296,747) talk_state = 0 --_SHENRON_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 387 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,302,756) talk_state = 0 --_VEGETTO_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 392 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,308,393) talk_state = 0 --_TAPION_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 411 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,321,765) talk_state = 0 --_KAME_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 424 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,335,774) talk_state = 0 --_KING VEGETA_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 436 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,347,792) talk_state = 0 --_KAGOME_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 448 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,357,783) talk_state = 0 --_ZAIKO_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 453 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,368,454) talk_state = 0 --_LORD CHILLED_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 472 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,375,801) talk_state = 0 --_C8_-- elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) <= 50000 and getPlayerVocation(cid) == 489 and doPlayerRemoveItem(cid, 2160,10) then doReborn(cid,1,517,810) talk_state = 0 elseif msgcontains(msg, 'yes') and talk_state == 2 then selfSay('Desculpe, ' .. getCreatureName(cid) .. '! Voce deve estar na ultima transformação.') elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then selfSay('Adeus!') focus = 0 talk_start = 0 end end end function onThink() doNpcSetCreatureFocus(focus) if (os.clock() - talk_start) > 45 then if focus > 0 then selfSay('Próximo por favor...') end focus = 0 end if focus ~= 0 then if getDistanceToCreature(focus) > 5 then selfSay('Adeus!') focus = 0 end end end  
  13. Vodkart's post in (Resolvido)Error CTF MOD was marked as the answer   
    <?xml version="1.0" encoding="utf-8"?> <mod name="CTF" version="1.0" author="Doggynub" contact="otland.net" enabled="yes"> <config name="toto"><![CDATA[ --[[ Storage Settings]]-- Owner = 1900 -- put empty storage FLAG2_INn = 4000 -- put empty storage FLAG_IN = 4001 -- put empty storage TEAM1_FLAGS = 3030 -- put empty storage TEAM2_FLAGS = 3031 -- put empty storage Event_Start = 3032 -- put empty storage Event_timeend = 3033 -- put empty storage Event_Tile_Close = 3039 -- put empty storage joined = 2023 --put empty storage Timer = 1010 --put empty storage -------------------------------------- --[[ Places setting ]]-- BLUE_FLAG = {x=10499,y=9887,z=6} -- Blue flag Place RED_FLAG = {x=10553,y=9887,z=6} --red flag Place Tp_Place = {x=10160,y=10054,z=7} -- Place where the event teleport will be created. Wait_Place = {x=10522,y=9817,z=7} -- Positions Players will be sent when the enter event's teleport frompos = {x=10512, y=9807, z=7} --start sqm in the waiting room(1 floor) topos = {x=10532,y=9827,z=7} -- end sqm in the waiting room(1 floor) Red_Position = {x=10549,y=9887,z=6} -- Red team temple pos Blue_Position = {x=10503,y=9887,z=6} -- Blue team temple pos --------------------------------------- --[[Event setting ]]-- Event_WaitTime = 1 -- time for the collection of player then event will start (in minutes) Event_MaxTime = 10 --- in minutes ( this is the max time for an event to bb running ) Players_Speed = 20000 -- put the level of base speed in event ( like if you want the speed of lvl 300 then wright 300) Flag_Holder_Speed = 20000 -- [Old-Styled feature] speed for the player when he hold a flag better not to increase. TEAM2_NAME = "Red" -- team 2 name TEAM1_NAME = "Blue" -- team 1 name FLAG_SCORE = 2 -- score when team gets he wins Teleport_On_Score = false -- this teleport all players to their team main position when some one score a flag , make false to disable. Players_Least_Number = 2 -- this means if there is less than 2 players joined the event will be cancelled Min_Join_Level = 1 -- min lvl for a player to join event rewards_random = { [60] = { -- Rewards of 60% , if it is then it will randomly give one of the items in the items verible if there you put more than one item there items = {9971,9971,9971} }, [30] = { -- Rewards of 30% items = {9971,9971,9971} }, [10] = { -- Rewards of 10% items = {9971,9971,9971} } } ]]></config> <lib name="CTF-lib"><![CDATA[ function isTeamTwo(cid) return (isPlayer(cid) and getPlayerStorageValue(cid,5054) > -1) end function isTeamOne(cid) return (isPlayer(cid) and getPlayerStorageValue(cid,5055) > -1) end function resetTheTeams(cid) return (isPlayer(cid) and setPlayerStorageValue(cid,5054,-1) and setPlayerStorageValue(cid,5055,-1)) end function setflagOwner(cid) return setPlayerStorageValue(cid,Owner,1) end function flagOwner(cid) return (isPlayer(cid) and getPlayerStorageValue(cid,Owner) > 0) end function releaseBF(cid) setGlobalStorageValue(FLAG_IN,-1) setPlayerStorageValue(cid,103, 0) setPlayerStorageValue(cid,Owner,-1) return true end function releaseRF(cid) setGlobalStorageValue(FLAG2_INn,-1) setPlayerStorageValue(cid,103, 0) setPlayerStorageValue(cid,Owner,-1) return true end function setFirstTeam(cid) return setPlayerStorageValue(cid,5055,1) end function setSecondTeam(cid) return setPlayerStorageValue(cid,5054,2) end function addToRed() return setGlobalStorageValue(TEAM2_FLAGS,getGlobalStorageValue(TEAM2_FLAGS)+1) end function addToBlue() return setGlobalStorageValue(TEAM1_FLAGS,getGlobalStorageValue(TEAM1_FLAGS)+1) end function getBlueScore() return getGlobalStorageValue(TEAM1_FLAGS) end function getRedScore() return getGlobalStorageValue(TEAM2_FLAGS) end function getTheSpeed(level) value = (220 +(2 *(level -1))) return value end function resetTheStorage() setGlobalStorageValue(Event_Start,-1) setGlobalStorageValue(Event_timeend,-1) setGlobalStorageValue(TEAM1_FLAGS,0) setGlobalStorageValue(FLAG2_INn,-1) setGlobalStorageValue(FLAG_IN,-1) setGlobalStorageValue(TEAM2_FLAGS,0) return true end function blueStolen() return getGlobalStorageValue(FLAG_IN) end function redStolen() return getGlobalStorageValue(FLAG2_INn) end function giveReward(cid) local t = math.random(1,100) if t <= 10 then local rare = rewards_random[10].items[math.random(1,#rewards_random[10].items)] doPlayerAddItem(cid,rare,1) doPlayerSendTextMessage(cid,25,"Rare rate Reward : you won "..getItemNameById(rare)..".") elseif t > 10 and t <= 40 then local semi = rewards_random[30].items[math.random(1,#rewards_random[30].items)] doPlayerAddItem(cid,semi,1) doPlayerSendTextMessage(cid,25,"Semi rate Reward : you won "..getItemNameById(semi)..".") elseif t > 40 then local aver = rewards_random[60].items[math.random(1,#rewards_random[60].items)] doPlayerAddItem(cid,aver,1) doPlayerSendTextMessage(cid,25,"Averege rate Reward : you won "..getItemNameById(aver)..".") end return true end ]]></lib> <event type="login" name="Tutorial Login" event="script"><![CDATA[ domodlib('toto') domodlib('CTF-lib') function onLogin(cid) if getGlobalStorageValue(Event_Start) < 1 then if isTeamOne(cid) or isTeamTwo(cid) then resetTheTeams(cid) end end registerCreatureEvent(cid, "Attk") registerCreatureEvent(cid, "ctff") registerCreatureEvent(cid, "prepare") return true end ]]></event> <event type="combat" name="Attk" event="script"><![CDATA[ domodlib('toto') domodlib('CTF-lib') function onCombat(cid, target) if isTeamOne(cid) and isTeamOne(target) then return false end if isTeamTwo(cid) and isTeamTwo(target) then return false end return true end ]]></event> <event type="statschange" name="prepare" event="script"><![CDATA[ domodlib('toto') domodlib('CTF-lib') local corpse_ids = { [0] = 3065, -- female [1] = 3058 -- male } function onStatsChange(cid, attacker, type, combat, value) if combat == COMBAT_HEALING then return true end if getCreatureHealth(cid) > value then return true end if getGlobalStorageValue(Event_Start) > 0 then if flagOwner(cid) then if isTeamOne(cid) then doItemSetAttribute(doCreateItem(corpse_ids[getPlayerSex(cid)], 1, getThingPos(cid)), "description", "You recognize "..getCreatureName(cid)..". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item").."[Flag Holder].") doTeleportThing(cid,Blue_Position,false) doSendMagicEffect(Blue_Position,10) doCreatureAddHealth(cid,getCreatureMaxHealth(cid)) doCreatureAddMana(cid,getCreatureMaxMana(cid)) releaseRF(cid) for _,cid in ipairs(getPlayersOnline()) do if isTeamOne(cid) or isTeamTwo(cid) then doPlayerSendTextMessage(cid,22,getCreatureName(cid) .. " has died with the "..TEAM2_NAME.." team flag. The flag is returned back to the "..TEAM1_NAME.." team.") end end return false elseif isTeamTwo(cid) then doItemSetAttribute(doCreateItem(corpse_ids[getPlayerSex(cid)], 1, getThingPos(cid)), "description", "You recognize "..getCreatureName(cid)..". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item").."[Flag Holder].") doTeleportThing(cid,Red_Position,false) doSendMagicEffect(Red_Position,10) doCreatureAddHealth(cid,getCreatureMaxHealth(cid)) doCreatureAddMana(cid,getCreatureMaxMana(cid)) releaseBF(cid) for _,cid in ipairs(getPlayersOnline()) do if isTeamOne(cid) or isTeamTwo(cid) then doPlayerSendTextMessage(cid,22,getCreatureName(cid) .. " has died with the "..TEAM1_NAME.." team flag. The flag is returned back to the "..TEAM1_NAME.." team.") end end return false end else if isTeamOne(cid) or isTeamTwo(cid) then doItemSetAttribute(doCreateItem(corpse_ids[getPlayerSex(cid)], 1, getThingPos(cid)), "description", "You recognize "..getCreatureName(cid)..". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item").."[Normal kill].") doTeleportThing(cid,( isTeamTwo(cid) and Red_Position or Blue_Position ),false) doSendMagicEffect(Red_Position,10) doCreatureAddHealth(cid,getCreatureMaxHealth(cid)) doCreatureAddMana(cid,getCreatureMaxMana(cid)) return false end end end return true end ]]></event> <movevent type="StepIn" actionid="6000" event="script"><![CDATA[ domodlib('toto') domodlib('CTF-lib') function eventEnds() doBroadcastMessage('CTF-Event : The '..TEAM2_NAME..' team won and reciaved their reward.') for _,cid in ipairs(getPlayersOnline()) do if isTeamTwo(cid) then doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)),false) doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10) doRemoveConditions(cid,false) resetTheTeams(cid) doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid)) giveReward(cid) elseif isTeamOne(cid) then doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)),false) doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10) doRemoveConditions(cid,false) doPlayerSendTextMessage(cid,22,'Your team have lost.') resetTheTeams(cid) doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid)) end end addEvent(resetTheStorage,5) end function onStepIn(cid, item, position, fromPosition) if getGlobalStorageValue(Event_Start) > 0 and getGlobalStorageValue(Event_timeend) > 0 then if isTeamTwo(cid) and redStolen() < 0 then if not flagOwner(cid) then doTeleportThing(cid, fromPosition,TRUE) doSendMagicEffect(getThingPos(cid),2) doPlayerSendTextMessage(cid, 27, "This is your team flag, you cant take it!") end elseif isTeamTwo(cid) and redStolen() > 0 and blueStolen() < 0 then doPlayerSendTextMessage(cid, 27, "Your team's Flag has been stolen, go get it back!") doTeleportThing(cid, fromPosition,TRUE) doSendMagicEffect(getThingPos(cid),2) return true end if isTeamTwo(cid) and flagOwner(cid) and blueStolen() > 0 and redStolen() < 0 then if getRedScore() == FLAG_SCORE -1 then addEvent(eventEnds,1000) addToRed() doTeleportThing(cid, fromPosition,TRUE) doChangeSpeed(cid, getTheSpeed(Players_Speed) - getCreatureSpeed(cid) ) releaseBF(cid) for _,tid in ipairs(getPlayersOnline()) do if isTeamOne(tid) or isTeamTwo(tid) then doPlayerSendTextMessage(tid,22,getCreatureName(cid) .. " have captured the last flag and earned match win to the ".. TEAM2_NAME.." team!") end end else releaseBF(cid) addToRed() doTeleportThing(cid, fromPosition,TRUE) doChangeSpeed(cid, getTheSpeed(Players_Speed) - getCreatureSpeed(cid) ) for _,tid in ipairs(getPlayersOnline()) do if isTeamOne(tid) or isTeamTwo(tid) then doPlayerSendTextMessage(tid,22,getCreatureName(cid) .. " have captured the flag and earned 1 point to the ".. TEAM2_NAME.." team!") if Teleport_On_Score == true then doTeleportThing(tid,( isTeamTwo(tid) and Red_Position or Blue_Position ), false) doSendMagicEffect(getThingPos(tid),10) end end end end end if isTeamOne(cid) then if blueStolen() < 0 and redStolen() > 0 then if flagOwner(cid) then doPlayerSendTextMessage(cid, 27, "You already holding the flag!") doTeleportThing(cid, fromPosition,TRUE) doSendMagicEffect(getThingPos(cid),2) elseif (not flagOwner(cid)) then doPlayerSendTextMessage(cid, 27, "Your Team mates already stole the oponent flag, defend him!") doTeleportThing(cid, fromPosition,TRUE) doSendMagicEffect(getThingPos(cid),2) end elseif blueStolen() > 0 and redStolen() < 0 then doPlayerSendTextMessage(cid, 27, "Your team's flag is taken you can't capture or steel a flag!") doTeleportThing(cid, fromPosition,TRUE) doSendMagicEffect(getThingPos(cid),2) end if redStolen() < 0 and blueStolen() < 0 then setGlobalStorageValue(FLAG2_INn,1) setflagOwner(cid) setPlayerStorageValue(cid,103, os.time()+300) doTeleportThing(cid, fromPosition,TRUE) doChangeSpeed(cid, getTheSpeed(Flag_Holder_Speed)- getCreatureSpeed(cid) ) for _,tid in ipairs(getPlayersOnline()) do if isTeamOne(tid) or isTeamTwo(tid) then doPlayerSendTextMessage(tid,22,getCreatureName(cid) .. " stolen the "..TEAM2_NAME.." team flag!") end end end end end return true end ]]></movevent> <movevent type="StepIn" actionid="3435" event="script"><![CDATA[ domodlib('toto') domodlib('CTF-lib') function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor) if getStorage(Event_Tile_Close) > 0 then if getPlayerLevel(cid) < Min_Join_Level then doTeleportThing(cid,fromPosition,false) doSendMagicEffect(fromPosition,10) doPlayerSendTextMessage(cid,21,"Only players of level "..Min_Join_Level.." are allowed to pass.") else doTeleportThing(cid,Wait_Place,false) doSendMagicEffect(Wait_Place,10) end else doTeleportThing(cid,fromPosition,false) doSendMagicEffect(fromPosition,10) doPlayerSendTextMessage(cid,21,"Come back later, event is closed now.") end return true end ]]></movevent> <movevent type="StepIn" actionid="6001" event="script"><![CDATA[ domodlib('toto') domodlib('CTF-lib') function eventEnded() if getGlobalStorageValue(Event_Start) > 0 and getGlobalStorageValue(Event_timeend) > 0 then doBroadcastMessage('CTF-Event : The '.. TEAM1_NAME..' team won and reciaved their reward.') for _,cid in ipairs(getPlayersOnline()) do if isTeamOne(cid) then doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)),false) doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10) doRemoveConditions(cid,false) resetTheTeams(cid) doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid)) giveReward(cid) elseif isTeamTwo(cid) then doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)),false) doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10) doRemoveConditions(cid,false) doPlayerSendTextMessage(cid,22,'Your team have lost.') resetTheTeams(cid) doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid)) end end end addEvent(resetTheStorage,5) end function onStepIn(cid, item, position, fromPosition) if getGlobalStorageValue(Event_Start) > 0 and getGlobalStorageValue(Event_timeend) > 0 then if isTeamOne(cid) and blueStolen() < 0 then if not flagOwner(cid) then doTeleportThing(cid, fromPosition,TRUE) doSendMagicEffect(getThingPos(cid),2) doPlayerSendTextMessage(cid, 27, "This is your team flag, you cant take it!") end elseif isTeamOne(cid) and blueStolen() > 0 and redStolen() < 0 then doPlayerSendTextMessage(cid, 27, "Your team's Flag has been stolen, go get it back!") doTeleportThing(cid, fromPosition,TRUE) doSendMagicEffect(getThingPos(cid),2) return true end if isTeamOne(cid) and flagOwner(cid) and redStolen() > 0 and blueStolen() < 0 then if getBlueScore() == FLAG_SCORE -1 then addEvent(eventEnded,1000) addToBlue() doTeleportThing(cid, fromPosition,TRUE) doChangeSpeed(cid, getTheSpeed(Players_Speed) - getCreatureSpeed(cid) ) releaseRF(cid) for _,tid in ipairs(getPlayersOnline()) do if isTeamOne(tid) or isTeamTwo(tid) then doPlayerSendTextMessage(tid,22,getCreatureName(cid) .. " have captured the last flag and earned match win to the ".. TEAM1_NAME.." team!") end end else releaseRF(cid) addToBlue() doTeleportThing(cid, fromPosition,TRUE) doChangeSpeed(cid, getTheSpeed(Players_Speed) - getCreatureSpeed(cid) ) for _,tid in ipairs(getPlayersOnline()) do if isTeamOne(tid) or isTeamTwo(tid) then doPlayerSendTextMessage(tid,22,getCreatureName(cid) .. " have captured the flag and earned 1 point to the ".. TEAM1_NAME.." team!") if Teleport_On_Score == true then doTeleportThing(tid,( isTeamTwo(tid) and Red_Position or Blue_Position ), false) doSendMagicEffect(getThingPos(tid),10) end end end end end if isTeamTwo(cid) then if blueStolen() > 0 and redStolen() < 0 then if flagOwner(cid) then doPlayerSendTextMessage(cid, 27, "You already holding the flag!") doTeleportThing(cid, fromPosition,TRUE) doSendMagicEffect(getThingPos(cid),2) elseif (not flagOwner(cid)) then doPlayerSendTextMessage(cid, 27, "Your Team mates already stole the oponent flag, defend him!") doTeleportThing(cid, fromPosition,TRUE) doSendMagicEffect(getThingPos(cid),2) end elseif redStolen() > 0 and blueStolen() < 0 then doPlayerSendTextMessage(cid, 27, "Your team's flag is taken you can't capture or steel a flag!") doTeleportThing(cid, fromPosition,TRUE) doSendMagicEffect(getThingPos(cid),2) end if blueStolen() < 0 and redStolen() < 0 then setGlobalStorageValue(FLAG_IN,1) setflagOwner(cid) setPlayerStorageValue(cid,103, os.time()+300) doTeleportThing(cid, fromPosition,TRUE) doChangeSpeed(cid, getTheSpeed(Flag_Holder_Speed)- getCreatureSpeed(cid) ) for _,tid in ipairs(getPlayersOnline()) do if isTeamOne(tid) or isTeamTwo(tid) then doPlayerSendTextMessage(tid,22,getCreatureName(cid) .. " stolen the "..TEAM1_NAME.." team flag!") end end end end end return true end ]]></movevent> <globalevent name="ctf" time="02:24" event="script"><![CDATA[ domodlib('toto') domodlib('CTF-lib') local players = {} local bmale = createConditionObject(CONDITION_OUTFIT) setConditionParam(bmale, CONDITION_PARAM_TICKS, -1) addOutfitCondition(bmale, {lookType = math.random(128,134), lookHead = 115, lookBody =114, lookLegs = 81, lookFeet = 81, lookTypeEx = 0, lookAddons = 3}) local bfemale = createConditionObject(CONDITION_OUTFIT) setConditionParam(bfemale, CONDITION_PARAM_TICKS, -1) addOutfitCondition(bfemale, {lookType = math.random(136,142), lookHead = 115, lookBody =114, lookLegs = 81, lookFeet = 81, lookTypeEx = 0, lookAddons = 3}) local rmale = createConditionObject(CONDITION_OUTFIT) setConditionParam(rmale, CONDITION_PARAM_TICKS, -1) addOutfitCondition(rmale, {lookType = math.random(128,134), lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94, lookTypeEx = 0, lookAddons = 3}) local rfemale = createConditionObject(CONDITION_OUTFIT) setConditionParam(rfemale, CONDITION_PARAM_TICKS, -1) addOutfitCondition(rfemale, {lookType = math.random(136,142),lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94, lookTypeEx = 0, lookAddons = 3}) local fight = createConditionObject(CONDITION_INFIGHT) setConditionParam(fight, CONDITION_PARAM_TICKS, -1) function eventEnd() if getGlobalStorageValue(Event_Start) > 0 and getGlobalStorageValue(Event_timeend) > 0 then if getRedScore() > getBlueScore() then doBroadcastMessage('CTF-Event : The '.. TEAM2_NAME..' team won and recieved their reward.') for _,cid in ipairs(getPlayersOnline()) do if isTeamTwo(cid) then doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)),false) doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10) doRemoveConditions(cid,false) resetTheTeams(cid) doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid)) giveReward(cid) elseif isTeamOne(cid) then doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)),false) doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10) doRemoveConditions(cid,false) doPlayerSendTextMessage(cid,22,'Your team have lost.') resetTheTeams(cid) doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid)) end end elseif getRedScore() < getBlueScore() then doBroadcastMessage('CTF-Event : The '.. TEAM1_NAME..' team won and recieved their reward.') for _,cid in ipairs(getPlayersOnline()) do if isTeamOne(cid) then doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)),false) doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10) doRemoveConditions(cid,false) resetTheTeams(cid) doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid)) giveReward(cid) elseif isTeamTwo(cid) then doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)),false) doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10) doRemoveConditions(cid,false) doPlayerSendTextMessage(cid,22,'Your team have lost.') resetTheTeams(cid) doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid)) end end elseif getRedScore() == getBlueScore() then doBroadcastMessage('CTF-Event : The Event ended with a draw between both teams.') for _,cid in ipairs(getPlayersOnline()) do if isTeamTwo(cid) or isTeamOne(cid) then doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)),false) doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10) doRemoveConditions(cid,false) doPlayerSendTextMessage(cid,22,'It was a draw between both teams.') resetTheTeams(cid) doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid)) end end end addEvent(resetTheStorage,1000) end end function eventStart() doSetStorage(Event_Tile_Close,-1) setGlobalStorageValue(Event_timeend,1) setGlobalStorageValue(Timer, os.time() + Event_MaxTime*60) addEvent(eventEnd,Event_MaxTime*60*1000) for v = frompos.x , topos.x do for k = frompos.y , topos.y do for i = 1, 200 do position = {x = v, y = k, z = 7, stackpos = i} pid = getThingfromPos(position).uid if(pid ~= nil and isPlayer(pid)) then table.insert(players, pid) end end end end if math.mod(#players, 2) ~= 0 then doTeleportThing(players[#players],getTownTemplePosition(getPlayerTown(players[#players])),false) doSendMagicEffect(getThingPosition(players[#players]),10) doPlayerSendTextMessage(players[#players], 19, "Sorry, you have been kicked from event to balance teams.") table.remove(players) end if #players < Players_Least_Number then doBroadcastMessage("CTF event was cancelled because less than "..Players_Least_Number.." players joined") resetTheStorage() if #players > 0 then for i = 1,#players do doTeleportThing(players[i],getTownTemplePosition(getPlayerTown(players[i])),false) doSendMagicEffect(getThingPos(players[i]), 10) end end else doBroadcastMessage("CTF started") for i = 1, math.floor(#players/2) do setFirstTeam(players[i]) end for i = math.floor(#players/2)+1 , #players do setSecondTeam(players[i]) end for _,cid in ipairs(getPlayersOnline()) do if isTeamOne(cid) then if getPlayerSex(cid) == 1 then doAddCondition(cid, bmale) elseif getPlayerSex(cid) ~= 1 then doAddCondition(cid, bfemale) end doAddCondition(cid, fight) doTeleportThing(cid,Blue_Position,false) doSendMagicEffect(Blue_Position, 10) doChangeSpeed(cid, getTheSpeed(Players_Speed) - getCreatureSpeed(cid)) elseif isTeamTwo(cid) then if getPlayerSex(cid) == 1 then doAddCondition(cid, rmale) elseif getPlayerSex(cid) ~= 1 then doAddCondition(cid, rfemale) end doAddCondition(cid, fight) doTeleportThing(cid,Red_Position,false) doSendMagicEffect(Red_Position, 10) doChangeSpeed(cid, getTheSpeed(Players_Speed) - getCreatureSpeed(cid)) end end players = {} end end function onTime() function removeCtfTp() local t = getTileItemById(Tp_Place, 1387).uid return t > 0 and doRemoveItem(t) and doSendMagicEffect(Tp_Place, CONST_ME_POFF) end if getGlobalStorageValue(Event_Start) < 0 then setGlobalStorageValue(Event_Start,1) doSetStorage(Event_Tile_Close,1) doBroadcastMessage("CTF event is opened and teleport is created. It will start in "..Event_WaitTime.." minutes.") players = {} if getTileItemById(Tp_Place, 1387).uid < 1 then doItemSetAttribute(doCreateItem(1387,1, Tp_Place), "aid", 3435) end f= Event_WaitTime - 1 for i = 1,Event_WaitTime-1 do addEvent(doBroadcastMessage,i*60*1000,"CTF event is opened and teleport is created. It will start in "..f.." minutes.") f= f-1 end addEvent(eventStart, Event_WaitTime*60*1000) addEvent(removeCtfTp, Event_WaitTime*60*1000) end return true end ]]></globalevent> <event type="think" name="ctff" event="script"><![CDATA[ domodlib('toto') domodlib('CTF-lib') local bl = BLUE_FLAG local re = RED_FLAG function onThink(interval) if getGlobalStorageValue(Event_Start) > 0 and getGlobalStorageValue(Event_timeend) > 0 then if redStolen() < 0 then doSendAnimatedText(re,"FLAG!",TEXTCOLOR_RED) doSendMagicEffect(re, CONST_ME_SOUND_RED) end if blueStolen() < 0 then doSendAnimatedText(bl,"FLAG!",TEXTCOLOR_BLUE) doSendMagicEffect(bl, CONST_ME_SOUND_BLUE) end for _, cid in ipairs(getPlayersOnline()) do if flagOwner(cid) then if isTeamOne(cid) or isTeamTwo(cid) then if hasCondition(cid,CONDITION_HASTE) then doRemoveCondition(cid,CONDITION_HASTE) end end pl = getThingPos(cid) if isTeamTwo(cid) then if getPlayerStorageValue(cid,103) < os.time() then releaseBF(cid) for _,cid in ipairs(getPlayersOnline()) do if isTeamOne(cid) or isTeamTwo(cid) then doPlayerSendTextMessage(cid,22,getCreatureName(cid) .. " wasted 5 minutes with FLAG."..TEAM2_NAME.." flag is again on spawn!") end end else doSendAnimatedText(pl,"FLAG!",TEXTCOLOR_BLUE) doSendMagicEffect(pl, CONST_ME_SOUND_BLUE) end elseif isTeamOne(cid) then if getPlayerStorageValue(cid,103) < os.time() then releaseRF(cid) for _,cid in ipairs(getPlayersOnline()) do if isTeamOne(cid) or isTeamTwo(cid) then doPlayerSendTextMessage(cid,22,getCreatureName(cid) .. " wasted 5 minutes with FLAG."..TEAM1_NAME.." flag is again on spawn!") end end else doSendAnimatedText(pl,"FLAG!",COLOR_RED) doSendMagicEffect(pl, CONST_ME_SOUND_RED) end end end end end return true end ]]></event> <globalevent name="timer" interval="0.4" event="script"><![CDATA[ domodlib('toto') domodlib('CTF-lib') function onThink(interval) for _,cid in ipairs(getPlayersOnline()) do if isTeamOne(cid) or isTeamTwo(cid) then if getGlobalStorageValue(Event_Start) > 0 and getGlobalStorageValue(Event_timeend) > 0 then if getGlobalStorageValue(Timer)- os.time() >= 0 then doPlayerSendCancel(cid, "Time -> ".. os.date("%M:%S ",getGlobalStorageValue(Timer)- os.time()) .. " | ".. TEAM1_NAME.." Score : "..getBlueScore(cid).."/"..FLAG_SCORE.." captures | ".. TEAM2_NAME.." Score : "..getRedScore(cid).."/"..FLAG_SCORE.." captures") end end end end return true end ]]></globalevent> <globalevent name="starting" type="startup" event="script"><![CDATA[ domodlib('toto') domodlib('CTF-lib') function onStartup() resetTheStorage() return true end ]]></globalevent> </mod>  
  14. Vodkart's post in (Resolvido)Colocar mais de um item no bau de donate was marked as the answer   
    local coin = 6541 local lever = { [12323] = {amount = 8, items = {{2122,1}}}, [12324] = {amount = 2, items = {{9930,1}}}, [12325] = {amount = 2, items = {{2169,1}}}, [12326] = {amount = 10, items = {{2122,1},{2169,1},{9930,1}}}, [12327] = {amount = 2, items = {{7440,1}}}, [12328] = {amount = 2, items = {{7443,1}}}, [12329] = {amount = 2, items = {{7439,1}}} } function getItemsLevers(cid, items) local backpack = doPlayerAddItem(cid, 1999, 1) -- backpackID for _, i_i in ipairs(items) do local item, amount = i_i[1],i_i[2] if isItemStackable(item) or amount == 1 then doAddContainerItem(backpack, item, amount) else for i = 1, amount do doAddContainerItem(backpack, item, 1) end end end end function getItemsFromList(items) local str = '' if table.maxn(items) > 0 then for i = 1, table.maxn(items) do str = str .. items[i][2] .. ' ' .. getItemNameById(items[i][1]) if i ~= table.maxn(items) then str = str .. ', ' end end end return str end function onUse(cid,item,fromPosition,itemEx,toPosition) if not lever[item.actionid] then return true end local var = lever[item.actionid] if not doPlayerRemoveItem(cid,coin, var.amount) then return doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "Você Precisa De "..var.amount.." " ..getItemNameById(coin)) end getItemsLevers(cid, var.items) doPlayerSendTextMessage(cid,22,"Você Acaba De Adquirir: " .. getItemsFromList(var.items)) doSendMagicEffect(getCreaturePosition(cid), math.random(28,30)) doTransformItem(item.uid, item.itemid == 1740 and 1740 or 1740) return true end  
  15. Vodkart's post in (Resolvido)Sistema de Party was marked as the answer   
    if isPlayer(cid) and isInParty(cid) and isPlayer(target) and isInParty(target) and getPlayerParty(cid) == getPlayerParty(target) then  
  16. Vodkart's post in (Resolvido)Npc "Hi " vira monstro was marked as the answer   
    ah ta então só usar a storage de novo
     
    function onCreatureSay(cid, type, msg) local msg, pos, time, name = msg:lower(),getNpcPos(), 30, "The Orc King" local monsters = { 'Demon', 'Slime', 'Slime', 'Orc Warlord', 'Orc Warlord', 'Orc Leader', 'Orc Leader', 'Orc Leader' } if msg == "hi" and getPlayerStorageValue(cid, 29002) <= 0 then setPlayerStorageValue(cid, 29002, 1) doRemoveCreature(getNpcId()) addEvent(function() doCreateNpc(name, pos) end ,time*60*1000) selfSay('Arrrrgh! A dirty paleskin! To me my children! Kill them my guards!') for i = 1, #monsters do local var = doCreateMonster(monsters[i], pos, false) if var == false then return LUA_ERROR end end end return true end  
  17. Vodkart's post in (Resolvido)[PEDIDO] Ao dar x pontos de dano a um monstro ganhar 1 item apos o monstro morre was marked as the answer   
    <?xml version="1.0" encoding="ISO-8859-1"?> <mod name="Item_Bonus" version="1.0" author="Vodkart" contact="tibiaking.com" enabled="yes"> <config name="itembonus_func"><![CDATA[ monsters = { ["rat"] = {s = 487541, min = 15, item = {2160,10}}, ["rotworm"] = {s = 487542, min = 20, item = {2173,1}}, ["cyclops"] = {s = 487543, min = 100, item = {2173,1}}, } ]]></config> <event type="login" name="ItemBonusRegister" event="script"><![CDATA[ function onLogin(cid) registerCreatureEvent(cid, "ItemBonusCombat") registerCreatureEvent(cid, "ItemBonusStats") return true end]]></event> <event type="combat" name="ItemBonusCombat" event="script"><![CDATA[ domodlib('itembonus_func') if isPlayer(cid) and isMonster(target) and monsters[getCreatureName(target):lower()] then registerCreatureEvent(target, "ItemBonusStats") registerCreatureEvent(target, "ItemBonusDeath") end return true]]></event> <event type="statschange" name="ItemBonusStats" event="script"><![CDATA[ domodlib('itembonus_func') if type == STATSCHANGE_HEALTHLOSS and isPlayer(attacker) and isMonster(cid) and monsters[getCreatureName(cid):lower()] then if value >= monsters[getCreatureName(cid):lower()].min then setPlayerStorageValue(attacker, monsters[getCreatureName(cid):lower()].s, 1) end end return true]]></event> <event type="death" name="ItemBonusDeath" event="script"><![CDATA[ domodlib('itembonus_func') function onDeath(cid, corpse, deathList) local x = monsters[getCreatureName(cid):lower()] if x then for _, pid in ipairs(deathList) do if isCreature(pid) and isPlayer(pid) and getPlayerStorageValue(pid, x.s) > 0 then doPlayerAddItem(pid,x.item[1],x.item[2]) setPlayerStorageValue(pid, x.s, 0) end end end return true end]]></event> </mod>  
     
    para configurar só vir nessa tabela:
     
    monsters = {
        ["rat"] = {s = 487541, min = 15, item = {2160,10}},
        ["rotworm"] = {s = 487542, min = 20, item = {2173,1}},
        ["dragon"] = {s = 487543, min = 700, item = {2173,1}},
    }
     
     
    ["nome do monstro em letra minuscula"] = [s = storage coloque sempre uma diferente, min = quantidade de hit necessaria, item {id do item, quantidade}}
     
     
     
    obs: isso é em MODS
  18. Vodkart's post in (Resolvido)[Resolvido] Storage por x tempo was marked as the answer   
    function onCastSpell(cid, var) if getPlayerStorageValue(cid, 15000) - os.time() <= 0 then doPlayerSendCancel(cid, "You can/'t cast this spell.") doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) return false end return doCombat(cid, combat, var) end  
     
    function onSay(cid, words, param, channel) local store,exausted = 156201,30 -- exaust na talk if getPlayerStorageValue(cid, store) >= os.time() then doPlayerSendCancel(cid, "wait " .. getPlayerStorageValue(cid, store) - os.time() .. " seconds to use this command again.") return true end setPlayerStorageValue(cid, 15000, os.time()+10) setPlayerStorageValue(cid, store, os.time()+exausted) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "ativado 10 segundos.") return true end  
  19. Vodkart's post in (Resolvido)NPC Cledwyn - Silver token trader was marked as the answer   
    local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser,msg,str = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid,msg:lower(),"" local moeda = 10581 -- ID DA SILVER TOKEN local t = { ["boots of haste"] = {amount = 10, item = {2195,1}}, ["demon helmet"] = {amount = 11, item = {2493,1}}, ["frozen starlight"] = {amount = 30, item = {2361,1}}, ["spellbook of dark mysteries"] = {amount = 20, item = {8918,1}}, ["royal crossbow"] = {amount = 20, item = {8851,1}}, ["stuffed dragon"] = {amount = 30, item = {5791,1}}, ["star tear"] = {amount = 100, item = {7735,1}}, ["jester staff"] = {amount = 100, item = {7958,1}}, ["vancini axe"] = {amount = 100, item = {8925,1}}, ["firewalker boots"] = {amount = 50, item = {9932,1}}, ["flame blade"] = {amount = 100, item = {8931,2}} } if (msgcontains(msg, 'trade') or msgcontains(msg, 'TRADE'))then str = str .. "Pode trocar suas SILVER TOKENS por: " for name, ret in pairs(t) do str = str.." {"..name.."} = "..ret.amount.." Moedas /" end npcHandler:say(str, cid) elseif t[msg] then local item, amount = t[msg].item[1], t[msg].item[2] if doPlayerRemoveItem(cid,moeda, t[msg].amount) then if isItemStackable(item) or amount == 1 then doPlayerAddItem(cid, item, amount) else for i = 1, amount do doPlayerAddItem(cid, item, 1) end end npcHandler:say("Aqui está "..amount.." ".. getItemNameById(item) .."!", cid) else npcHandler:say("Você precisa de "..t[msg].amount.." ".. getItemNameById(moeda), cid) end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())  
     
     
     
  20. Vodkart's post in (Resolvido)Função verificar storage was marked as the answer   
    function getPlayersFromStorage(storage, value) local query = db.getResult("SELECT `player_id` FROM `player_storage` WHERE `key` = ".. storage .." AND `value` = ".. value) if (query:getID() ~= -1) then return getPlayerNameByGUID(query:getDataInt("player_id")) end return false end  
     
     
    ai pode usar
     
    local x = getPlayersFromStorage(10023, getPlayerGUID(cid)) if not x then print("nenhum jogador com este value") else print(x) end  
     
  21. Vodkart's post in (Resolvido)como proibir uso de potions em area pz was marked as the answer   
    local MIN = 50 local MAX = 200 local EMPTY_POTION = 7636 local exhaust = createConditionObject(CONDITION_EXHAUST) setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100)) function onUse(cid, item, fromPosition, itemEx, toPosition) if not isPlayer(itemEx.uid) then return true end if getTilePzInfo(getCreaturePosition(cid)) then doPlayerSendCancel(cid, "Você não pode usar potions em Pz.") return true elseif hasCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE then doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED) return true end if doPlayerAddMana(itemEx.uid, math.random(MIN, MAX)) == LUA_ERROR then return FALSE end doAddCondition(cid, exhaust) doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE) doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1) end  
  22. Vodkart's post in (Resolvido)Alguem me ajuda com esse erro was marked as the answer   
    é na lib functions mesmo
    vc colocou as funções dentro de outra.
     
     
    function isInArray(array, value, caseSensitive) if(caseSensitive == nil or caseSensitive == false) and type(value) == "string" then local lowerValue = value:lower() for _, _value in ipairs(array) do if type(_value) == "string" and lowerValue == _value:lower() then return true end end else for _, _value in ipairs(array) do if (value == _value) then return true end end end return false end function setPlayerStorageValueDB(guid, key, value) db.executeQuery("UPDATE player_storage SET value = "..value.." WHERE key = "..key.." AND player_id = ".. guid ..";") return true end function getPlayerStorageValueDB(guid, key) local result = db.getResult("SELECT value FROM `player_storage` WHERE key = "..key.." AND player_id = ".. guid ..";") if result:getID() ~= -1 then return result:getDataInt("value") else return -1 end result:free() end function doPlayerGiveItem(cid, itemid, amount, subType) local item = 0 if(isItemStackable(itemid)) then item = doCreateItemEx(itemid, amount) if(doPlayerAddItemEx(cid, item, true) ~= RETURNVALUE_NOERROR) then return false end else for i = 1, amount do item = doCreateItemEx(itemid, subType) if(doPlayerAddItemEx(cid, item, true) ~= RETURNVALUE_NOERROR) then return false end end end return true end function doPlayerGiveItemContainer(cid, containerid, itemid, amount, subType) for i = 1, amount do local container = doCreateItemEx(containerid, 1) for x = 1, getContainerCapById(containerid) do doAddContainerItem(container, itemid, subType) end if(doPlayerAddItemEx(cid, container, true) ~= RETURNVALUE_NOERROR) then return false end end return true end function doPlayerTakeItem(cid, itemid, amount) return getPlayerItemCount(cid, itemid) >= amount and doPlayerRemoveItem(cid, itemid, amount) end function doPlayerSellItem(cid, itemid, count, cost) if(not doPlayerTakeItem(cid, itemid, count)) then return false end if(not doPlayerAddMoney(cid, cost)) then error('[doPlayerSellItem] Could not add money to: ' .. getPlayerName(cid) .. ' (' .. cost .. 'gp).') end return true end function doPlayerWithdrawMoney(cid, amount) if(not getBooleanFromString(getConfigInfo('bankSystem'))) then return false end local balance = getPlayerBalance(cid) if(amount > balance or not doPlayerAddMoney(cid, amount)) then return false end doPlayerSetBalance(cid, balance - amount) return true end function doPlayerDepositMoney(cid, amount) if(not getBooleanFromString(getConfigInfo('bankSystem'))) then return false end if(not doPlayerRemoveMoney(cid, amount)) then return false end doPlayerSetBalance(cid, getPlayerBalance(cid) + amount) return true end function doPlayerAddStamina(cid, minutes) return doPlayerSetStamina(cid, getPlayerStamina(cid) + minutes) end function isPremium(cid) return (isPlayer(cid) and (getPlayerPremiumDays(cid) > 0 or getBooleanFromString(getConfigValue('freePremium')))) end function getMonthDayEnding(day) if(day == "01" or day == "21" or day == "31") then return "st" elseif(day == "02" or day == "22") then return "nd" elseif(day == "03" or day == "23") then return "rd" end return "th" end function getMonthString(m) return os.date("%B", os.time{year = 1970, month = m, day = 1}) end function getArticle(str) return str:find("[AaEeIiOoUuYy]") == 1 and "an" or "a" end function doNumberFormat(i) local str, found = string.gsub(i, "(%d)(%d%d%d)$", "%1,%2", 1), 0 repeat str, found = string.gsub(str, "(%d)(%d%d%d),", "%1,%2,", 1) until found == 0 return str end function doPlayerAddAddons(cid, addon) for i = 0, table.maxn(maleOutfits) do doPlayerAddOutfit(cid, maleOutfits, addon) end for i = 0, table.maxn(femaleOutfits) do doPlayerAddOutfit(cid, femaleOutfits, addon) end end function getTibiaTime(num) local minutes, hours = getWorldTime(), 0 while (minutes > 60) do hours = hours + 1 minutes = minutes - 60 end if(num) then return {hours = hours, minutes = minutes} end return {hours = hours < 10 and '0' .. hours or '' .. hours, minutes = minutes < 10 and '0' .. minutes or '' .. minutes} end function doWriteLogFile(file, text) local f = io.open(file, "a+") if(not f) then return false end f:write("[" .. os.date("%d/%m/%Y %H:%M:%S") .. "] " .. text .. "\n") f:close() return true end function getExperienceForLevel(lv) lv = lv - 1 return ((50 * lv * lv * lv) - (150 * lv * lv) + (400 * lv)) / 3 end function doMutePlayer(cid, time) local condition = createConditionObject(CONDITION_MUTED, (time == -1 and time or time * 1000)) return doAddCondition(cid, condition, false) end function doSummonCreature(name, pos) local cid = doCreateMonster(name, pos, false, false) if(not cid) then cid = doCreateNpc(name, pos) end return cid end function getPlayersOnlineEx() local players = {} for i, cid in ipairs(getPlayersOnline()) do table.insert(players, getCreatureName(cid)) end return players end function getPlayerByName(name) local cid = getCreatureByName(name) return isPlayer(cid) and cid or nil end function isPlayer(cid) return isCreature(cid) and cid >= AUTOID_PLAYERS and cid < AUTOID_MONSTERS end function isPlayerGhost(cid) return isPlayer(cid) and (getCreatureCondition(cid, CONDITION_GAMEMASTER, GAMEMASTER_INVISIBLE, CONDITIONID_DEFAULT) or getPlayerFlagValue(cid, PLAYERFLAG_CANNOTBESEEN)) end function isMonster(cid) return isCreature(cid) and cid >= AUTOID_MONSTERS and cid < AUTOID_NPCS end function isNpc(cid) -- Npc IDs are over int32_t range (which is default for lua_pushnumber), -- therefore number is always a negative value. return isCreature(cid) and (cid < 0 or cid >= AUTOID_NPCS) end function isUnderWater(cid) return isInArray(underWater, getTileInfo(getCreaturePosition(cid)).itemid) end function doPlayerAddLevel(cid, amount, round) local experience, level, amount = 0, getPlayerLevel(cid), amount or 1 if(amount > 0) then experience = getExperienceForLevel(level + amount) - (round and getPlayerExperience(cid) or getExperienceForLevel(level)) else experience = -((round and getPlayerExperience(cid) or getExperienceForLevel(level)) - getExperienceForLevel(level + amount)) end return doPlayerAddExperience(cid, experience) end function doPlayerAddMagLevel(cid, amount) local amount = amount or 1 for i = 1, amount do doPlayerAddSpentMana(cid, getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true) + 1) - getPlayerSpentMana(cid), false) end return true end function doPlayerAddSkill(cid, skill, amount, round) local amount = amount or 1 if(skill == SKILL__LEVEL) then return doPlayerAddLevel(cid, amount, round) elseif(skill == SKILL__MAGLEVEL) then return doPlayerAddMagLevel(cid, amount) end for i = 1, amount do doPlayerAddSkillTry(cid, skill, getPlayerRequiredSkillTries(cid, skill, getPlayerSkillLevel(cid, skill) + 1) - getPlayerSkillTries(cid, skill), false) end return true end function isPrivateChannel(channelId) return channelId >= CHANNEL_PRIVATE end function doBroadcastMessage(text, class) local class = class or MESSAGE_STATUS_WARNING if(type(class) == 'string') then local className = MESSAGE_TYPES[class] if(className == nil) then return false end class = className elseif(class < MESSAGE_FIRST or class > MESSAGE_LAST) then return false end for _, pid in ipairs(getPlayersOnline()) do doPlayerSendTextMessage(pid, class, text) end print("> Broadcasted message: \"" .. text .. "\".") return true end function doPlayerBroadcastMessage(cid, text, class, checkFlag, ghost) local checkFlag, ghost, class = checkFlag or true, ghost or false, class or TALKTYPE_BROADCAST if(checkFlag and not getPlayerFlagValue(cid, PLAYERFLAG_CANBROADCAST)) then return false end if(type(class) == 'string') then local className = TALKTYPE_TYPES[class] if(className == nil) then return false end class = className elseif(class < TALKTYPE_FIRST or class > TALKTYPE_LAST) then return false end for _, pid in ipairs(getPlayersOnline()) do doCreatureSay(cid, text, class, ghost, pid) end print("> " .. getCreatureName(cid) .. " broadcasted message: \"" .. text .. "\".") return true end function doCopyItem(item, attributes) local attributes = ((type(attributes) == 'table') and attributes or { "aid" }) local ret = doCreateItemEx(item.itemid, item.type) for _, key in ipairs(attributes) do local value = getItemAttribute(item.uid, key) if(value ~= nil) then doItemSetAttribute(ret, key, value) end end if(isContainer(item.uid)) then for i = (getContainerSize(item.uid) - 1), 0, -1 do local tmp = getContainerItem(item.uid, i) if(tmp.itemid > 0) then doAddContainerItemEx(ret, doCopyItem(tmp, true).uid) end end end return getThing(ret) end function doSetItemText(uid, text, writer, date) local thing = getThing(uid) if(thing.itemid < 100) then return false end doItemSetAttribute(uid, "text", text) if(writer ~= nil) then doItemSetAttribute(uid, "writer", tostring(writer)) if(date ~= nil) then doItemSetAttribute(uid, "date", tonumber(date)) end end return true end function getItemWeightById(itemid, count, precision) local item, count, precision = getItemInfo(itemid), count or 1, precision or false if(not item) then return false end if(count > 100) then -- print a warning, as its impossible to have more than 100 stackable items without "cheating" the count print('[Warning] getItemWeightById', 'Calculating weight for more than 100 items!') end local weight = item.weight * count return precission and weight or math.round(weight, 2) end function choose(...) local arg, ret = {...} if type(arg[1]) == 'table' then ret = arg[1][math.random(#arg[1])] else ret = arg[math.random(#arg)] end return ret end function doPlayerAddExpEx(cid, amount) if(not doPlayerAddExp(cid, amount)) then return false end local position = getThingPosition(cid) doPlayerSendTextMessage(cid, MESSAGE_EXPERIENCE, "You gained " .. amount .. " experience.", amount, COLOR_WHITE, position) local spectators, name = getSpectators(position, 7, 7), getCreatureName(cid) for _, pid in ipairs(spectators) do if(isPlayer(pid) and cid ~= pid) then doPlayerSendTextMessage(pid, MESSAGE_EXPERIENCE_OTHERS, name .. " gained " .. amount .. " experience.", amount, COLOR_WHITE, position) end end return true end function getItemTopParent(uid) local parent = getItemParent(uid) if(not parent or parent.uid == 0) then return nil end while(true) do local tmp = getItemParent(parent.uid) if(tmp and tmp.uid ~= 0) then parent = tmp else break end end return parent end function getItemHolder(uid) local parent = getItemParent(uid) if(not parent or parent.uid == 0) then return nil end local holder = nil while(true) do local tmp = getItemParent(parent.uid) if(tmp and tmp.uid ~= 0) then if(tmp.itemid == 1) then -- a creature holder = tmp break end parent = tmp else break end end return holder end function valid(f) return function(p, ...) if(isCreature(p)) then return f(p, ...) end end end function addContainerItems(container,items) local items_mod = {} for _, it in ipairs(items) do if( isItemStackable(it.id) and it.count > 100) then local c = it.count while( c > 100 ) do table.insert(items_mod,{id = it.id,count = 100}) c = c - 100 end if(c > 0) then table.insert(items_mod,{id = it.id,count = c}) end else table.insert(items_mod,{id = it.id,count = 1}) end end local free = getContainerCap(container.uid) - (getContainerSize(container.uid) ) local count = math.ceil(#items_mod/ free) local main_bp = container.uid local insert_bp = main_bp local counter = 1 for c,it in ipairs(items_mod) do local _c = isItemStackable(it.id) and (it.count > 100 and 100 or it.count) or 1 if count > 1 then if (counter < free) then doAddContainerItem(insert_bp, it.id, _c) else insert_bp = doAddContainerItem(insert_bp, container.itemid, 1) count = (#items_mod)-(free-1) free = getContainerCap(insert_bp) count = math.ceil(count/ free) doAddContainerItem(insert_bp, it.id, _c) counter = 1 end counter = counter + 1 else doAddContainerItem(insert_bp, it.id, _c) end end return main_bp end function getPoints(cid) local check = db.getResult("SELECT `points` FROM `players` WHERE `id` = " .. getPlayerGUID(cid) .. " LIMIT 1") return check:getDataInt("points") <= 0 and 0 or check:getDataInt("points") end function addPoints(cid,amount) db.Query("UPDATE `players` SET `points` = "..getPoints(cid).."+"..amount.." WHERE `id` = "..getPlayerGUID(cid)) end function removePoints(cid,amount) db.Query("UPDATE `players` SET `points` = "..getPoints(cid).."-"..amount.." WHERE `id` = "..getPlayerGUID(cid)) end function setPoints(cid,value) db.Query("UPDATE `players` SET `points` = "..value.." WHERE `id` = "..getPlayerGUID(cid)) end  
  23. Vodkart's post in (Resolvido)Task especial que só pode ser feita com x task points was marked as the answer   
    local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser,msg = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid,msg:lower() local level, points = 30, 3000 -- level e points local cave_pos = {x=160, y=54, z=7} -- cave pos if (msgcontains(msg, 'enter') or msgcontains(msg, 'entrar')) then npcHandler:say("você deseja entrar na cave? precisa ter "..points.." task points para entrar! {yes}", cid) talkState[talkUser] = 1 elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then if getPlayerLevel(cid) >= level then if getPlayerStorageValue(cid, 3456) >= points then doTeleportThing(cid,cave_pos) npcHandler:say("Good Lucky.", cid) talkState[talkUser] = 0 else npcHandler:say("vc precisa de "..points.." task points para entrar nesta cave.", cid) talkState[talkUser] = 0 end else npcHandler:say("You are not prepared yet. Come back when you get stronger. Reach level "..level..".", cid) end elseif msg == "no" then selfSay("ok then", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())  
  24. Vodkart's post in (Resolvido)Arrumar Script was marked as the answer   
    local config = { --[vocation id] = { level, nova voc, looktype, efeito} [675] = {100, 676, 826, 121}, [676] = {200, 677, 827, 121}, [678] = {100, 679, 829, 121}, [679] = {200, 680, 830, 121}, [680] = {400, 681, 831, 121}, [681] = {600, 682, 834, 121} } function onSay(cid, words, param, channel) local voc = config[getPlayerVocation(cid)] if voc then if getPlayerLevel(cid) >= voc[1] then if voc[1] == 600 and getPlayerStorageValue(cid,99023) <= 0 then doPlayerSendCancel(cid, "desculpa mas precisa da storage.") return true end doPlayerSetVocation(cid, voc[2]) doCreatureSay(cid, "Sinta meu Poder, Evoluir!!!!", 19) local outfit = {lookType = voc[3]} doCreatureChangeOutfit(cid, outfit) doSendMagicEffect(getCreaturePosition(cid), voc[4]) else doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Voce precisa estar no level " .. voc[1] .. " para transformar.") end else doPlayerSendCancel(cid, "Voce ja esta na ultima transformação.") end return true end  
  25. Vodkart's post in (Resolvido)Sair Efeito em cima da conta GOD was marked as the answer   
    global events
     
    function onThink(interval, lastExecution) for _, pid in ipairs(getPlayersOnline()) do if getPlayerGroupId(pid) >= 4 and not isPlayerGhost(pid) then doSendMagicEffect(getCreaturePosition(pid), math.random(28,30)) end end return true end  

Informação Importante

Confirmação de Termo