Ir para conteúdo
  • 0

(resolvido) Erro movements/CTF Killua


mateusmoretti

Pergunta

Fala galera blz.

Baixei um ot que tem esse ctf e ele ta pegando 100%. funcionando certim..

peguei todas as configuraçãoes editei certinho, quando ligo o meu server não da 1 erro não da 1 nada. agora quandio eu uso o comando !ctf para ligar

ta dando isso que não ideia onde arrumar!!

 

data/movements/scripts/CTF killua

function onStepIn(cid, item, position, fromPosition)	if item.actionid == 5436 then		if getPlayerStorageValue(cid, CTF.storages.redFlag) == 1 then			setGlobalStorageValue(CTF.storages.greenTeam, getStorageZero(CTF.storages.greenTeam) + 1)			warnPlayersWithStorage(822066, 1, MESSAGE_STATUS_WARNING, "O jogador "..getCreatureName(cid).." levou a Bandeira Vermelha até a base verde e marcou um ponto para o time verde!")			warnPlayersWithStorage(822066, 1, MESSAGE_STATUS_CONSOLE_BLUE, "Placar:\n Time Verde -> "..getStorageZero(CTF.storages.greenTeam).." ponto(s).\n Time Vermelho: -> "..getStorageZero(CTF.storages.redTeam).." ponto(s).")			doPlayerSetStorageValue(cid, CTF.storages.redFlag, -1)			doSendMagicEffect(CTF.redFlagPos, 28)			if getStorageZero(CTF.storages.greenTeam) == 10 then				warnPlayersWithStorage(822066, 1, 25, "O Time Verde atingiu 10 pontos e venceu o evento! Os membros que ainda estão presentes receberam alguns prêmios!")				CTF.removeFlags()				for _, pid in pairs(getPlayersOnline()) do					if getPlayerStorageValue(pid, CTF.storages.greenTeam) == 1 then						local am = {8302, 8306, 8300, 5957}						doPlayerAddItem(pid, 2157, 30)						doPlayerAddItem(pid, am[math.random(1, 4)], 1)					end				end				for _, pid in pairs(getPlayersOnline()) do					if getPlayerStorageValue(pid, 822066) == 1 then						if getPlayerStorageValue(pid, CTF.storages.greenFlag) == 1 or getPlayerStorageValue(pid, CTF.storages.redFlag) == 1 then							doPlayerSetStorageValue(pid, CTF.storages.greenFlag, -1)							doPlayerSetStorageValue(pid, CTF.storages.redFlag, -1)						end						doTeleportThing(pid, CTF.exit_)						doPlayerSetStorageValue(pid, 822066, -1)						doPlayerSetStorageValue(pid, CTF.storages.redTeam, -1)						doPlayerSetStorageValue(pid, CTF.storages.greenTeam, -1)						doRemoveCondition(pid, CONDITION_OUTFIT)					end				end			else										local flag = doCreateItem(CTF.redFlag, 1, CTF.redFlagPos)				doItemSetAttribute(flag, 'aid', 5435)			end		end	elseif item.actionid == 5437 then		if getPlayerStorageValue(cid, CTF.storages.greenFlag) == 1 then			setGlobalStorageValue(CTF.storages.redTeam, getStorageZero(CTF.storages.redTeam) + 1)			warnPlayersWithStorage(822066, 1, MESSAGE_STATUS_WARNING, "O jogador "..getCreatureName(cid).." levou a Bandeira Verde até a base vermelha e marcou um ponto para o time vermelho!")			warnPlayersWithStorage(822066, 1, MESSAGE_STATUS_CONSOLE_BLUE, "Placar:\n Time Vermelho -> "..getStorageZero(CTF.storages.redTeam).." ponto(s).\n Time Verde: -> "..getStorageZero(CTF.storages.greenTeam).." ponto(s).")			doPlayerSetStorageValue(cid, CTF.storages.greenFlag, -1)			doSendMagicEffect(CTF.greenFlagPos, 28)			if getStorageZero(CTF.storages.redTeam) == 10 then				warnPlayersWithStorage(822066, 1, 25, "O Time Vermelho atingiu 10 pontos e venceu o evento! Os membros que ainda estão presentes receberam alguns prêmios!")				CTF.removeFlags()				for _, pid in pairs(getPlayersOnline()) do					if getPlayerStorageValue(pid, CTF.storages.redTeam) == 1 then						local am = {8302, 8306, 8300, 5957}						doPlayerAddItem(pid, 2157, 30)						doPlayerAddItem(pid, am[math.random(1, 4)], 1)										end				end				for _, pid in pairs(getPlayersOnline()) do					if getPlayerStorageValue(pid, 822066) == 1 then						if getPlayerStorageValue(pid, CTF.storages.greenFlag) == 1 or getPlayerStorageValue(pid, CTF.storages.redFlag) == 1 then							doPlayerSetStorageValue(pid, CTF.storages.greenFlag, -1)							doPlayerSetStorageValue(pid, CTF.storages.redFlag, -1)						end						doTeleportThing(pid, CTF.exit_)						doPlayerSetStorageValue(pid, 822066, -1)						doPlayerSetStorageValue(pid, CTF.storages.redTeam, -1)						doPlayerSetStorageValue(pid, CTF.storages.greenTeam, -1)						doRemoveCondition(pid, CONDITION_OUTFIT)					end				end			else										local flag = doCreateItem(CTF.greenFlag, 1, CTF.greenFlagPos)				doItemSetAttribute(flag, 'aid', 5434)			end		end	end	return trueend

 

