Ir para conteúdo

Featured Replies

Postado

Galera, primeiramente bom dia/tarde/noite. Gostaria de pedir uma ajuda a você que é scripter, pois estou tendo uns certos erros no meu servidor, tipo, funfa tudo de boa, mas na distro aparece uns erros. Eu gostaria de uma ajuda para resolve-los.

 

Exame Chunnin Script:

 

Spoiler

<?xml version="1.0" encoding="ISO-8859-1"?>
<mod name="Exame Chunnin" version="1.0" author="vodkart" contact="xvideos.com" unabled="yes">
<config name="examechunnin"><![CDATA[
Exame_Chunnin = {
    storages = {753540,753541,753542}, -- wave,timer,kick
    storage_ex = 548760, -- n mexa
    hours = 1, -- que vai voltar a usar a alavanca
    level = {min = 1, max = 3802}, -- level para participar
    str = "{Exame Chunnin} Iniciando a Luta %d Boa sorte!",
    area = {from = {x = 1031, y = 966, z = 7}, to = {x = 1044, y = 970, z = 7}},
    global_storage = 487576, -- n mexa
    respawntime = 5, -- entre o termino de um respawn vai nascer depois de quanto tempo?
    enter_pos = {x = 1042, y = 968, z = 7}, -- onde os jogadores vao ao puxar a alavanca
    trofypos = {x = 964, y = 889, z = 8}, -- posicao da area apos a arena
    waves = {
        [1] = {{"kiba",1}},
        [2] = {{"neji",1}},
        [3] = {{"temari",1}},
        [4] = {{"shikamaru",1}},
        [5] = {{"sasuke",1}},
        [6] = {{"gaara",1}}    
    }
}
function doStartNextEasyWave(wave, from, to)
    setGlobalStorageValue(753540, wave)
    setGlobalStorageValue(753541, os.time()+120)
    setGlobalStorageValue(753542, 0)
    addEvent(doKickPlayerArena, 120000, wave, from,to) 
    HaveCreatureArena({from,to}, true, true)
    doSpanwMonster(from,to, Exame_Chunnin.waves[wave], true)
end
function doCheckKillArea(from, to)
    if #getPlayersInArena(Exame_Chunnin.area.from,Exame_Chunnin.area.to) == 0 then return true end
    if HaveCreatureArena({from,to}, false, false) == 0 then
        local next = (getGlobalStorageValue(Exame_Chunnin.storages[1])+1)
        if Exame_Chunnin.waves[next] then
            setGlobalStorageValue(753540, next)
            for _, cid in pairs(getPlayersOnline()) do
                if isInRange(getPlayerPosition(cid), from, to) then 
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,string.format(Exame_Chunnin.str,next))
                end
            end
            addEvent(doStartNextEasyWave,Exame_Chunnin.respawntime*1000, next, from, to)
        else
            for _, cid in pairs(getPlayersOnline()) do
                if isInRange(getPlayerPosition(cid), from, to) then
                    doRemoveConditions(cid, false)
                    doTeleportThing(cid, Exame_Chunnin.trofypos)
                    doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT) 
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"Parabéns, voce passou no exame chunnin!.")
                end
            end
        end 
    else
        addEvent(doCheckKillArea, 5000, from, to) -- vai fzr loop a cada 5 segundos na sala pra saber se matou o monstros
    end
