Ir para conteúdo

(Resolvido)[Talkactions] Remove Frags - Erro No Distro

Featured Replies

Postado
  • Autor

 

testa essa bagaça aqui 

 

local exstorage = 1499
local COST = 8 -- Valor necessário para tirar red
local moeda = 2160 -- moeda que será removida
local amount = 4 --quantidade de frags que vai remover
local EFFECT = CONST_ME_YELLOW_RINGS -- efeito usado quando tirar o red
local battle = true -- players deve estar sem battle (true or false)


function doPlayerRemoveFrag(cid, count) -- by vodka
local query,t,k = db.getResult("SELECT `kill_id` FROM `player_killers` WHERE `player_id` = "..getPlayerGUID(cid)),{},0
if (query:getID() ~= -1) then 
repeat
local gs = db.getResult("SELECT `unjustified` FROM `killers` WHERE `id` = "..query:getDataInt("kill_id"))
if (gs:getDataInt("unjustified") ~= 0) then
table.insert(t, query:getDataInt("kill_id"))
k = k +1
end
until not query:next() or k >= count  
query:free()
end
for _, frag in pairs(t) do
db.executeQuery("UPDATE `killers` SET `unjustified` = 0 WHERE `id` = "..frag)
end
return true
end


function onSay(cid, words, param, channel)
        if (exhaustion.check(cid, exstorage) == true) then
                doPlayerSendCancel(cid, "You are exhausted")
                return true
        end
         if battle == true and getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE then
                doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Voce não pode tirar sua skull com battle.")
                return TRUE
        end
        if creatureSkull ~= SKULL_NONE then
                local query = db.getResult("SELECT `premdays` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
                local points = query:getDataInt("premdays")
                    if getPlayerItemCount(cid,moeda) >= COST then
                       doPlayerRemoveFrag(cid, amount)
                        doCreatureSetSkullType(cid,0)
                        doPlayerSendTextMessage(cid, 27, "Sua skull foi removida!")
                        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
                        doPlayerSetSkullEnd(cid, 0, getPlayerSkullType(cid))
                        doPlayerRemoveItem(cid,moeda,COST)
                        doSendMagicEffect(getPlayerPosition(cid), effect)
                        doRemoveCreature(cid)
                else
                        doPlayerSendCancel(cid, "Voce precisa de " ..COST.. " crystal coins para remover a skull.")
                end
        else
                doPlayerSendCancel(cid, "Voce nao esta skull.")
        end
        exhaustion.set(cid, exstorage, 30)


        if (query ~= nil) then
                query:free()
        end


        return TRUE
end

 

Aconteceu a mesma coisa, usa o comando !removeskull, ele tira o red skull e os frags, so que quando mata algum player os frags voltam todos, não começa do 0.

Mesmo assim vou te da REP+, porque ta me ajudando muito, Obrigado.

 

@Edit

 

Aqui esta um outro script de remover frags tambem, so que da erro, vou postar o script e o erro, caso esse seja mais facil de arrumar, ta aqui.

 

erro

[01/04/2014 03:20:30] [Error - LuaScriptInterface::loadFile] data/talkactions/scripts/skull.lua:10: 'end' expected (to close 'function' at line 1) near '<eof>'
[01/04/2014 03:20:30] [Warning - Event::loadScript] Cannot load script (data/talkactions/scripts/skull.lua)
[01/04/2014 03:20:30] data/talkactions/scripts/skull.lua:10: 'end' expected (to close 'function' at line 1) near '<eof>'

 

script.lua

function onSay(cid, words)
 
if getPlayerFrags(cid) <= 0 then return true end
 
if doPlayerRemoveMoney(cid, 10000000) then
        db.executeQuery("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ")")
                else
                        doPlayerSendTextMessage(cid, 20, "You do not enough money!")
                                return true
                        end

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

 

                                                           

55f6tc.gif                     

  • Respostas 19
  • Visualizações 1.3k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • caralho, ajuda quem entende ok??   quem leu o erro, entendeu que a função 'getPlayerFrags' não existe no server dele.   é só adicionar na lib/functions isso:   function getPlayerFrags(cid) loc

  • testa essa bagaça aqui    local exstorage = 1499 local COST = 8 -- Valor necessário para tirar red local moeda = 2160 -- moeda que será removida local amount = 4 --quantidade de frags que vai remo

Postado
  • Solução

caralho, ajuda quem entende ok??

 

quem leu o erro, entendeu que a função 'getPlayerFrags' não existe no server dele.

 

é só adicionar na lib/functions isso:

 

function getPlayerFrags(cid)
local time = os.time()
local times = {today = (time - 86400), week = (time - (7 * 86400))}
local contents, result = {day = {}, week = {}, month = {}}, db.getResult("SELECT `pd`.`date`, `pd`.`level`, `p`.`name` FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = " .. getPlayerGUID(cid) .. " AND `k`.`unjustified` = 1 AND `pd`.`date` >= " .. (time - (30 * 86400)) .. " ORDER BY `pd`.`date` DESC")
if(result:getID() ~= -1) then
repeat
local content = {date = result:getDataInt("date")}
if(content.date > times.today) then
table.insert(contents.day, content)
elseif(content.date > times.week) then
table.insert(contents.week, content)
else
table.insert(contents.month, content)
end
until not result:next()
result:free()
end
local size = {day = table.maxn(contents.day),week = table.maxn(contents.week),month = table.maxn(contents.month)}
return size.day + size.week + size.month
end

 

pqp meu deus, tão fácil...

vodkart_logo.png

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

 

DISCORDvodkart#6090

 

Postado

eu tava tentando ajudar, mas fica dificil ensinar sem ter aprendido :/ o script é seu e eu achava que vc não entrava mais aqui então nem fui te procurar pra pedir ajuda.
Faz 6 anos que eu não jogo tibia e a ultima vez que eu scriptei foi na versão 8.1 se não me engano. Desde então tudo mudou, funções, jeito de scriptar, e até os erros no console. Pra alguém que tava "aposentado" até que eu ajudei bastante esse fórum.. dá um desconto aí vodk

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

caralho, ajuda quem entende ok??

 

quem leu o erro, entendeu que a função 'getPlayerFrags' não existe no server dele.

 

é só adicionar na lib/functions isso:

function getPlayerFrags(cid)
local time = os.time()
local times = {today = (time - 86400), week = (time - (7 * 86400))}
local contents, result = {day = {}, week = {}, month = {}}, db.getResult("SELECT `pd`.`date`, `pd`.`level`, `p`.`name` FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = " .. getPlayerGUID(cid) .. " AND `k`.`unjustified` = 1 AND `pd`.`date` >= " .. (time - (30 * 86400)) .. " ORDER BY `pd`.`date` DESC")
if(result:getID() ~= -1) then
repeat
local content = {date = result:getDataInt("date")}
if(content.date > times.today) then
table.insert(contents.day, content)
elseif(content.date > times.week) then
table.insert(contents.week, content)
else
table.insert(contents.month, content)
end
until not result:next()
result:free()
end
local size = {day = table.maxn(contents.day),week = table.maxn(contents.week),month = table.maxn(contents.month)}
return size.day + size.week + size.month
end

pqp meu deus, tão fácil...

Opa funciono agora, valeu. REP +.

 

                                                           

55f6tc.gif                     

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.6k

Informação Importante

Confirmação de Termo