Ir para conteúdo

Featured Replies

Postado

alguem ai me ajuda, não to conseguindo entender o erro ou selecionar,

se for algo facil me mostra oque foi modificado para eu saber oque está acontecendo de errado!!

 

ERROR

[Error - LuaInterface::loadFile] data/globalevents/scripts/Killua Cave Owners 2.lua:95: function at line 63 has more than 60 upvalues
[Error - Event::checkScript] Cannot load script (data/globalevents/scripts/Killua Cave Owners 2.lua)
data/globalevents/scripts/Killua Cave Owners 2.lua:95: function at line 63 has more than 60 upvalues

 

/globalevents/scripts/Killua Cave Owners 2

Spoiler

local function filtrateString(str)
    if type(str) ~= "string" then
        return false
    end
    local first, last = 0, 0
    local second, final = 0, #str
    for i = 1, #str do
        if string.byte(str:sub(i,i)) == string.byte('a') then
            first = i + 2
            for t = first, #str do
                if string.byte(str:sub(t,t)) == string.byte(' ') then
                    last = t - 1
                    break
                end
            end
        end
        if string.byte(str:sub(i,i)) == string.byte('b') then
            second = i + 2
        end
    end
    return {str:sub(first, last), str:sub(second, final)}
end
local f1, t1 = {x = 2435, y = 499, z = 7}, {x = 2578, y = 593, z = 7}
local f2, t2 = {x = 2445, y = 390, z = 7}, {x = 2588, y = 487, z = 7}
local f3, t3 = {x = 2461, y = 315, z = 7}, {x = 2518, y = 368, z = 7}
local f4, t4 = {x = 2423, y = 167, z = 7}, {x = 2561, y = 271, z = 7}
local f5, t5 = {x = 2457, y = 252, z = 6}, {x = 2520, y = 302, z = 6}
local f6, t6 = {x = 1932, y = 402, z = 7}, {x = 2081, y = 459, z = 7}
local f7, t7 = {x = 2194, y = 469, z = 6}, {x = 2282, y = 543, z = 6}
local f8, t8 = {x = 2058, y = 559, z = 7}, {x = 2135, y = 632, z = 7}
local f9, t9 = {x = 2049, y = 468, z = 9}, {x = 2143, y = 523, z = 9}
local f10, t10 = {x = 2068, y = 325, z = 8}, {x = 2160, y = 405, z = 8}
local f11, t11 = {x = 2592, y = 507, z = 7}, {x = 2730, y = 597, z = 7}
local f12, t12 = {x = 2609, y = 399, z = 7}, {x = 2723, y = 489, z = 7}
local f13, t13 = {x = 2526, y = 318, z = 7}, {x = 2580, y = 370, z = 7}
local f14, t14 = {x = 2267, y = 161, z = 7}, {x = 2398, y = 269, z = 7}
local f15, t15 = {x = 2769, y = 505, z = 7}, {x = 2919, y = 601, z = 7}
local f16, t16 = {x = 2245, y = 315, z = 7}, {x = 2393, y = 419, z = 7}
local f17, t17 = {x = 2598, y = 316, z = 7}, {x = 2655, y = 370, z = 7}
local f18, t18 = {x = 2411, y = 16, z = 7}, {x = 2557, y = 124, z = 7}
local f19, t19 = {x = 2284, y = 520, z = 7}, {x = 2427, y = 613, z = 7}
local f20, t20 = {x = 2745, y = 388, z = 7}, {x = 2874, y = 478, z = 7}
local f21, t21 = {x = 2578, y = 251, z = 7}, {x = 2633, y = 302, z = 7}
local f22, t22 = {x = 2551, y = 98, z = 7}, {x = 2676, y = 187, z = 7}
local f23, t23 = {x = 2529, y = 254, z = 6}, {x = 2593, y = 303, z = 6}
local f24, t24 = {x = 2433, y = 594, z = 7}, {x = 2580, y = 687, z = 7}
local f25, t25 = {x = 2877, y = 388, z = 7}, {x = 3006, y = 479, z = 7}
local f26, t26 = {x = 2636, y = 252, z = 7}, {x = 2691, y = 303, z = 7}
local f27, t27 = {x = 2808, y = 32, z = 7}, {x = 2938, y = 122, z = 7}
local f28, t28 = {x = 2243, y = 385, z = 6}, {x = 2321, y = 463, z = 6}
local f29, t29 = {x = 2141, y = 550, z = 7}, {x = 2226, y = 621, z = 7}
local f30, t30 = {x = 2125, y = 463, z = 8}, {x = 2215, y = 507, z = 8}
local f31, t31 = {x = 2175, y = 312, z = 8}, {x = 2279, y = 393, z = 8}
local f32, t32 = {x = 2674, y = 32, z = 7}, {x = 2803, y = 122, z = 7}
local f33, t33 = {x = 2589, y = 602, z = 7}, {x = 2736, y = 695, z = 7}
local f34, t34 = {x = 3009, y = 387, z = 7}, {x = 3138, y = 477, z = 7}
local f35, t35 = {x = 1644, y = 308, z = 7}, {x = 1794, y = 365, z = 7}
local f36, t36 = {x = 2141, y = 550, z = 7}, {x = 2226, y = 621, z = 7}    ---[

function onThink(interval, lastExecution)                    ---- ]
    local first = getPlayersInArea(f1, t1)
    local second = getPlayersInArea(f2, t2)
    local third = getPlayersInArea(f3, t3)
    local fourth = getPlayersInArea(f4, t4)
    local fifth = getPlayersInArea(f5, t5)
    local sixth = getPlayersInArea(f6, t6)
    local seventh = getPlayersInArea(f7, t7)
    local eighth = getPlayersInArea(f8, t8)
    local ninth = getPlayersInArea(f9, t9)
    local tenth = getPlayersInArea(f10, t10)
    local eleventh = getPlayersInArea(f11, t11)
    local twelfth = getPlayersInArea(f12, t12)
    local thirteenth = getPlayersInArea(f13, t13)
    local fourteenth = getPlayersInArea(f14, t14)
    local fifteenth = getPlayersInArea(f15, t15)
    local sixteenth = getPlayersInArea(f16, t16)
    local seventeenth = getPlayersInArea(f17, t17)
    local eighteenth = getPlayersInArea(f18, t18)
    
    local nineteenth = getPlayersInArea(f19, t19)
    local twentieth = getPlayersInArea(f20, t20)
    local twenty first = getPlayersInArea(f21, t21)
    local twenty second = getPlayersInArea(f22, t22)
    local twenty third = getPlayersInArea(f23, t23)
    local twenty fourth = getPlayersInArea(f24, t24)
    local twenty fifth = getPlayersInArea(f25, t25)
    local twenty sixth = getPlayersInArea(f26, t26)
    local twenty seventh = getPlayersInArea(f27, t27)
    local twenty eighth = getPlayersInArea(f28, t28)
    local twenty ninth = getPlayersInArea(f29, t29)
    local thirtieth = getPlayersInArea(f30, t30)
    local thirty first = getPlayersInArea(f31, t31)            ------ erro 95 aqui
    local thirty second = getPlayersInArea(f32, t32)
    local thirty third = getPlayersInArea(f33, t33)
    local thirty fourth = getPlayersInArea(f34, t34)
    local thirty fifth = getPlayersInArea(f35, t35)
    local thirty sixth = getPlayersInArea(f36, t36)
    
    if first then
        for _, pid in pairs(first) do
            if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822081))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822081))[1]) and tonumber(filtrateString(getGlobalStorageValue(822081))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 1 expirou. Você foi levado até seu templo.")
            end
        end
    end
    if second then
        for _, pid in pairs(second) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822082))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822082))[1]) and tonumber(filtrateString(getGlobalStorageValue(822082))[2]) <= os.time()    then
            doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 2 expirou. Você foi levado até seu templo.")
            end
        end
    end
    if third then
        for _, pid in pairs(third) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822083))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822083))[1]) and tonumber(filtrateString(getGlobalStorageValue(822083))[2]) <= os.time() then
                        doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 3 expirou. Você foi levado até seu templo.")
            end
        end
    end
    if fourth then
        for _, pid in pairs(fourth) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822084))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822084))[1]) and tonumber(filtrateString(getGlobalStorageValue(822084))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 4 expirou. Você foi levado até seu templo.")
            end
        end
    end
    if fifth then
        for _, pid in pairs(fifth) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822085))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822085))[1]) and tonumber(filtrateString(getGlobalStorageValue(822085))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 5 expirou. Você foi levado até seu templo.")
            end
        end
    end
    if sixth then
        for _, pid in pairs(sixth) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822086))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822086))[1]) and tonumber(filtrateString(getGlobalStorageValue(822086))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 6 expirou. Você foi levado até seu templo.")
            end
        end
    end
    if seventh then
        for _, pid in pairs(seventh) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822087))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822087))[1]) and tonumber(filtrateString(getGlobalStorageValue(822087))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 7 expirou. Você foi levado até seu templo.")
            end
        end
    end
    if eighth then
        for _, pid in pairs(eighth) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822088))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822088))[1]) and tonumber(filtrateString(getGlobalStorageValue(822088))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 8 expirou. Você foi levado até seu templo.")
            end
        end
    end
    if ninth then
        for _, pid in pairs(ninth) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822089))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822089))[1]) and tonumber(filtrateString(getGlobalStorageValue(822089))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 9 expirou. Você foi levado até seu templo.")
            end
        end
    end
    if tenth then
        for _, pid in pairs(tenth) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822090))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822090))[1]) and tonumber(filtrateString(getGlobalStorageValue(822090))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 10 expirou. Você foi levado até seu templo.")
            end
        end
    end
        if eleventh then
        for _, pid in pairs(eleventh) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822091))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822091))[1]) and tonumber(filtrateString(getGlobalStorageValue(822091))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 11 expirou. Você foi levado até seu templo.")
            end
        end
    end
        if twelfth then
        for _, pid in pairs(twelfth) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822092))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822092))[1]) and tonumber(filtrateString(getGlobalStorageValue(822092))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 12 expirou. Você foi levado até seu templo.")
            end
        end
    end
            if thirteenth then
        for _, pid in pairs(thirteenth) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822093))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822093))[1]) and tonumber(filtrateString(getGlobalStorageValue(822093))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 13 expirou. Você foi levado até seu templo.")
            end
        end
    end
            if fourteenth then
        for _, pid in pairs(fourteenth) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822094))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822094))[1]) and tonumber(filtrateString(getGlobalStorageValue(822094))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 14 expirou. Você foi levado até seu templo.")
            end
        end
    end
        if fifteenth then
        for _, pid in pairs(fifteenth) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822095))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822095))[1]) and tonumber(filtrateString(getGlobalStorageValue(822095))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 15 expirou. Você foi levado até seu templo.")
            end
        end
    end
        if sixteenth then
        for _, pid in pairs(sixteenth) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822096))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822096))[1]) and tonumber(filtrateString(getGlobalStorageValue(822096))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 16 expirou. Você foi levado até seu templo.")
            end
        end
    end
        if seventeenth then
        for _, pid in pairs(seventeenth) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822097))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822097))[1]) and tonumber(filtrateString(getGlobalStorageValue(822097))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 17 expirou. Você foi levado até seu templo.")
            end
        end
    end
        if eighteenth then
        for _, pid in pairs(eighteenth) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822098))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822098))[1]) and tonumber(filtrateString(getGlobalStorageValue(822098))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 18 expirou. Você foi levado até seu templo.")
            end
        end
    end
        if nineteenth then
        for _, pid in pairs(nineteenth) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822099))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822099))[1]) and tonumber(filtrateString(getGlobalStorageValue(822099))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 19 expirou. Você foi levado até seu templo.")
            end
        end
    end
            if twentieth then
        for _, pid in pairs(twentieth) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822100))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822100))[1]) and tonumber(filtrateString(getGlobalStorageValue(822100))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 20 expirou. Você foi levado até seu templo.")
            end
        end
    end
            if twenty firs then
        for _, pid in pairs(twenty firs) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822101))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822101))[1]) and tonumber(filtrateString(getGlobalStorageValue(822101))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 21 expirou. Você foi levado até seu templo.")
            end
        end
    end
            if twenty second then
        for _, pid in pairs(twenty second) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822102))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822102))[1]) and tonumber(filtrateString(getGlobalStorageValue(822102))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 22 expirou. Você foi levado até seu templo.")
            end
        end
    end
            if twenty third then
        for _, pid in pairs(twenty third) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822103))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822103))[1]) and tonumber(filtrateString(getGlobalStorageValue(822103))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 23 expirou. Você foi levado até seu templo.")
            end
        end
    end
            if twenty fourth then
        for _, pid in pairs(twenty fourth) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822104))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822104))[1]) and tonumber(filtrateString(getGlobalStorageValue(822104))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 24 expirou. Você foi levado até seu templo.")
            end
        end
    end
            if twenty fifth then
        for _, pid in pairs(twenty fifth) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822105))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822105))[1]) and tonumber(filtrateString(getGlobalStorageValue(822105))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 25 expirou. Você foi levado até seu templo.")
            end
        end
    end
            if twenty sixth then
        for _, pid in pairs(twenty sixth) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822106))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822106))[1]) and tonumber(filtrateString(getGlobalStorageValue(822106))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 26 expirou. Você foi levado até seu templo.")
            end
        end
    end
            if twenty seventh then
        for _, pid in pairs(twenty seventh) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822107))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822107))[1]) and tonumber(filtrateString(getGlobalStorageValue(822107))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 27 expirou. Você foi levado até seu templo.")
            end
        end
    end
            if twenty eighth then
        for _, pid in pairs(dez) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822108))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822108))[1]) and tonumber(filtrateString(getGlobalStorageValue(822108))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 28 expirou. Você foi levado até seu templo.")
            end
        end
    end
            if twenty ninth then
        for _, pid in pairs(twenty ninth) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822109))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822109))[1]) and tonumber(filtrateString(getGlobalStorageValue(822109))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 29 expirou. Você foi levado até seu templo.")
            end
        end
    end
            if thirtieth then
        for _, pid in pairs(thirtieth) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822110))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822110))[1]) and tonumber(filtrateString(getGlobalStorageValue(822110))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 30 expirou. Você foi levado até seu templo.")
            end
        end
    end
            if thirty first then
        for _, pid in pairs(thirty first) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822111))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822111))[1]) and tonumber(filtrateString(getGlobalStorageValue(822111))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 31 expirou. Você foi levado até seu templo.")
            end
        end
    end
            if thirty second then
        for _, pid in pairs(thirty second) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822112))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822112))[1]) and tonumber(filtrateString(getGlobalStorageValue(822112))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 32 expirou. Você foi levado até seu templo.")
            end
        end
    end
            if thirty third then
        for _, pid in pairs(thirty third) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822113))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822113))[1]) and tonumber(filtrateString(getGlobalStorageValue(822113))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 33 expirou. Você foi levado até seu templo.")
            end
        end
    end
        if thirty fourth then
        for _, pid in pairs(thirty fourth do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822114))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822114))[1]) and tonumber(filtrateString(getGlobalStorageValue(822114))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 34 expirou. Você foi levado até seu templo.")
            end
        end
    end
    if thirty fifth then
        for _, pid in pairs(thirty fifth) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822115))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822115))[1]) and tonumber(filtrateString(getGlobalStorageValue(822115))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 35 expirou. Você foi levado até seu templo.")
            end
        end
    end
        if thirty sixth then
        for _, pid in pairs(thirty sixth) do
                if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822116))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822116))[1]) and tonumber(filtrateString(getGlobalStorageValue(822116))[2]) <= os.time() then
                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                doPlayerPopupFYI(pid, "Seu tempo como dono da Cave 36 expirou. Você foi levado até seu templo.")
            end
        end
    end

    return true
