Ir para conteúdo
  • Cadastre-se

Normal [RESOLVIDO] getDataString


Posts Recomendados

E aí galera do TK! Alguem de plantão ai pode me ajudar?

To a alguns dias quebrando a cabeça com isso.

O erro dá sempre que executa o "getDataString("guild")" dessa vez eu provoquei ele no movements, mas ele tambem acontece no creaturescripts e globalevent, pode ser alguma configuração na database ou distro, eu acho... Eu sou bem leigo no assunto.

Estou tendo o seguinte erro:

Description: 
data/lib/004-database.lua:82: [Result:getDataString] Result not set!
stack traceback:
        [C]: in function 'error'
        data/lib/004-database.lua:82: in function 'getDataString'

parte do Movements que eu acho que dá o erro,  arquivo.lua:

			local id = getThingfromPos({x=1445,y=1273,z=7,stackpos=0}).actionid - 50000
			local guild = db.getResult("SELECT `guild` FROM `castle_wars` WHERE `id` = " .. id .." ORDER BY `id` DESC;")
			if getPlayerStorageValue(cid, 50095) < os.time() then
				for t=1,#posEntrando do
					if (fromPosition.x == posEntrando[t].x and fromPosition.y == posEntrando[t].y and fromPosition.z == posEntrando[t].z) then
						if guild:getDataString("guild") ~= "" then
							doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,"Bem vindo à cidade de Agniter, controlada pela guild "..guild:getDataString("guild")..".")
							doPlayerSetStorageValue(cid, 50095, os.time() + 60)
						end
					end
				end

Query que eu to executando:

CREATE TABLE IF NOT EXISTS castle_wars (
 id int(11) NOT NULL auto_increment,
 castle_name varchar(255) NOT NULL,
 guild varchar(255) NOT NULL,
 castle_war varchar(255) NOT NULL,
 last_conqueror varchar(255) NOT NULL,
 PRIMARY KEY  (id)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1  

CREATE TABLE IF NOT EXISTS castles_war (
  castle_id int(5) NOT NULL,
  guild_id int(5) NOT NULL,
  damage int(20) NOT NULL,
  time int(50) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;  

Lib 004-database

db.updateQueryLimitOperator = db.updateLimiter
db.stringComparisonOperator = db.stringComparer
db.stringComparison = db.stringComparer
db.executeQuery = db.query
db.quote = db.escapeString

if(result == nil) then
	print("> WARNING: Couldn't load database lib.")
	return
end

Result = createClass(nil)
Result:setAttributes({
	id = -1,
	query = ""
})

function Result:getID()
	return self.id
end

function Result:setID(_id)
	self.id = _id
end

function Result:getQuery()
	return self.query
end

function Result:setQuery(_query)
	self.query = _query
end

function Result:create(_query)
	self:setQuery(_query)
	local _id = db.storeQuery(self:getQuery())
	if(_id) then
		self:setID(_id)
	end

	return self:getID()
end

function Result:getRows(free)
	local free = free or false
	if(self:getID() == -1) then
		error("[Result:getRows] Result not set!")
	end

	local c = 0
	repeat
		c = c + 1
	until not self:next()

	local _query = self:getQuery()
	self:free()
	if(not free) then
		self:create(_query)
	end

	return c
end

function Result:getDataInt(s)
	if(self:getID() == -1) then
		error("[Result:getDataInt] Result not set!")
	end

	return result.getDataInt(self:getID(), s)
end

function Result:getDataLong(s)
	if(self:getID() == -1) then
		error("[Result:getDataLong] Result not set!")
	end

	return result.getDataLong(self:getID(), s)
end

function Result:getDataString(s)
	if(self:getID() == -1) then
		error("[Result:getDataString] Result not set!")
	end

	return result.getDataString(self:getID(), s)
end

function Result:getDataStream(s)
	if(self:getID() == -1) then
		error("[Result:getDataStream] Result not set!")
	end

	return result.getDataStream(self:getID(), s)
end

function Result:next()
	if(self:getID() == -1) then
		error("[Result:next] Result not set!")
	end

	return result.next(self:getID())
end

function Result:free()
	if(self:getID() == -1) then
		error("[Result:free] Result not set!")
	end

	self:setQuery("")
	local ret = result.free(self:getID())
	self:setID(-1)
	return ret
end

Result.numRows = Result.getRows
function db.getResult(query)
	if(type(query) ~= 'string') then
		return nil
	end

	local ret = Result:new()
	ret:create(query)
	return ret
end

 

A Distro que estou usando: OTX 8.7

Grato desde já

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

Open tibia mapper.
Slec's latest mapping pieces
Me siga no twitch para ser notificado quando eu estiver mappeando na stream: SlecTV.

Link para o post
Compartilhar em outros sites

Na linha 82 do 004-database, dentro da função getDataString, troque o:

error("[Result:getDataString] Result not set!")

Por:

return nil

 

No seu script, tudo que tiver:

if guild:getDataString("guild") ~= "" then

Troque por:

if guild:getDataString("guild") ~= nil then

Não tive como testar, mas acredito que resolva seu problema.

Link para o post
Compartilhar em outros sites
			local id = getThingfromPos({x=1445,y=1273,z=7,stackpos=0}).actionid - 50000
			local guild = db.getResult("SELECT `guild` FROM `castle_wars` WHERE `id` = " .. id .." ORDER BY `id` DESC;")
			if getPlayerStorageValue(cid, 50095) < os.time() then
				for t=1,#posEntrando do
					if (fromPosition.x == posEntrando[t].x and fromPosition.y == posEntrando[t].y and fromPosition.z == posEntrando[t].z) then
						if (guild:getID() ~= -1) then
							doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,"Bem vindo à cidade de Agniter, controlada pela guild "..guild:getDataString("guild")..".")
							doPlayerSetStorageValue(cid, 50095, os.time() + 60)
						end
					end
				end

 

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites

Olá, @Vodkart e @Kemmlly! Muito obrigado pela resposta... Pelo o que eu entendi, sempre que eu pedi informação pela query eu devo checar se alguma data retornou.
Por isso usa o 

   if (resulta:getID ~= -1)

porque se não tiver valor ele continua o script para obter um valor, não é isso?

Eu andei especulando um pouco e meu movement ficou assim

 

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
if isPlayer(cid) then
local id = getThingfromPos({x=1445,y=1273,z=7,stackpos=0}).actionid - 50000
local guild = db.getResult("SELECT `guild` FROM `castle_wars` WHERE `id` = " .. id .." ORDER BY `id` DESC;")
    if item.actionid == 2518 then
        if getPlayerGuildId(cid) ~= 0 then
            if getPlayerGuildName(cid) == guild:getDataString("guild") then
                doTeleportThing(cid, {x=2526,y=1525,z=7})
                doSendMagicEffect(getCreaturePosition(cid), 10)
            else
                doTeleportThing(cid, {x=2526,y=1548,z=7})
                doSendMagicEffect(getCreaturePosition(cid), 10)
            end
        else
            doTeleportThing(cid, {x=1430,y=1240,z=9})
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Você precisa fazer parte de uma guild para poder participar desse evento.")
            doSendMagicEffect(getCreaturePosition(cid), 10)
        end
    elseif item.actionid == 50093 then
        if getPlayerStorageValue(cid, 50093) > os.time() then
            doTeleportThing(cid, {x=2526,y=1525,z=7})
            doSendMagicEffect({x=2526,y=1525,z=7}, 13)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Você precisa esperar " .. (getPlayerStorageValue(cid, 50093)-os.time()) .. " segundos para poder voltar.")
        else
            doTeleportThing(cid, {x=2486,y=1508,z=7})
            doSendMagicEffect(getCreaturePosition(cid), 10)
        end

    elseif item.actionid == 50094 then
        if getPlayerStorageValue(cid, 50093) > os.time() then
            doTeleportThing(cid, {x=2526,y=1548,z=7})
            doSendMagicEffect({x=2526,y=1548,z=7}, 13)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Você precisa esperar " .. (getPlayerStorageValue(cid, 50093)-os.time()) .. " segundos para poder voltar.")
        else
            doTeleportThing(cid, {x=2483,y=1550,z=7})
            doSendMagicEffect(getCreaturePosition(cid), 10)
        end

    elseif item.actionid == 50095 then
        local posEntrando = {
            {x=1488,y=1201,z=7},
            {x=1489,y=1201,z=7},
            {x=1490,y=1201,z=7},
            {x=1491,y=1201,z=7},
            {x=1536,y=1232,z=6},
            {x=1537,y=1232,z=6}
        }
        local posSaindo = {
            {x=1488,y=1203,z=7},
            {x=1489,y=1203,z=7},
            {x=1490,y=1203,z=7},
            {x=1491,y=1203,z=7},
            {x=1534,y=1234,z=6},
            {x=1535,y=1234,z=6},
            {x=1536,y=1234,z=6},
            {x=1537,y=1234,z=6}
        }
        local id = getThingfromPos({x=1445,y=1273,z=7,stackpos=0}).actionid - 50000
        local guild = db.getResult("SELECT `guild` FROM `castle_wars` WHERE `id` = " .. id .." ORDER BY `id` DESC;")
        if getPlayerStorageValue(cid, 50095) < os.time() then
            for t=1,#posEntrando do
                if (fromPosition.x == posEntrando[t].x and fromPosition.y == posEntrando[t].y and fromPosition.z == posEntrando[t].z) then
                    if guild:getID() ~= -1 and guild:getDataString("guild") ~= "" then
                        doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,"Bem vindo à cidade de Agniter, controlada pela guild "..guild:getDataString("guild")..".")
                        doPlayerSetStorageValue(cid, 50095, os.time() + 60)
                    end
                end
            end
            for t=1,#posSaindo do
                if (fromPosition.x == posSaindo[t].x and fromPosition.y == posSaindo[t].y and fromPosition.z == posSaindo[t].z) then
                    if guild:getID() ~= -1 and guild:getDataString("guild") ~= "" then
                        doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,"Você está deixando Agniter, cidade controlada pela guild "..guild:getDataString("guild")..".")
                        doPlayerSetStorageValue(cid, 50095, os.time() + 60)
                    end
                end
            end
        end
    end
