Postado Junho 23, 2013 11 anos Salve galera, to com um ot online e utilizava um sistema de shop in-game, agora eu mudei o distro tento adicionar os créditos pro player, não ganha os créditos e da erro no distro com a mensagem: ERRO: [Error - TalkAction Interface ] data/talkactions/scripts/systempoints.lua:onSay Description data/lib/050-function.lua:31: attempt to call field `executeQuery` <a nil value> stack traceback: data/lib/050-function.lua:31: in function `addCreditos` data/talkactions/scripts/systempoints.lua:24: in function <data/ talkactions/scripts/systempoints.lua:1> SCRIPT: function onSay(cid, words, param) if(words == "!creditos") then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce Possui "..getCreditos(cid).." Creditos.") elseif(words == "!rankcreditos") then local max_players,str = 20,"" str = "--[ RANK CREDITOS ]--\n\n" query = db.getResult("SELECT `name`, `creditos` FROM `players` WHERE `creditos` > -1 AND `id` > 6 AND `group_id` < 2 ORDER BY `creditos` DESC, `name` ASC;") if (query:getID() ~= -1) then k = 1 while true do str = str .. "\n " .. k .. ". " .. query:getDataString("name") .. " - [" .. query:getDataInt("creditos") .. "]" k = k + 1 if not(query:next()) or k > max_players then break end end query:free()end if str ~= "" then doShowTextDialog(cid,6500, str) end elseif(words == "/addcreditos") then if getPlayerAccess(cid) == 5 then local t = string.explode(param, ",") if not t[1] or not t[2] then return TRUE,doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.") end local player = getPlayerByName(t[1]) local creditos = t[2] local pid = getPlayerByNameWildcard(t[1]) if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then return TRUE,doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player with this name doesn\'t exist or is offline.") end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "você adicionou "..creditos.." Creditos do jogador "..t[1]) doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "Foram adicionados "..creditos.." Creditos no seu character.") addCreditos(player,creditos) doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "Você agora tem "..getCreditos(player).." Creditos.") end elseif(words == "/delcreditos") then if getPlayerAccess(cid) == 5 then local t = string.explode(param, ",") if not t[1] or not t[2] then return TRUE,doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.") end local player = getPlayerByName(t[1]) local creditos = t[2] local pid = getPlayerByNameWildcard(t[1]) if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then return TRUE,doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player with this name doesn\'t exist or is offline.") end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "você removeu "..creditos.." Creditos do jogador "..t[1]) doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "Foram removidos "..creditos.." Creditos do seu character.") removeCreditos(player,creditos) doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "Você agora tem "..getCreditos(player).." Creditos.") end elseif(words == "/setcreditos") then if getPlayerAccess(cid) == 5 then local t = string.explode(param, ",") if not t[1] or not t[2] then return TRUE,doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.") end local player = getPlayerByName(t[1]) local creditos = t[2] local pid = getPlayerByNameWildcard(t[1]) if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then return TRUE,doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player with this name doesn\'t exist or is offline.") end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Agora o jogador "..t[1].." tem "..creditos.." Creditos no seu character.") doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "agora você tem "..creditos.." Creditos do seu character.") setCreditos(player,creditos) end end return TRUE end alguém sabe oque pode ser, alguma função que tem que adicionar?
Postado Junho 23, 2013 11 anos o erro é que não reconhece essa função se adiciono a função addcreditos na lib ? Editado Junho 23, 2013 11 anos por KekezitoLHP (veja o histórico de edições)
Postado Junho 23, 2013 11 anos Autor la lib/function adicionei assim ó: function getCreditos(cid) local check = db.getResult("SELECT `creditos` FROM `players` WHERE `id` = " .. getPlayerGUID(cid) .. " LIMIT 1") return check:getDataInt("creditos") <= 0 and 0 or check:getDataInt("creditos") end function addCreditos(cid,amount) db.executeQuery("UPDATE `players` SET `creditos` = "..getCreditos(cid).."+"..amount.." WHERE `id` = "..getPlayerGUID(cid)) end function removeCreditos(cid,amount) db.executeQuery("UPDATE `players` SET `creditos` = "..getCreditos(cid).."-"..amount.." WHERE `id` = "..getPlayerGUID(cid)) end function setCreditos(cid,value) db.executeQuery("UPDATE `players` SET `creditos` = "..value.." WHERE `id` = "..getPlayerGUID(cid)) end
Postado Junho 23, 2013 11 anos Adiciono a tabela no banco de dados?, me passe o site que se pegou arquivo..
Postado Junho 23, 2013 11 anos Autor Keke, até por isso criei o tópico este script eu tenho guardado a muito tempo não lembro o site dele =/ no banco de dados adicionei assim: ALTER TABLE `players` ADD `creditos` INT NOT NULL DEFAULT '0'
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.