end
function getPlayersInArena(from, to)
    local t = {}
    for _, pid in pairs(getPlayersOnline()) do
        if isInRange(getPlayerPosition(pid), from, to) then 
            t[#t+1] = pid
        end
    end
    return t
end
function isWalkable(pos) -- by Nord / editado por Omega
    if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then
        return false
    elseif isCreature(getTopCreature(pos).uid) then
        return false
    elseif getTileInfo(pos).protection then
        return false
    elseif hasProperty(getThingFromPos(pos).uid, 3) or hasProperty(getThingFromPos(pos).uid, 7) then
        return false
    end
    return true
end
function doSpanwMonster(from, to, tab, time)
    for _, ret in pairs(tab) do
        local c = ret[2]
        if c > 0 then
            repeat
                local pos = {x=math.random(from.x, to.x), y=math.random(from.y,to.y), z=from.z}
                if isWalkable(pos) then
                    doCreateMonster(ret[1], pos)
                    doSendDistanceShoot({x = pos.x - math.random(4, 6), y = pos.y - 5, z = pos.z}, pos, CONST_ANI_FIRE)
                    addEvent(doSendMagicEffect, 150, pos, CONST_ME_HITBYFIRE)
                    addEvent(doSendMagicEffect, 150, pos, CONST_ME_FIREAREA)
                    doSendMagicEffect(pos, CONST_ME_MORTAREA)
                    c = c-1 
                end
            until c == 0
        end
    end
        if time then 
        addEvent(doCheckKillArea, 5000, from, to)
    end
end
function HaveCreatureArena(area, remove, clean)
    local var = 0
    for x = area[1].x - 1, area[2].x + 1 do
        for y = area[1].y - 1, area[2].y + 1 do
            local pos = {x=x, y=y, z=area[1].z}
            local m = getTopCreature(pos).uid
            if m ~= 0 and isMonster(m) then 
                var = var +1 
            end
            if remove ~= false and m ~= 0 and isMonster(m) then 
                doRemoveCreature(m) 
            end
            if clean ~= false then 
                doCleanTile(pos,false)
            end
        end
    end
    return var
end
function doKickPlayerArena(wave, from, to)
    if getGlobalStorageValue(Exame_Chunnin.storages[1]) ~= wave then return true end
    local players = getPlayersInArena(Exame_Chunnin.area.from, Exame_Chunnin.area.to) 
    if #players == 0 then return true end
    if getGlobalStorageValue(Exame_Chunnin.storages[2]) <= os.time() then
        if getGlobalStorageValue(Exame_Chunnin.storages[3]) <= 0 then
            for _, cid in pairs(players) do
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"Voce sera kikado em 5 minutos se nao terminar o exame chunnin")
            end
            setGlobalStorageValue(Exame_Chunnin.storages[3], 1)
            addEvent(doKickPlayerArena, 5*60000, wave, from, to) -- 5 minutos
        else
            for _, cid in pairs(players) do
                doRemoveConditions(cid, false)
                doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
                doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
                doPlayerSendTextMessage(cid, 21, '[Exame Chunnin] voce sobreviviu até a '..wave..'° luta, mais sorte da próxima vez!')
            end
            setGlobalStorageValue(Exame_Chunnin.storages[1], 0)
            setGlobalStorageValue(Exame_Chunnin.storages[2], 0)
            setGlobalStorageValue(Exame_Chunnin.storages[3], 0)
        end
    end
end
]]></config>
<event type="login" name="ChunninLogin" event="script"><![CDATA[
domodlib('examechunnin')
function onLogin(cid)
    registerCreatureEvent(cid, "ChunninDeath")
    registerCreatureEvent(cid, "ChunninLogout")
    if isInRange(getPlayerPosition(cid),Exame_Chunnin.area.from,Exame_Chunnin.area.to) then
        doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
    end
    return true
end]]></event>
<event type="logout" name="ChunninLogout" event="script"><![CDATA[
domodlib('examechunnin')
function onLogout(cid)
    if isInRange(getPlayerPosition(cid),Exame_Chunnin.area.from,Exame_Chunnin.area.to) then
        return false
    end
    return true
end]]></event>
<event type="preparedeath" name="ChunninDeath" event="script"><![CDATA[
domodlib('examechunnin')
function onPrepareDeath(cid, killers)
    if isInRange(getPlayerPosition(cid),Exame_Chunnin.area.from,Exame_Chunnin.area.to) then
        doCreatureAddHealth(cid, getCreatureMaxHealth(cid), 65535, 256, true)
        doRemoveConditions(cid, false)
        doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
        local wave = getGlobalStorageValue(Exame_Chunnin.storages[1])
        doPlayerSendTextMessage(cid, 21, '[Exame Chunnin] voce sobreviviu até a '..wave..'° luta, mais sorte da próxima vez!')
        return false
    end
    return true
end]]></event>
<movevent type="StepIn" actionid="40001" event="script"><![CDATA[
domodlib('examechunnin')
    if #getPlayersInArena(Exame_Chunnin.area.from, Exame_Chunnin.area.to) > 0 then
        doPlayerSendCancel(cid, 'Alguem esta fazendo o exame, espere...')
        doTeleportThing(cid, fromPosition) return true
    end
    if getPlayerStorageValue(cid, Exame_Chunnin.storage_ex) - os.time() > 0 then
                   doTeleportThing(cid, fromPosition)
            doPlayerSendCancel(cid, 'Voce deve aguardar para ir no exame novamente.') return true
    end    
    if getPlayerLevel(cid) < Exame_Chunnin.level.min or getPlayerLevel(cid) > Exame_Chunnin.level.max then
                   doTeleportThing(cid, fromPosition)
            doPlayerSendCancel(cid, 'voce precisa ter level entre '..Exame_Chunnin.level.min..' e '..Exame_Chunnin.level.max..' para participar do exame chunnin.') return true 
    end
    setGlobalStorageValue(Exame_Chunnin.storages[1], 1)
    setGlobalStorageValue(Exame_Chunnin.storages[2], os.time()+(120+Exame_Chunnin.respawntime))
    setGlobalStorageValue(Exame_Chunnin.storages[3], 0)
    addEvent(doKickPlayerArena, (120000+Exame_Chunnin.respawntime*1000), 1, Exame_Chunnin.area.from,Exame_Chunnin.area.to) 
    HaveCreatureArena({Exame_Chunnin.area.from,Exame_Chunnin.area.to}, true, true)
    addEvent(doSpanwMonster,Exame_Chunnin.respawntime*1000, Exame_Chunnin.area.from, Exame_Chunnin.area.to, Exame_Chunnin.waves[getGlobalStorageValue(Exame_Chunnin.storages[1])], true)
        doTeleportThing(cid, Exame_Chunnin.enter_pos)
        doPlayerSendTextMessage(cid, 21, '{Exame Chunnin} A luta irá começar em '..Exame_Chunnin.respawntime..' Segundos, prepare-se!')
        setPlayerStorageValue(cid, Exame_Chunnin.storage_ex, os.time()+Exame_Chunnin.hours*3600) return true
]]></movevent>
</mod>

 