end
return true
end

 

Os erros pararam... poreeem, eu me dei conta de que para eu testar se o script está funcionando ou não eu preciso tambem arrumar os scripts do creaturescript... Eles ocorrem quando eu tento atacar o "king", e tentar arrumar eles fugiu da minha capacidade... apesar de ser a mesma lógica, eu acho... Vocês podem me ajudar?

Castle-war.lua

function onStatsChange(cid, attacker, type, combat, value)
    local id = getThingfromPos({x=1445,y=1273,z=7,stackpos=0}).actionid - 50000
    local guild = db.getResult("SELECT `guild` FROM `castle_wars` WHERE `id` = " .. id .." ORDER BY `id` DESC;")
    if combat == COMBAT_HEALING then
        return true
    end
    if getCreatureName(cid) == "King" then
        if isPlayer(attacker) then
            if getPlayerGuildName(attacker) == guild:getDataString("guild") then
                return false
            else
                local gid = getPlayerGuildId(attacker)
                local result = db.getResult("SELECT * FROM castles_war WHERE guild_id="..gid.." AND time="..getGlobalStorageValue(50094)..";")
                if(result:getID() ~= -1) then
                    db.executeQuery("UPDATE `castles_war` SET `damage`=`damage`+"..value.." WHERE `guild_id`="..getPlayerGuildId(attacker).." AND `time`="..getGlobalStorageValue(50094)..";")
                else
                    db.executeQuery("INSERT INTO `castles_war` (`castle_id` ,`guild_id` ,`damage` ,`time`)VALUES ('1', '"..gid.."', '0', '"..getGlobalStorageValue(50094).."');")
                end
            end
        end
    end
    return true
end

Castle-wars2.lua

function onKill(cid, target, lastHit)
	local pt = getPlayerStorageValue(cid, 50097)
	if getCreatureName(target) == "King" then
		local id = getThingfromPos({x=1445,y=1273,z=7,stackpos=0}).actionid - 50000
		local guild = db.getResult("SELECT `guild` FROM `castle_wars` WHERE `id` = " .. id .." ORDER BY `id` DESC;")
		local resulta = db.getResult("SELECT * FROM `castles_war` WHERE `time`="..getGlobalStorageValue(50094).." ORDER BY `damage` DESC LIMIT 1;")
		local winnerteam = resulta:getDataInt("guild_id")
		local result2 = db.getResult("SELECT * FROM guilds WHERE id="..winnerteam..";")
		local name = result2:getDataString("name")
		broadcastMessage("A guild "..name.." conquistou o castelo e agora precisa defender este por 10 minutos!", MESSAGE_EVENT_ADVANCE)
		db.executeQuery("UPDATE castle_wars SET guild=\""..name.."\" WHERE id=1;")
		setGlobalStorageValue(50094, os.time())
		secondtime()
