Postado Fevereiro 14, 2015 10 anos Tente trocar o que o danihcv postou por isso: function getPoints(cid) local res = db.getResult('select `p_points` from accounts where name = \''..getPlayerAccount(cid)..'\'') if(res:getID() == -1) then return false end local ret = res:getDataInt("p_points") res:free() return tonumber(ret) end function doPlayerAddPoints(cid, quant) return db.executeQuery("UPDATE `accounts` SET `p_points` = '".. getPoints(cid) + quant .."' WHERE `name` ='"..getPlayerAccount(cid).."'") end function doPlayerRemovePoints(cid, quant) return db.executeQuery("UPDATE `accounts` SET `p_points` = '".. getPoints(cid) - quant .."' WHERE `name` ='"..getPlayerAccount(cid).."'") end Ajudei? De nada \o/ Att Rusherzin
Postado Fevereiro 14, 2015 10 anos Autor Tente trocar o que o danihcv postou por isso: function getPoints(cid) local res = db.getResult('select `p_points` from accounts where name = \''..getPlayerAccount(cid)..'\'') if(res:getID() == -1) then return false end local ret = res:getDataInt("p_points") res:free() return tonumber(ret) end function doPlayerAddPoints(cid, quant) return db.executeQuery("UPDATE `accounts` SET `p_points` = '".. getPoints(cid) + quant .."' WHERE `name` ='"..getPlayerAccount(cid).."'") end function doPlayerRemovePoints(cid, quant) return db.executeQuery("UPDATE `accounts` SET `p_points` = '".. getPoints(cid) - quant .."' WHERE `name` ='"..getPlayerAccount(cid).."'") end O erro continua, é exatamente o mesmo. Eu até recebo o item do baú a cada vez que eu clico, só que pelo o que parece, não tem script que lê o Points do arquivo pontos.lua e usa ele na tabela "p_points". GitHub: https://github.com/s3kk Conteúdo: [SERVER] Heromassa[GESIOR] Gesior 2012 modificado por Sekk[GESIOR] Shop Addons & Mounts - TFS 1.x[GESIOR] Outfitter para Characters e Rank[SISTEMA] Castle 24h[TALKACTION] Multi Element Wand[ACTION] Multi Elemental Arrow & Shield[PROGRAMAÇÃO] Compilar TFS 0.4 no Linux[PROGRAMAÇÃO] Compilando TFS 0.4 no MSVC(x64 e x32) [INFRAESTRUTURA] Configuração COMPLETA Google VM + Tibia 11.x
Postado Fevereiro 14, 2015 10 anos Tenta com esse então: function onUse(cid, item, frompos, item2, topos) local config = { quant = 10, -- quantidade de pontos para abrir o bau item1 = 2160 -- item1 do bau } if getPoints(cid) >= config.quant then doPlayerAddItem(cid, config.item1, 1) db.executeQuery("UPDATE `accounts` SET `p_points` = '".. getPoints(cid) - config.quant .."' WHERE `name` ='"..getPlayerAccount(cid).."'") else doPlayerSendTextMessage(cid,22 ,"Você precisa de ".. config.quant .." Pontos para poder abrir esse báu.") -- se quiser mude essa mensagem end return true end Ajudei? De nada \o/ Att Rusherzin
Postado Fevereiro 15, 2015 10 anos Autor Tenta com esse então: function onUse(cid, item, frompos, item2, topos) local config = { quant = 10, -- quantidade de pontos para abrir o bau item1 = 2160 -- item1 do bau } if getPoints(cid) >= config.quant then doPlayerAddItem(cid, config.item1, 1) db.executeQuery("UPDATE `accounts` SET `p_points` = '".. getPoints(cid) - config.quant .."' WHERE `name` ='"..getPlayerAccount(cid).."'") else doPlayerSendTextMessage(cid,22 ,"Você precisa de ".. config.quant .." Pontos para poder abrir esse báu.") -- se quiser mude essa mensagem end return true end aparece este erro no distro: [14/02/2015 22:26:40] [Error - Action Interface] [14/02/2015 22:26:40] data/actions/scripts/pontos.lua:onUse [14/02/2015 22:26:40] Description: [14/02/2015 22:26:40] data/actions/scripts/pontos.lua:10: attempt to call field 'executeQuery' (a nil value) [14/02/2015 22:26:40] stack traceback: [14/02/2015 22:26:40] data/actions/scripts/pontos.lua:10: in function <data/actions/scripts/pontos.lua:1> Porém eu recebo o item, mas nn remove pontos e da o erro a cima. Up GitHub: https://github.com/s3kk Conteúdo: [SERVER] Heromassa[GESIOR] Gesior 2012 modificado por Sekk[GESIOR] Shop Addons & Mounts - TFS 1.x[GESIOR] Outfitter para Characters e Rank[SISTEMA] Castle 24h[TALKACTION] Multi Element Wand[ACTION] Multi Elemental Arrow & Shield[PROGRAMAÇÃO] Compilar TFS 0.4 no Linux[PROGRAMAÇÃO] Compilando TFS 0.4 no MSVC(x64 e x32) [INFRAESTRUTURA] Configuração COMPLETA Google VM + Tibia 11.x
Postado Fevereiro 15, 2015 10 anos Qual OT você está usando? Esse erro é muito estranho ;-; Ajudei? De nada \o/ Att Rusherzin
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.