end
    

 

 

Editado por mateusmoretti (veja o histórico de edições)

Resolvido por xWhiteWolf

Ir para solução
  • Respostas 7
  • Visualizações 1.2k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • perceba que de 72 declarações de variáveis que vc tinha (72 local ____) agora você tem só um local positions e todo o resto do código funciona em função dessa tabela, sem precisar repetir código desne

  • vc só pode ter 60 declarações de váriáveis... se vc tem mais que isso vc tá fazendo algo errado. Nesse caso, o erro é usar 60 variáveis ao invés de uma simples tabela pra organizar tudo.

Postado

vc só pode ter 60 declarações de váriáveis... se vc tem mais que isso vc tá fazendo algo errado.

Nesse caso, o erro é usar 60 variáveis ao invés de uma simples tabela pra organizar tudo.

Todos os meus trabalhos importantes estão na seção "Sobre mim" no meu perfil; Dá uma passada lá!

"Há três caminhos para o fracasso: não ensinar o que se sabe, não praticar o que se ensina, e não perguntar o que se ignora." - São Beda

I7Pm6ih.png

(obg ao @Beeny por fazer essa linda sign <3)

Postado
  • Autor
10 horas atrás, xWhiteWolf disse:

vc só pode ter 60 declarações de váriáveis... se vc tem mais que isso vc tá fazendo algo errado.