end
	return true
end

function secondtime()
	local id = getThingfromPos({x=1445,y=1273,z=7,stackpos=0}).actionid - 50000
	local guild = db.getResult("SELECT `guild` FROM `castle_wars` WHERE `id` = " .. id .." ORDER BY `id` DESC;")
	local ArenaGW1 = { frompos = {x=2471,y=1504,z=6}, topos = {x=2529,y=1560,z=7} }
	addEvent(checa, 10*60*1000, guild:getDataString("guild"), getGlobalStorageValue(50094))
	doCreateMonster('Castle King', {x=2486,y=1510,z=7},false,true)
	for _, player in ipairs(getPlayersOnline()) do
		if isInRange(getCreaturePosition(player), ArenaGW1.frompos, ArenaGW1.topos) then
			if getPlayerGuildName(player) == guild:getDataString("guild") then
				doTeleportThing(player, {x=2486,y=1509,z=7})
				doSendMagicEffect({x=2486,y=1509,z=7}, 10)
				doRemoveConditions(player)
			else
				doTeleportThing(player, {x=2526,y=1548,z=7})
				doSendMagicEffect({x=2526,y=1548,z=7}, 10)
				doRemoveConditions(player)
				doPlayerSetStorageValue(player, 50093, os.time() + 30)
			end
		end
	end
end

function checa(guild1,ostime)
	local id = getThingfromPos({x=1445,y=1273,z=7,stackpos=0}).actionid - 50000
	local guild = db.getResult("SELECT `guild` FROM `castle_wars` WHERE `id` = " .. id .." ORDER BY `id` DESC;")
	local king = getThingfromPos({x=2486,y=1510,z=7,stackpos=STACKPOS_TOP_CREATURE})
	if guild1 == guild:getDataString("guild") and ostime == getGlobalStorageValue(50094) then
		broadcastMessage("O Castle Wars acabou! A guild "..guild:getDataString("guild").." conseguiu conquistar o castelo! Todos os jogadores serão teleportados para fora do evento em 30 minutos, ou poderão sair a qualquer hora pelos teleports no castelo.", MESSAGE_EVENT_ADVANCE)
		doRemoveCreature(king.uid)
		addEvent(cleanp, 30*60*1000)
	end
end

function cleanp()
	local ArenaGW1 = { frompos = {x=2471,y=1504,z=6}, topos = {x=2529,y=1560,z=7} }
	local temple = {x=1447,y=1252,z=7}
	doCreateItem(3708, {x=1433,y=1241,z=9,stackpos=1})
	for _, player in ipairs(getPlayersOnline()) do
		if isInRange(getCreaturePosition(player), ArenaGW1.frompos, ArenaGW1.topos) then
			doTeleportThing(player, temple)
			doSendMagicEffect(temple, 10)
		end
	end
end

erro que retorna ao atacar:
 

[Error - CreatureScript Interface] 
data/creaturescripts/scripts/efferus/castle-wars.lua:onStatsChange
Description: 
data/lib/004-database.lua:82: [Result:getDataString] Result not set!
stack traceback:
        [C]: in function 'error'
        data/lib/004-database.lua:82: in function 'getDataString'
        data/creaturescripts/scripts/efferus/castle-wars.lua:9: in function <data/creaturescripts/scripts/efferus/castle-wars.lua:1>

Muito obrigado denovo pelo suporte à comunidade =)

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

Open tibia mapper.
Slec's latest mapping pieces
Me siga no twitch para ser notificado quando eu estiver mappeando na stream: SlecTV.

Link para o post
Compartilhar em outros sites
2 horas atrás, Slec disse:

Olá, @Vodkart e @Kemmlly! Muito obrigado pela resposta... Pelo o que eu entendi, sempre que eu pedi informação pela query eu devo checar se alguma data retornou.
Por isso usa o 


   if (resulta:getID ~= -1)

porque se não tiver valor ele continua o script para obter um valor, não é isso?

Eu andei especulando um pouco e meu movement ficou assim

 