NPC Script:
 

Spoiler

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 = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
local msg = string.lower(msg)
local moeda = 884
local t = {
   ["cetro vip"] = {30, 346},
   ["susano shield"] = {20, 2514},
   ["kakashi mask"] = {15, 11395},
   ["obito ring"] = {20, 11399},
   ["rikudou armor"] = {25, 11397},
   ["madara boots"] = {10, 111},
   ["madara legs"] = {10, 110},
   }
---------------------------------------------------------
if(msgcontains(msg, 'golden piece')) then
selfSay('Consegue-se na quest dos golden piece e eventos', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') and talkState[talkUser] == 1) then
if (getPlayerStorageValue(cid,112) > 0) then
selfSay('Voce ja acabou essa missao.', cid)
else
if(doPlayerRemoveItem(cid, 6500, 25) == TRUE) then
doPlayerAddExperience(cid,1000)
doPlayerAddItem(cid,10136,1)
selfSay('Obrigado! Se quiser ja podes fazer a {terceira missao}.. (ganhou um livro do kakashi de presete e ganhou 1000 de exp por ler)', cid)
else
selfSay('Voce não tens os  25 renegade essence ainda', cid)
end
end
return true
end
---------------------------------------------------------

if (msgcontains(msg, 'items') or msgcontains(msg, 'ITEMS'))then
local str = ""
str = str .. "Eu Posso lhe Vende Esse Items: "
for name, pos in pairs(t) do
str = str.." {"..name.."} por "..pos[1].." Golden Piece's, "
end
str = str .. "."
npcHandler:say(str, cid)
elseif t[msg] then
                if doPlayerRemoveItem(cid,moeda,t[msg][1]) then
                       doPlayerAddItem(cid,t[msg][2],1)
                        npcHandler:say("Aqui está seu ".. getItemNameById(t[msg][2]) .."!", cid)
                else
                        npcHandler:say("Voce nao tem points suficientes! para adquirir points faça a quest dos Golden Piece's ou participe de eventos ".. getItemNameById(moeda), cid)
                end
end
-----------------------------------------------------------------------------------------
if (msgcontains(msg, 'vocations') or msgcontains(msg, 'VOCATIONS'))then
local str = ""
str = str .. "Eu Posso lhe Vende Essas Vocaçao: "
for name, pos in pairs(s) do
str = str.." {"..name.."} por "..pos[1].." Golden Piece's, "
end
str = str .. "."
npcHandler:say(str, cid)
elseif s[msg] then
                if doPlayerRemoveItem(cid,moeda,s[msg][1]) then
                       doPlayerAddItem(cid,s[msg][2],1)
                        npcHandler:say("Aqui está seu ".. getItemNameById(s[msg][2]) .."!", cid)
                else
                        npcHandler:say("Voce nao tem points suficientes! para adquirir points faça a quest dos Golden Piece's ou participe de eventos ".. getItemNameById(moeda), cid)
                end
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

Arrumar Erro.jpg

Arrumar.png

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.8k

Informação Importante

Confirmação de Termo