Postado Fevereiro 21, 2015 10 anos Meu amigo modifiquei para você teste e vê se gostou! local config = { useFragHandler = getBooleanFromString(getConfigValue('useFragHandler')), advancedFragList = getBooleanFromString(getConfigValue('advancedFragList')) } function onSay(cid, words, param, channel) if(not config.useFragHandler) then return false end 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 = { name = result:getDataString("name"), level = result:getDataInt("level"), 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) } if(config.advancedFragList) then local result = "Frags gained today: " .. size.day .. "." if(size.day > 0) then for _, content in ipairs(contents.day) do result = result .. "\n* " .. os.date("%d %B %Y %X at ", content.date) .. content.name .. " on level " .. content.level end result = result .. "\n" end result = result .. "\nFrags gained this week: " .. (size.day + size.week) .. "." if(size.week > 0) then for _, content in ipairs(contents.week) do result = result .. "\n* " .. os.date("%d %B %Y %X at ", content.date) .. content.name .. " on level " .. content.level end result = result .. "\n" end result = result .. "\nFrags gained this month: " .. (size.day + size.week + size.month) .. "." if(size.month > 0) then for _, content in ipairs(contents.month) do result = result .. "\n* " .. os.date("%d %B %Y %X at ", content.date) .. content.name .. " on level " .. content.level end result = result .. "\n" end local skullEnd = getPlayerSkullEnd(cid) if(skullEnd > 0) then result = result .. "\nYour " .. (getCreatureSkullType(cid) == SKULL_RED and "red" or "black") .. " skull will expire at " .. os.date("%d %B %Y %X", skullEnd) end doPlayerPopupFYI(cid, result) else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Day: " .. size.day .. " (red skull:20/black skull:40)") doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Week: " .. size.week .. " (red skull:120/black skull:240)") doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Month: " .. size.month .. " (red skull:600/black skull:1200)") if(size.day > 0) then end local skullEnd = getPlayerSkullEnd(cid) if(skullEnd > 0) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your " .. (getCreatureSkullType(cid) == SKULL_RED and "red" or "black") .. " skull will expire at " .. os.date("%d %B %Y %X", skullEnd)) end end return true end Editado Fevereiro 21, 2015 10 anos por Septy (veja o histórico de edições)
Postado Fevereiro 23, 2015 10 anos up n deu certo.. Como não eu testei aqui, caso estiver dando erro na sua distro avisa.
Postado Fevereiro 23, 2015 10 anos Solução @loreal, Olha, peguei o que já existe e tentei deixar como você quer, como estou no trabalho não posso testar. Qualquer bug por favor poste uma print. local useFragHandler = getBooleanFromString(getConfigValue('useFragHandler')) function onSay(cid, words, param, channel) if(not useFragHandler) then return false end 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 = { name = result:getDataString("name"), level = result:getDataInt("level"), 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), dayred = getConfigValue('fragsToRedSkull'), dayblack = getConfigValue('fragsToBlackSkull'), weekred = getConfigValue('fragsSecondToRedSkull'), weekblack = getConfigValue('fragsSecondToBlackSkull'), monthred = getConfigValue('fragsThirdToRedSkull'), monthblack = getConfigValue('fragsThirdToBlackSkull') } doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Day: " .. size.day .. " (red skull: " .. size.dayred .." / black skull: " .. size.dayblack .. ")") doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Week: " .. size.week .. " (red skull: " .. size.weekred .. " / black skull: " .. size.weekblack .. ")") doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Month: " .. size.month .. " (red skull: " .. size.monthred .. " / black skull: " .. size.monthblack .. ")") local skullEnd = getPlayerSkullEnd(cid) if(skullEnd > 0) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your " .. (getCreatureSkullType(cid) == SKULL_RED and "red" or "black") .. " skull will expire at " .. os.date("%d %B %Y %X", skullEnd)) end return true end Abraço! Editado Fevereiro 23, 2015 10 anos por Bruno Minervino (veja o histórico de edições)
Postado Fevereiro 23, 2015 10 anos Autor @loreal, Olha, peguei o que já existe e tentei deixar como você quer, como estou no trabalho não posso testar. Qualquer bug por favor poste uma print. local config = { useFragHandler = getBooleanFromString(getConfigValue('useFragHandler')), } function onSay(cid, words, param, channel) if(not config.useFragHandler) then return false end 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 = { name = result:getDataString("name"), level = result:getDataInt("level"), 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), dayred = getConfigValue('fragsToRedSkull'), dayblack = getConfigValue('fragsToBlackSkull'), weekred = getConfigValue('fragsSecondToRedSkull'), weekblack = getConfigValue('fragsSecondToBlackSkull'), monthred = getConfigValue('fragsThirdToRedSkull'), monthblack = getConfigValue('fragsThirdToBlackSkull') } doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Day: " .. size.day .. " (red skull: " .. size.dayred .." / black skull: " .. size.dayblack .. ")") doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Week: " .. size.week .. " (red skull: " .. size.weekred .. " / black skull: " .. size.weekblack .. ")") doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Month: " .. size.month .. " (red skull: " .. size.monthred .. " / black skull: " .. size.monthblack .. ")") local skullEnd = getPlayerSkullEnd(cid) if(skullEnd > 0) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your " .. (getCreatureSkullType(cid) == SKULL_RED and "red" or "black") .. " skull will expire at " .. os.date("%d %B %Y %X", skullEnd)) end return true end Abraço! amigo deu esse erro [Error - LuaInterface::loadFile] data/talkactions/scripts/frags.lua:1: '=' expected near 'config' [Error - Event::checkScript] Cannot load script (data/talkactions/scripts/frags.lua) data/talkactions/scripts/frags.lua:1: '=' expected near 'config'
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.