bd4f5f97579a4d8e81d11d0e899062fe.png

bd4f5f97579a4d8e81d11d0e899062fe.thumb.png.2a1a46f6fadceb8b1de0b01d2236a099.png

Editado por mateusmoretti
Link para o comentário
Compartilhar em outros sites

6 respostass a esta questão

Posts Recomendados

  • 0

cria um arquivo.lua na lib e adiciona esta função:

function getPlayersInArea(fromPos, toPos) -- function by amoeba13    playersInArea = {}    for x = fromPos.x, toPos.x do        for y = fromPos.y, toPos.y do            for z = fromPos.z, toPos.z do                totalArea = {x=x, y=y, z=z}                playerz = getTopCreature(totalArea)                if isPlayer(playerz.uid) then                    table.insert(playersInArea, playerz.uid)                                    end            end        end    end    return playersInAreaend

A outra função deveria ter vindo junto com a configuração do sistema, creio eu kkk, mas, porque nao tenta adicionar este sistema?:

 

Link para o comentário
Compartilhar em outros sites

  • 0
1 hora atrás, Deadpool disse:

cria um arquivo.lua na lib e adiciona esta função:

function getPlayersInArea(fromPos, toPos) -- function by amoeba13    playersInArea = {}    for x = fromPos.x, toPos.x do        for y = fromPos.y, toPos.y do            for z = fromPos.z, toPos.z do                totalArea = {x=x, y=y, z=z}                playerz = getTopCreature(totalArea)                if isPlayer(playerz.uid) then                    table.insert(playersInArea, playerz.uid)                                    end            end        end    end    return playersInAreaend

A outra função deveria ter vindo junto com a configuração do sistema, creio eu kkk, mas, porque nao tenta adicionar este sistema?:

dead

 

dead eu fiz como me pediu ai.. porem da esse error agora!

 

 

[10/12/2016 13:53:24] [Error - MoveEvents Interface] 

[10/12/2016 13:53:24] data/movements/scripts/CTF Killua.lua:onStepIn

[10/12/2016 13:53:24] Description: 

[10/12/2016 13:53:24] data/movements/scripts/CTF Killua.lua:4: attempt to call global 'getStorageZero' (a nil value)

[10/12/2016 13:53:24] stack traceback:

[10/12/2016 13:53:24]     data/movements/scripts/CTF Killua.lua:4: in function <data/movements/scripts/CTF Killua.lua:1>

Link para o comentário
Compartilhar em outros sites

  • 0

faz o seguinte, sabe o arquivo que você criou? entao, abre ele e apaga a função que eu mandei você colocar.. dai, coloca isso e salva. Dai me diz se funcionou:

Spoiler
-- lib and functions by Vitor Bertolucci (Killua)function warnPlayersWithStorage(storage, value, class, message) -- By Killua    if not value then value = 1 end    if not class then class = MESSAGE_SATUS_CONSOLE_WARNING end    if not storage or not message then return end    if #getPlayersOnline() == 0 then        return    end    for _, pid in pairs(getPlayersOnline()) do        if getPlayerStorageValue(pid, storage) == value then            doPlayerSendTextMessage(pid, class, message)        end    if getPlayerAccess(pid) >= 4 then          doPlayerSendTextMessage(pid, class, "Message to those with storage "..storage..message) -- Gms will always receive the messages    end    endendfunction getPlayerStorageZero(cid, storage) -- By Killua    local sto = getPlayerStorageValue(cid, storage)    return sto > 0 and sto or 0endfunction getStorageZero(storage) -- By Killua    local sto = getGlobalStorageValue(storage)    return sto > 0 and sto or 0endfunction countTable(table) -- By Killua    local y = 0    if type(table) == "table" then        for _ in pairs(table) do            y = y + 1        end        return y    end    return falseendfunction getPlayersInArea(frompos, topos) -- By Killua    local players_ = {}    local count = 1    for _, pid in pairs(getPlayersOnline()) do        if isInArea(getCreaturePosition(pid), frompos, topos) then            players_[count] = pid            count = count + 1        end    end    return countTable(players_) > 0 and players_ or falseendfunction getGuildNameByID(gid) -- By Killua    local query = db.getResult("SELECT `name` FROM `guilds` WHERE `id` = '"..gid.."'")    if query:getID() == -1 then        return false    end    local name = query:getDataString("name")    query:free()    return nameendfunction getContainerItemsInfo(containerUid) -- By Killua    local table = {}    if containerUid and containerUid > 0 then        local a = 0         for i = 0, getContainerSize(containerUid) do            local item = getContainerItem(containerUid,i)            a = a + 1            table[a] = {uid = item.uid, itemid = item.itemid, quant = item.type}        end        return table    end    return falseendfunction getTableEqualValues(table) -- By Killua    local ck = {}    local eq = {}    if type(table) == "table" then          if countTable(table) and countTable(table) > 0 then               for i = 1, countTable(table) do                 if not isInArray(ck, table[i]) then                    ck[i] = table[i]                else                    eq[i] = table[i]                end            end            return countTable(eq) > 0 and eq or 0        end    end    return falseendfunction killuaGetItemLevel(uid) -- By Killua    local name = getItemName(uid)    local pos = 0    for i = 1, #name do        if string.byte(name:sub(i,i)) == string.byte('+') then            pos = i + 1            break        end    end    return tonumber(name:sub(pos,pos))endk_table_storage_lib = {    filtrateString = function(str) -- By Killua        local tb, x, old, last = {}, 0, 0, 0        local first, second, final = 0, 0, 0        if type(str) ~= "string" then            return tb        end        for i = 2, #str-1 do            if string.byte(str:sub(i,i)) == string.byte(':') then                x, second, last = x+1, i-1, i+2                for t = last,#str-1 do                    if string.byte(str:sub(t,t)) == string.byte(',') then                        first = x == 1 and 2 or old                        old, final = t+2, t-1                        local index, var = str:sub(first,second), str:sub(last,final)                        tb[tonumber(index) or tostring(index)] = tonumber(var) or tostring(var)                        break                    end                end            end        end        return tb    end,    translateIntoString = function(tb) -- By Killua        local str = ""        if type(tb) ~= "table" then            return str        end        for i, t in pairs(tb) do            str = str..i..": "..t..", "        end        str = "a"..str.."a"        return tostring(str)    end}function setPlayerTableStorage(cid, key, value) -- By Killua    return doPlayerSetStorageValue(cid, key, k_table_storage_lib.translateIntoString(value))endfunction getPlayerTableStorage(cid, key) -- By Killua    return k_table_storage_lib.filtrateString(getPlayerStorageValue(cid, key))endfunction setGlobalTableStorage(key, value) -- By Killua    return setGlobalStorageValue(key, k_table_storage_lib.translateIntoString(value))endfunction getGlobalTableStorage(key) -- By Killua    return k_table_storage_lib.filtrateString(getGlobalStorageValue(key))endfunction printTable(table, includeIndices,prnt) -- By Killua    if includeIndices == nil then includeIndices = true end    if prnt == nil then prnt = true end    if type(table) ~= "table" then        error("Argument must be a table")        return    end    local str, c = "{", ""    for v, b in pairs(table) do        if type(b) == "table" then            str = includeIndices and str..c.."["..v..]".." = "..printTable(b,true,false) or str..c..printTable(b,false,false)        else            str = includeIndices and str..c.."["..v..]".." = "..b or str..c..b        end        c = ", "    end    str = str.."}"    if prnt then print(str) end    return strendfunction checkString(str) -- By Killua    local check = true    for i = 1, #str do        local letra = string.byte(str:sub(i,i))        if letra >= string.byte('a') and letra <= string.byte('z') or letra >= string.byte('A') and letra <= string.byte('Z') or letra >= string.byte('0') and letra <= string.byte('9') then            check = true        else            check = false            break        end    end    return checkendfunction isWalkable(cid, pos, considerCreatures) -- By Killua    if considerCreatures == nil then considerCreatures = true end    if getTopCreature(pos).uid and getTopCreature(pos).uid > 0 then        if considerCreatures then return false else return true end    end      pos.stackpos = 0    if getTileThingByPos(pos).uid ~= 0 then        if doTileQueryAdd(cid, pos) == RETURNVALUE_NOERROR then            return true        end    end    return falseendfunction isArmor(uid) -- By Killua    if tonumber(getItemAttribute(uid,"armor")) and tonumber(getItemAttribute(uid,"armor")) > 0 and getItemWeaponType(uid) == 0 then        return true    end    return falseendfunction isWeapon(uid) -- By Killua    return getItemWeaponType(uid) ~= 0endfunction isShield(uid) -- By Killua    return getItemWeaponType(uid) == 5endfunction isSword(uid) -- By Killua    return getItemWeaponType(uid) == 1endfunction isClub(uid) -- By Killua    return getItemWeaponType(uid) == 2endfunction isAxe(uid) -- By Killua    return getItemWeaponType(uid) == 3endfunction isBow(uid) -- By Killua    return getItemWeaponType(uid) == 4endfunction isWand(uid) -- By Killua    return getItemWeaponType(uid) == 7end

 

 

