Ir para conteúdo
  • 0

!kills - Informa quantos você matou sem justificativa em um determinado período de tempo. (usado para saber se pode obter red skull ou ser banido)


Muvuka

Pergunta

Não funciona.

 

-- kills.lua
function onSay(cid, words, param)
    if not isPlayer(cid) then
        return false
    end

    -- Verifica o número de mortes injustificadas no banco de dados
    local playerGUID = getPlayerGUID(cid)
    local resultId = db.storeQuery("SELECT unjustified_frags FROM players WHERE id = " .. playerGUID)

    if resultId ~= false then
        -- Recupera os frags injustificados
        local unjustifiedKillsDay = result.getDataInt(resultId, "unjustified_frags_day")
        local unjustifiedKillsWeek = result.getDataInt(resultId, "unjustified_frags_week")
        local unjustifiedKillsMonth = result.getDataInt(resultId, "unjustified_frags_month")
        
        -- Configuração de quantos frags são necessários para obter red skull ou ban
        local dailyFragLimit = getConfigValue("dailyFragLimit")
        local weeklyFragLimit = getConfigValue("weeklyFragLimit")
        local monthlyFragLimit = getConfigValue("monthlyFragLimit")
        
        -- Envia as informações ao jogador
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você tem " .. unjustifiedKillsDay .. " mortes injustificadas nas últimas 24 horas.")
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você tem " .. unjustifiedKillsWeek .. " mortes injustificadas nos últimos 7 dias.")
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você tem " .. unjustifiedKillsMonth .. " mortes injustificadas nos últimos 30 dias.")
        
        -- Informar se está perto de obter red skull ou ban
        if unjustifiedKillsDay >= dailyFragLimit or unjustifiedKillsWeek >= weeklyFragLimit or unjustifiedKillsMonth >= monthlyFragLimit then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Cuidado! Você está próximo de obter uma Red Skull ou ser banido!")
        else
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você ainda está seguro, mas continue atento às suas mortes injustificadas.")
        end
        
        result.free(resultId)
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Não foi possível recuperar suas mortes injustificadas.")
    end

    return true
end

 

Editado por Muvuka
Link para o comentário
Compartilhar em outros sites

0 respostass a esta questão

Posts Recomendados

Até agora não há respostas para essa pergunta

  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...