function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
if isPlayer(cid) then
local id = getThingfromPos({x=1445,y=1273,z=7,stackpos=0}).actionid - 50000
local guild = db.getResult("SELECT `guild` FROM `castle_wars` WHERE `id` = " .. id .." ORDER BY `id` DESC;")
    if item.actionid == 2518 then
        if getPlayerGuildId(cid) ~= 0 then
            if getPlayerGuildName(cid) == guild:getDataString("guild") then
                doTeleportThing(cid, {x=2526,y=1525,z=7})
                doSendMagicEffect(getCreaturePosition(cid), 10)
            else
                doTeleportThing(cid, {x=2526,y=1548,z=7})
                doSendMagicEffect(getCreaturePosition(cid), 10)
            end
        else
            doTeleportThing(cid, {x=1430,y=1240,z=9})
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Você precisa fazer parte de uma guild para poder participar desse evento.")
            doSendMagicEffect(getCreaturePosition(cid), 10)
        end
    elseif item.actionid == 50093 then
        if getPlayerStorageValue(cid, 50093) > os.time() then
            doTeleportThing(cid, {x=2526,y=1525,z=7})
            doSendMagicEffect({x=2526,y=1525,z=7}, 13)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Você precisa esperar " .. (getPlayerStorageValue(cid, 50093)-os.time()) .. " segundos para poder voltar.")
        else
            doTeleportThing(cid, {x=2486,y=1508,z=7})
            doSendMagicEffect(getCreaturePosition(cid), 10)
        end

    elseif item.actionid == 50094 then
        if getPlayerStorageValue(cid, 50093) > os.time() then
            doTeleportThing(cid, {x=2526,y=1548,z=7})
            doSendMagicEffect({x=2526,y=1548,z=7}, 13)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Você precisa esperar " .. (getPlayerStorageValue(cid, 50093)-os.time()) .. " segundos para poder voltar.")
        else
            doTeleportThing(cid, {x=2483,y=1550,z=7})
            doSendMagicEffect(getCreaturePosition(cid), 10)
        end

    elseif item.actionid == 50095 then
        local posEntrando = {
            {x=1488,y=1201,z=7},
            {x=1489,y=1201,z=7},
            {x=1490,y=1201,z=7},
            {x=1491,y=1201,z=7},
            {x=1536,y=1232,z=6},
            {x=1537,y=1232,z=6}
        }
        local posSaindo = {
            {x=1488,y=1203,z=7},
            {x=1489,y=1203,z=7},
            {x=1490,y=1203,z=7},
            {x=1491,y=1203,z=7},
            {x=1534,y=1234,z=6},
            {x=1535,y=1234,z=6},
            {x=1536,y=1234,z=6},
            {x=1537,y=1234,z=6}
        }
        local id = getThingfromPos({x=1445,y=1273,z=7,stackpos=0}).actionid - 50000
        local guild = db.getResult("SELECT `guild` FROM `castle_wars` WHERE `id` = " .. id .." ORDER BY `id` DESC;")
        if getPlayerStorageValue(cid, 50095) < os.time() then
            for t=1,#posEntrando do
                if (fromPosition.x == posEntrando[t].x and fromPosition.y == posEntrando[t].y and fromPosition.z == posEntrando[t].z) then
                    if guild:getID() ~= -1 and guild:getDataString("guild") ~= "" then
                        doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,"Bem vindo à cidade de Agniter, controlada pela guild "..guild:getDataString("guild")..".")
                        doPlayerSetStorageValue(cid, 50095, os.time() + 60)
                    end
                end
            end
            for t=1,#posSaindo do
                if (fromPosition.x == posSaindo[t].x and fromPosition.y == posSaindo[t].y and fromPosition.z == posSaindo[t].z) then
                    if guild:getID() ~= -1 and guild:getDataString("guild") ~= "" then
                        doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,"Você está deixando Agniter, cidade controlada pela guild "..guild:getDataString("guild")..".")
                        doPlayerSetStorageValue(cid, 50095, os.time() + 60)
                    end
                end
            end
        end
    end
end
return true
end

 

Os erros pararam... poreeem, eu me dei conta de que para eu testar se o script está funcionando ou não eu preciso tambem arrumar os scripts do creaturescript... Eles ocorrem quando eu tento atacar o "king", e tentar arrumar eles fugiu da minha capacidade... apesar de ser a mesma lógica, eu acho... Vocês podem me ajudar?

Castle-war.lua


function onStatsChange(cid, attacker, type, combat, value)
    local id = getThingfromPos({x=1445,y=1273,z=7,stackpos=0}).actionid - 50000
    local guild = db.getResult("SELECT `guild` FROM `castle_wars` WHERE `id` = " .. id .." ORDER BY `id` DESC;")
    if combat == COMBAT_HEALING then
        return true
    end
    if getCreatureName(cid) == "King" then
        if isPlayer(attacker) then
            if getPlayerGuildName(attacker) == guild:getDataString("guild") then
                return false
            else
                local gid = getPlayerGuildId(attacker)
                local result = db.getResult("SELECT * FROM castles_war WHERE guild_id="..gid.." AND time="..getGlobalStorageValue(50094)..";")
                if(result:getID() ~= -1) then
                    db.executeQuery("UPDATE `castles_war` SET `damage`=`damage`+"..value.." WHERE `guild_id`="..getPlayerGuildId(attacker).." AND `time`="..getGlobalStorageValue(50094)..";")
                else
                    db.executeQuery("INSERT INTO `castles_war` (`castle_id` ,`guild_id` ,`damage` ,`time`)VALUES ('1', '"..gid.."', '0', '"..getGlobalStorageValue(50094).."');")
                end
            end
        end
    end
    return true
end

Castle-wars2.lua


function onKill(cid, target, lastHit)
	local pt = getPlayerStorageValue(cid, 50097)
	if getCreatureName(target) == "King" then
		local id = getThingfromPos({x=1445,y=1273,z=7,stackpos=0}).actionid - 50000
		local guild = db.getResult("SELECT `guild` FROM `castle_wars` WHERE `id` = " .. id .." ORDER BY `id` DESC;")
		local resulta = db.getResult("SELECT * FROM `castles_war` WHERE `time`="..getGlobalStorageValue(50094).." ORDER BY `damage` DESC LIMIT 1;")
		local winnerteam = resulta:getDataInt("guild_id")
		local result2 = db.getResult("SELECT * FROM guilds WHERE id="..winnerteam..";")
		local name = result2:getDataString("name")
		broadcastMessage("A guild "..name.." conquistou o castelo e agora precisa defender este por 10 minutos!", MESSAGE_EVENT_ADVANCE)
		db.executeQuery("UPDATE castle_wars SET guild=\""..name.."\" WHERE id=1;")
		setGlobalStorageValue(50094, os.time())
		secondtime()
end
	return true
end

function secondtime()
	local id = getThingfromPos({x=1445,y=1273,z=7,stackpos=0}).actionid - 50000
	local guild = db.getResult("SELECT `guild` FROM `castle_wars` WHERE `id` = " .. id .." ORDER BY `id` DESC;")
	local ArenaGW1 = { frompos = {x=2471,y=1504,z=6}, topos = {x=2529,y=1560,z=7} }
	addEvent(checa, 10*60*1000, guild:getDataString("guild"), getGlobalStorageValue(50094))
	doCreateMonster('Castle King', {x=2486,y=1510,z=7},false,true)
	for _, player in ipairs(getPlayersOnline()) do
		if isInRange(getCreaturePosition(player), ArenaGW1.frompos, ArenaGW1.topos) then
			if getPlayerGuildName(player) == guild:getDataString("guild") then
				doTeleportThing(player, {x=2486,y=1509,z=7})
				doSendMagicEffect({x=2486,y=1509,z=7}, 10)
				doRemoveConditions(player)
			else
				doTeleportThing(player, {x=2526,y=1548,z=7})
				doSendMagicEffect({x=2526,y=1548,z=7}, 10)
				doRemoveConditions(player)
				doPlayerSetStorageValue(player, 50093, os.time() + 30)
			end
		end
	end
end

function checa(guild1,ostime)
	local id = getThingfromPos({x=1445,y=1273,z=7,stackpos=0}).actionid - 50000
	local guild = db.getResult("SELECT `guild` FROM `castle_wars` WHERE `id` = " .. id .." ORDER BY `id` DESC;")
	local king = getThingfromPos({x=2486,y=1510,z=7,stackpos=STACKPOS_TOP_CREATURE})
	if guild1 == guild:getDataString("guild") and ostime == getGlobalStorageValue(50094) then
		broadcastMessage("O Castle Wars acabou! A guild "..guild:getDataString("guild").." conseguiu conquistar o castelo! Todos os jogadores serão teleportados para fora do evento em 30 minutos, ou poderão sair a qualquer hora pelos teleports no castelo.", MESSAGE_EVENT_ADVANCE)
		doRemoveCreature(king.uid)
		addEvent(cleanp, 30*60*1000)
	end