Link para o comentário
Compartilhar em outros sites

  • 0
8 minutos atrás, Deadpool disse:

faz o seguinte, sabe o arquivo que você criou? entao, abre ele e apaga a função que eu mandei você colocar.. dai, coloca isso e salva. Dai me diz se funcionou:

  Ocultar conteúdo
-- lib and functions by Vitor Bertolucci (Killua)function warnPlayersWithStorage(storage, value, class, message) -- By Killua    if not value then value = 1 end    if not class then class = MESSAGE_SATUS_CONSOLE_WARNING end    if not storage or not message then return end    if #getPlayersOnline() == 0 then        return    end    for _, pid in pairs(getPlayersOnline()) do        if getPlayerStorageValue(pid, storage) == value then            doPlayerSendTextMessage(pid, class, message)        end    if getPlayerAccess(pid) >= 4 then          doPlayerSendTextMessage(pid, class, "Message to those with storage "..storage..message) -- Gms will always receive the messages    end    endendfunction getPlayerStorageZero(cid, storage) -- By Killua    local sto = getPlayerStorageValue(cid, storage)    return sto > 0 and sto or 0endfunction getStorageZero(storage) -- By Killua    local sto = getGlobalStorageValue(storage)    return sto > 0 and sto or 0endfunction countTable(table) -- By Killua    local y = 0    if type(table) == "table" then        for _ in pairs(table) do            y = y + 1        end        return y    end    return falseendfunction getPlayersInArea(frompos, topos) -- By Killua    local players_ = {}    local count = 1    for _, pid in pairs(getPlayersOnline()) do        if isInArea(getCreaturePosition(pid), frompos, topos) then            players_[count] = pid            count = count + 1        end    end    return countTable(players_) > 0 and players_ or falseendfunction getGuildNameByID(gid) -- By Killua    local query = db.getResult("SELECT `name` FROM `guilds` WHERE `id` = '"..gid.."'")    if query:getID() == -1 then        return false    end    local name = query:getDataString("name")    query:free()    return nameendfunction getContainerItemsInfo(containerUid) -- By Killua    local table = {}    if containerUid and containerUid > 0 then        local a = 0         for i = 0, getContainerSize(containerUid) do            local item = getContainerItem(containerUid,i)            a = a + 1            table[a] = {uid = item.uid, itemid = item.itemid, quant = item.type}        end        return table    end    return falseendfunction getTableEqualValues(table) -- By Killua    local ck = {}    local eq = {}    if type(table) == "table" then          if countTable(table) and countTable(table) > 0 then               for i = 1, countTable(table) do                 if not isInArray(ck, table[i]) then                    ck[i] = table[i]                else                    eq[i] = table[i]                end            end            return countTable(eq) > 0 and eq or 0        end    end    return falseendfunction killuaGetItemLevel(uid) -- By Killua    local name = getItemName(uid)    local pos = 0    for i = 1, #name do        if string.byte(name:sub(i,i)) == string.byte('+') then            pos = i + 1            break        end    end    return tonumber(name:sub(pos,pos))endk_table_storage_lib = {    filtrateString = function(str) -- By Killua        local tb, x, old, last = {}, 0, 0, 0        local first, second, final = 0, 0, 0        if type(str) ~= "string" then            return tb        end        for i = 2, #str-1 do            if string.byte(str:sub(i,i)) == string.byte(':') then                x, second, last = x+1, i-1, i+2                for t = last,#str-1 do                    if string.byte(str:sub(t,t)) == string.byte(',') then                        first = x == 1 and 2 or old                        old, final = t+2, t-1                        local index, var = str:sub(first,second), str:sub(last,final)                        tb[tonumber(index) or tostring(index)] = tonumber(var) or tostring(var)                        break                    end                end            end        end        return tb    end,    translateIntoString = function(tb) -- By Killua        local str = ""        if type(tb) ~= "table" then            return str        end        for i, t in pairs(tb) do            str = str..i..": "..t..", "        end        str = "a"..str.."a"        return tostring(str)    end}function setPlayerTableStorage(cid, key, value) -- By Killua    return doPlayerSetStorageValue(cid, key, k_table_storage_lib.translateIntoString(value))endfunction getPlayerTableStorage(cid, key) -- By Killua    return k_table_storage_lib.filtrateString(getPlayerStorageValue(cid, key))endfunction setGlobalTableStorage(key, value) -- By Killua    return setGlobalStorageValue(key, k_table_storage_lib.translateIntoString(value))endfunction getGlobalTableStorage(key) -- By Killua    return k_table_storage_lib.filtrateString(getGlobalStorageValue(key))endfunction printTable(table, includeIndices,prnt) -- By Killua    if includeIndices == nil then includeIndices = true end    if prnt == nil then prnt = true end    if type(table) ~= "table" then        error("Argument must be a table")        return    end    local str, c = "{", ""    for v, b in pairs(table) do        if type(b) == "table" then            str = includeIndices and str..c.."["..v..]".." = "..printTable(b,true,false) or str..c..printTable(b,false,false)        else            str = includeIndices and str..c.."["..v..]".." = "..b or str..c..b        end        c = ", "    end    str = str.."}"    if prnt then print(str) end    return strendfunction checkString(str) -- By Killua    local check = true    for i = 1, #str do        local letra = string.byte(str:sub(i,i))        if letra >= string.byte('a') and letra <= string.byte('z') or letra >= string.byte('A') and letra <= string.byte('Z') or letra >= string.byte('0') and letra <= string.byte('9') then            check = true        else            check = false            break        end    end    return checkendfunction isWalkable(cid, pos, considerCreatures) -- By Killua    if considerCreatures == nil then considerCreatures = true end    if getTopCreature(pos).uid and getTopCreature(pos).uid > 0 then        if considerCreatures then return false else return true end    end      pos.stackpos = 0    if getTileThingByPos(pos).uid ~= 0 then        if doTileQueryAdd(cid, pos) == RETURNVALUE_NOERROR then            return true        end    end    return falseendfunction isArmor(uid) -- By Killua    if tonumber(getItemAttribute(uid,"armor")) and tonumber(getItemAttribute(uid,"armor")) > 0 and getItemWeaponType(uid) == 0 then        return true    end    return falseendfunction isWeapon(uid) -- By Killua    return getItemWeaponType(uid) ~= 0endfunction isShield(uid) -- By Killua    return getItemWeaponType(uid) == 5endfunction isSword(uid) -- By Killua    return getItemWeaponType(uid) == 1endfunction isClub(uid) -- By Killua    return getItemWeaponType(uid) == 2endfunction isAxe(uid) -- By Killua    return getItemWeaponType(uid) == 3endfunction isBow(uid) -- By Killua    return getItemWeaponType(uid) == 4endfunction isWand(uid) -- By Killua    return getItemWeaponType(uid) == 7end

 

 

Zica mesmo. kkkkk funcionou certinho,

to esperando pra ver se o evento começa agora ou da algum outro erro!

obrigado mesmoo cosneguiu me ajudar zicaaa !

 

Funcionouuuuuuuuuuuuuuuuuuuuuuuuuuu 100% obrigado caraaaa!

Editado por mateusmoretti
Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...