Nesse caso, o erro é usar 60 variáveis ao invés de uma simples tabela pra organizar tudo.

hmm entendi, e como ficaria essas variaveis whit?

Postado
  • Solução
2 horas atrás, mateusmoretti disse:

hmm entendi, e como ficaria essas variaveis whit?



 

Spoiler

local function filtrateString(str)
    if type(str) ~= "string" then
        return false
    end
    local first, last = 0, 0
    local second, final = 0, #str
    for i = 1, #str do
        if string.byte(str:sub(i,i)) == string.byte('a') then
            first = i + 2
            for t = first, #str do
                if string.byte(str:sub(t,t)) == string.byte(' ') then
                    last = t - 1
                    break
                end
            end
        end
        if string.byte(str:sub(i,i)) == string.byte('b') then
            second = i + 2
        end
    end
    return {str:sub(first, last), str:sub(second, final)}
end

local positions = {
	[1] = {{x = 2435, y = 499, z = 7}, {x = 2578, y = 593, z = 7}},
	[2] = {{x = 2445, y = 390, z = 7}, {x = 2588, y = 487, z = 7}},
	[3] = {{x = 2461, y = 315, z = 7}, {x = 2518, y = 368, z = 7}},
	[4] = {{x = 2423, y = 167, z = 7}, {x = 2561, y = 271, z = 7}},
	[5] = {{x = 2457, y = 252, z = 6}, {x = 2520, y = 302, z = 6}},
	[6] = {{x = 1932, y = 402, z = 7}, {x = 2081, y = 459, z = 7}},
	[7] = {{x = 2194, y = 469, z = 6}, {x = 2282, y = 543, z = 6}},
	[8] = {{x = 2058, y = 559, z = 7}, {x = 2135, y = 632, z = 7}},
	[9] = {{x = 2049, y = 468, z = 9}, {x = 2143, y = 523, z = 9}},
	[10] = {{x = 2068, y = 325, z = 8}, {x = 2160, y = 405, z = 8}},
	[11] = {{x = 2592, y = 507, z = 7}, {x = 2730, y = 597, z = 7}},
	[12] = {{x = 2609, y = 399, z = 7}, {x = 2723, y = 489, z = 7}},
	[13] = {{x = 2526, y = 318, z = 7}, {x = 2580, y = 370, z = 7}},
	[14] = {{x = 2267, y = 161, z = 7}, {x = 2398, y = 269, z = 7}},
	[15] = {{x = 2769, y = 505, z = 7}, {x = 2919, y = 601, z = 7}},
	[16] = {{x = 2245, y = 315, z = 7}, {x = 2393, y = 419, z = 7}},
	[17] = {{x = 2598, y = 316, z = 7}, {x = 2655, y = 370, z = 7}},
	[18] = {{x = 2411, y = 16, z = 7}, {x = 2557, y = 124, z = 7}},
	[19] = {{x = 2284, y = 520, z = 7}, {x = 2427, y = 613, z = 7}},
	[20] = {{x = 2745, y = 388, z = 7}, {x = 2874, y = 478, z = 7}},
	[21] = {{x = 2578, y = 251, z = 7}, {x = 2633, y = 302, z = 7}},
	[22] = {{x = 2551, y = 98, z = 7}, {x = 2676, y = 187, z = 7}},
	[23] = {{x = 2529, y = 254, z = 6}, {x = 2593, y = 303, z = 6}},
	[24] = {{x = 2433, y = 594, z = 7}, {x = 2580, y = 687, z = 7}},
	[25] = {{x = 2877, y = 388, z = 7}, {x = 3006, y = 479, z = 7}},
	[26] = {{x = 2636, y = 252, z = 7}, {x = 2691, y = 303, z = 7}},
	[27] = {{x = 2808, y = 32, z = 7}, {x = 2938, y = 122, z = 7}},
	[28] = {{x = 2243, y = 385, z = 6}, {x = 2321, y = 463, z = 6}},
	[29] = {{x = 2141, y = 550, z = 7}, {x = 2226, y = 621, z = 7}},
	[30] = {{x = 2125, y = 463, z = 8}, {x = 2215, y = 507, z = 8}},
	[31] = {{x = 2175, y = 312, z = 8}, {x = 2279, y = 393, z = 8}},
	[32] = {{x = 2674, y = 32, z = 7}, {x = 2803, y = 122, z = 7}},
	[33] = {{x = 2589, y = 602, z = 7}, {x = 2736, y = 695, z = 7}},
	[34] = {{x = 3009, y = 387, z = 7}, {x = 3138, y = 477, z = 7}},
	[35] = {{x = 1644, y = 308, z = 7}, {x = 1794, y = 365, z = 7}},
	[36] = {{x = 2141, y = 550, z = 7}, {x = 2226, y = 621, z = 7}}    ---[
}

function onThink(interval, lastExecution)
	for i = 1, #positions do	
		local players = getPlayersInArea(positions[i][1], positions[i][2])
		
		if players then
			for _, pid in pairs(players) do
				if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822080+i))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822080+i))[1]) and tonumber(filtrateString(getGlobalStorageValue(822080+i))[2]) <= os.time() then
					doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
					doPlayerPopupFYI(pid, "Seu tempo como dono da Cave ".. i .." expirou. Você foi levado até seu templo.")
				end
			end
		end
	end    

return true
end

 

perceba que de 72 declarações de variáveis que vc tinha (72 local ____) agora você tem só um local positions e todo o resto do código funciona em função dessa tabela, sem precisar repetir código desnecessário.

Todos os meus trabalhos importantes estão na seção "Sobre mim" no meu perfil; Dá uma passada lá!

"Há três caminhos para o fracasso: não ensinar o que se sabe, não praticar o que se ensina, e não perguntar o que se ignora." - São Beda

I7Pm6ih.png

(obg ao @Beeny por fazer essa linda sign <3)

Postado
  • Autor
19 minutos atrás, xWhiteWolf disse:



 

  Ocultar conteúdo


local function filtrateString(str)
    if type(str) ~= "string" then
        return false
    end
    local first, last = 0, 0
    local second, final = 0, #str
    for i = 1, #str do
        if string.byte(str:sub(i,i)) == string.byte('a') then
            first = i + 2
            for t = first, #str do
                if string.byte(str:sub(t,t)) == string.byte(' ') then
                    last = t - 1
                    break
                end
            end
        end
        if string.byte(str:sub(i,i)) == string.byte('b') then
            second = i + 2
        end
    end
    return {str:sub(first, last), str:sub(second, final)}
end

local positions = {
	[1] = {{x = 2435, y = 499, z = 7}, {x = 2578, y = 593, z = 7}},
	[2] = {{x = 2445, y = 390, z = 7}, {x = 2588, y = 487, z = 7}},
	[3] = {{x = 2461, y = 315, z = 7}, {x = 2518, y = 368, z = 7}},
	[4] = {{x = 2423, y = 167, z = 7}, {x = 2561, y = 271, z = 7}},
	[5] = {{x = 2457, y = 252, z = 6}, {x = 2520, y = 302, z = 6}},
	[6] = {{x = 1932, y = 402, z = 7}, {x = 2081, y = 459, z = 7}},
	[7] = {{x = 2194, y = 469, z = 6}, {x = 2282, y = 543, z = 6}},
	[8] = {{x = 2058, y = 559, z = 7}, {x = 2135, y = 632, z = 7}},
	[9] = {{x = 2049, y = 468, z = 9}, {x = 2143, y = 523, z = 9}},
	[10] = {{x = 2068, y = 325, z = 8}, {x = 2160, y = 405, z = 8}},
	[11] = {{x = 2592, y = 507, z = 7}, {x = 2730, y = 597, z = 7}},
	[12] = {{x = 2609, y = 399, z = 7}, {x = 2723, y = 489, z = 7}},
	[13] = {{x = 2526, y = 318, z = 7}, {x = 2580, y = 370, z = 7}},
	[14] = {{x = 2267, y = 161, z = 7}, {x = 2398, y = 269, z = 7}},
	[15] = {{x = 2769, y = 505, z = 7}, {x = 2919, y = 601, z = 7}},
	[16] = {{x = 2245, y = 315, z = 7}, {x = 2393, y = 419, z = 7}},
	[17] = {{x = 2598, y = 316, z = 7}, {x = 2655, y = 370, z = 7}},
	[18] = {{x = 2411, y = 16, z = 7}, {x = 2557, y = 124, z = 7}},
	[19] = {{x = 2284, y = 520, z = 7}, {x = 2427, y = 613, z = 7}},
	[20] = {{x = 2745, y = 388, z = 7}, {x = 2874, y = 478, z = 7}},
	[21] = {{x = 2578, y = 251, z = 7}, {x = 2633, y = 302, z = 7}},
	[22] = {{x = 2551, y = 98, z = 7}, {x = 2676, y = 187, z = 7}},
	[23] = {{x = 2529, y = 254, z = 6}, {x = 2593, y = 303, z = 6}},
	[24] = {{x = 2433, y = 594, z = 7}, {x = 2580, y = 687, z = 7}},
	[25] = {{x = 2877, y = 388, z = 7}, {x = 3006, y = 479, z = 7}},
	[26] = {{x = 2636, y = 252, z = 7}, {x = 2691, y = 303, z = 7}},
	[27] = {{x = 2808, y = 32, z = 7}, {x = 2938, y = 122, z = 7}},
	[28] = {{x = 2243, y = 385, z = 6}, {x = 2321, y = 463, z = 6}},
	[29] = {{x = 2141, y = 550, z = 7}, {x = 2226, y = 621, z = 7}},
	[30] = {{x = 2125, y = 463, z = 8}, {x = 2215, y = 507, z = 8}},
	[31] = {{x = 2175, y = 312, z = 8}, {x = 2279, y = 393, z = 8}},
	[32] = {{x = 2674, y = 32, z = 7}, {x = 2803, y = 122, z = 7}},
	[33] = {{x = 2589, y = 602, z = 7}, {x = 2736, y = 695, z = 7}},
	[34] = {{x = 3009, y = 387, z = 7}, {x = 3138, y = 477, z = 7}},
	[35] = {{x = 1644, y = 308, z = 7}, {x = 1794, y = 365, z = 7}},
	[36] = {{x = 2141, y = 550, z = 7}, {x = 2226, y = 621, z = 7}}    ---[
}

function onThink(interval, lastExecution)
	for i = 1, #positions do	
		local players = getPlayersInArea(positions[i][1], positions[i][2])
		
		if players then
			for _, pid in pairs(players) do
				if getPlayerAccountId(pid) ~= tonumber(filtrateString(getGlobalStorageValue(822080+i))[1]) or getPlayerAccountId(pid) == tonumber(filtrateString(getGlobalStorageValue(822080+i))[1]) and tonumber(filtrateString(getGlobalStorageValue(822080+i))[2]) <= os.time() then
					doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
					doPlayerPopupFYI(pid, "Seu tempo como dono da Cave ".. i .." expirou. Você foi levado até seu templo.")
				end
			end
		end
	end    

return true
end

 

perceba que de 72 declarações de variáveis que vc tinha (72 local ____) agora você tem só um local positions e todo o resto do código funciona em função dessa tabela, sem precisar repetir código desnecessário.

vou testar,

desse modo que você refez, qualquer uma dessa cave ela jogará para fora quando acabar o tempo?

 

 

EDITED----

funcionou perfeito @xWhiteWolf - obrigado mesmo!

Editado por mateusmoretti (veja o histórico de edições)

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.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo