CH
pedido

Script Bugado

Por chateadoagr, 30 de jan. de 2014 em Scripts

resolvido
script
30
3.5k
chateadoagrC
01 de fevereiro de 2014 às 00:26

 

Então vc não tem mesmo essa função... pra testar faz assim


function onSay(cid, words, param, channel)
    doPlayerSendTextMessage(cid, 25, getCreatureHealth(cid))
    return true
end

SO COLOKO ISSO NO SCRIPT?

KilluaK
01 de fevereiro de 2014 às 00:29

Sim e pra usar é !vida

chateadoagrC
01 de fevereiro de 2014 às 11:52

n da nenhum erro e tmbm n funciona, meu servidor é o radbr-fenix

chateadoagrC
05 de fevereiro de 2014 às 20:10

@up alguem pode me ajudar?

zipter98Z
05 de fevereiro de 2014 às 21:03

Pelo que vi ali em cima, seu servidor não tem a função getCreatureHealth(avá). O Vodkart disponibilizou uma função aqui no fórum com a mesma utilidade. Só você procurar, depois colocar em lib, e usar no código.

chateadoagrC
05 de fevereiro de 2014 às 21:11

tem como me passar o link?

zipter98Z
05 de fevereiro de 2014 às 21:17

 

function getPlayerHealth(cid) -- by vodka
doPlayerSave(cid)
local PlayerInfo = db.getResult("SELECT `health` FROM `players` WHERE `id` = " .. getPlayerGUID(cid))
return PlayerInfo:getDataInt("health")
end
MasterDinoM
05 de fevereiro de 2014 às 21:34

Se for so a funçao getCreatureHealth que nao tem no seu server entao ta ai:

function getCreatureHealth(uid)
local result = db.getResult("SELECT health FROM players WHERE id = "..getPlayerGUID(uid).."")
return result:getDataString("health")
end

function onSay(cid, words, param, channel)
    if param == "" then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Para saber a vida maxima de alguem diga !vida playername")
        return true
    end

    if isPremium(cid) then
        
            for _, tid in pairs(getPlayersOnline()) do
                local pid = getPlayerByName(param)
                if isInArray(tid, pid) then
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "\nVida de [ " .. getCreatureName(pid) .. " ] atual: " .. getCreatureHealth(pid) .. 

"\nVida de [ " .. getCreatureName(pid) .. " ] máxima: " .. getCreatureMaxHealth(pid) .. "")
                else
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "O jogador " .. param .. " nao esta online ou nao existe")
                    end
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Apenas jogadores VIP podem utilizar este comando para visualizar informações de outros 

jogadores.")
        end
        return true
    end
KilluaK
06 de fevereiro de 2014 às 00:16

Pode usar assim:


function getPlayerHealth(cid) -- by vodka
doPlayerSave(cid)
local PlayerInfo = db.getResult("SELECT `health` FROM `players` WHERE `id` = " .. getPlayerGUID(cid))
return PlayerInfo:getDataInt("health")
end

function onSay(cid, words, param, channel)
    if param == "" then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Para saber a vida de alguem diga !vida playername")
        return true
    end

    if isPremium(cid) then
        
            for _, tid in pairs(getPlayersOnline()) do
                local pid = getPlayerByName(param)
                if isInArray(tid, pid) then
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "\nVida de [ " .. getCreatureName(pid) .. " ] atual: " .. getPlayerHealth(pid) .. "\nVida de [ " .. getCreatureName(pid) .. " ] máxima: " .. getCreatureMaxHealth(pid) .. "")
                else
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "O jogador " .. param .. " nao esta online ou nao existe")
                    end
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Apenas jogadores VIP podem utilizar este comando para visualizar informações de outros jogadores.")
        end
        return true
    end

Porém acho melhor resgistrar a função numa lib pq outros scripts podem precisar dela. Além disso, acho que seu server pode não ter a função getCreatureMaxHealth(cid) tbm... Vc vai ter que testar.

chateadoagrC
06 de fevereiro de 2014 às 09:32

Pode usar assim:


function getPlayerHealth(cid) -- by vodka
doPlayerSave(cid)
local PlayerInfo = db.getResult("SELECT `health` FROM `players` WHERE `id` = " .. getPlayerGUID(cid))
return PlayerInfo:getDataInt("health")
end

function onSay(cid, words, param, channel)
    if param == "" then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Para saber a vida de alguem diga !vida playername")
        return true
    end

    if isPremium(cid) then
        
            for _, tid in pairs(getPlayersOnline()) do
                local pid = getPlayerByName(param)
                if isInArray(tid, pid) then
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "\nVida de [ " .. getCreatureName(pid) .. " ] atual: " .. getPlayerHealth(pid) .. "\nVida de [ " .. getCreatureName(pid) .. " ] máxima: " .. getCreatureMaxHealth(pid) .. "")
                else
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "O jogador " .. param .. " nao esta online ou nao existe")
                    end
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Apenas jogadores VIP podem utilizar este comando para visualizar informações de outros jogadores.")
        end
        return true
    end

Porém acho melhor resgistrar a função numa lib pq outros scripts podem precisar dela. Além disso, acho que seu server pode não ter a função getCreatureMaxHealth(cid) tbm... Vc vai ter que testar.

tem como me encina como eu registro na lib?

KilluaK
06 de fevereiro de 2014 às 13:47

é só criar um arquivo creatureHealth.lua na pasta lib e colocar isso:

function getPlayerHealth(cid) -- by vodka
doPlayerSave(cid)
local PlayerInfo = db.getResult("SELECT `health` FROM `players` WHERE `id` = " .. getPlayerGUID(cid))
return PlayerInfo:getDataInt("health")
end

O script funcionou?

chateadoagrC
06 de fevereiro de 2014 às 14:53

vou testar qnd eu chegar em casa agr estou no meu trabalho aeuaueaueuaeuaeu!

KilluaK
06 de fevereiro de 2014 às 19:57

beleza :)

chateadoagrC
06 de fevereiro de 2014 às 20:10

deu serto podem fexa ake

zipter98Z
06 de fevereiro de 2014 às 20:31

Tópico movido para a seção de dúvidas e pedidos resolvidos.