end

function cleanp()
	local ArenaGW1 = { frompos = {x=2471,y=1504,z=6}, topos = {x=2529,y=1560,z=7} }
	local temple = {x=1447,y=1252,z=7}
	doCreateItem(3708, {x=1433,y=1241,z=9,stackpos=1})
	for _, player in ipairs(getPlayersOnline()) do
		if isInRange(getCreaturePosition(player), ArenaGW1.frompos, ArenaGW1.topos) then
			doTeleportThing(player, temple)
			doSendMagicEffect(temple, 10)
		end
	end
end

erro que retorna ao atacar:
 


[Error - CreatureScript Interface] 
data/creaturescripts/scripts/efferus/castle-wars.lua:onStatsChange
Description: 
data/lib/004-database.lua:82: [Result:getDataString] Result not set!
stack traceback:
        [C]: in function 'error'
        data/lib/004-database.lua:82: in function 'getDataString'
        data/creaturescripts/scripts/efferus/castle-wars.lua:9: in function <data/creaturescripts/scripts/efferus/castle-wars.lua:1>

Muito obrigado denovo pelo suporte à comunidade =)

Bom , pelo que vi, o erro é o mesmo do que tinha no script que você mudou inicialmente. Na função getDataString, quando ele não acha a string, ele retornar "ERROR", então, ou você faz o procedimento que eu te falei ou faz a do Vodkart, ambos resolvem o problema.

Link para o post
Compartilhar em outros sites

valeo! tá resolvido, pode fechar! muito obrigado pela ajuda =)

Open tibia mapper.
Slec's latest mapping pieces
Me siga no twitch para ser notificado quando eu estiver mappeando na stream: SlecTV.

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.


  • Conteúdo Similar

    • Por Jaurez
      .
    • Por Cat
      Em alguns casos, o tibia 8.60 comum não abre de jeito nenhum no map editor, mesmo desmarcando check file signatures e configurando o path corretamente.
       
      Este é o client 8.60 adaptado para o Remere's Map Editor. Resolvi postar já que ele foi removido do site oficial do RME. (ficou apenas a versão para linux lá)
      Se estiver tendo problemas para abrir a versão 8.60, tente utilizar este.
                                                                                                                     
      Baixar o Tibia Client 8.60 que funciona no Remere’s Map Editor
      Essa versão do Tibia 8.60 client resolve o erro unsupported client version ou Could not locate tibia.dat and/or tibia.spr, please navigate to your tibia 8.60 installation folder.
       
      Downloads
      https://tibiaking.com/applications/core/interface/file/attachment.php?id=47333

      Scan: https://www.virustotal.com/gui/file/333e172ac49ba2028db9eb5889994509e7d2de28ebccfa428c04e86defbe15cc
       
    • Por danilo belato
      Fala Galera To Com um problema aki 
       
      quero exporta umas sprites de um server para colocar em outro 
       
      eu clico na sprites ai aparece tds a forma delas do lado de la >>
       
      ai eu clico nela e ponho a opiçao de export mais quando salvo a sprite ela n abri 
       
      aparece isso quando tento vê-la 
       
      visualização não disponível ( no formatos png e bitmap)
       
      Agora no formato idc fala que o paint n pode ler 
       
      me ajudem ae...
    • Por Vitor Bicaleto
      Galera to com o script do addon doll aqui, quando eu digito apenas "!addon" ele aparece assim: Digite novamente, algo está errado!"
      quando digito por exemplo: "!addon citizen" ele não funciona e não da nenhum erro
       
      mesma coisa acontece com o mount doll.. 
    • Por Ayron5
      Substitui uma stone no serve, deu tudo certo fora  esse  erro ajudem  Valendo  Rep+  Grato  

      Erro: data/actions/scripts/boost.lua:557: table index is nil
       [Warning - Event::loadScript] Cannot load script (data/actions/scripts/boost.lua)

      Script:
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo