Ir para conteúdo
  • 0

!frags bugada (Talkactions)


Baiakuda

Pergunta

Não sei nem explicar como isso acontece, só sei que se o player tiver mais de 10 frags, ele não consegue usar o talkction "!frags", e quando ele tem menos de 10 ele usa e aparece isso \/

frag.png

 

Minha talkactions de !frags \/

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, "You currently have " .. size.day .. " frags today, " .. (size.day + size.week) .. " this week and " .. (size.day + size.week + size.month) .. " this month.")
if(size.day > 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Last frag at " .. os.date("%d %B %Y %X", contents.day[1].date) .. " on level " .. contents.day[1].level .. " (" .. contents.day[1].name .. ").")
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

Link para o comentário
Compartilhar em outros sites

11 respostass a esta questão

Posts Recomendados

  • 0

Tente assim:

 

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
doPlayerPopupFYI(cid,"Voce tem:\n " .. size.day .. " frags hoje (" .. size.day .. "/10)\n " .. (size.day + size.week) .. " na semana (" .. (size.day + size.week) .. "/25)\n " .. (size.day + size.week + size.month) .. " frags no mes (" .. (size.day + size.week + size.month) .. "/70).")
if(size.day > 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sua última vítima foi o jogador " .. contents.day[1].name .. " no level " .. contents.day[1].level .. ".")
end
local skullEnd = getPlayerSkullEnd(cid)
if(skullEnd > 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sua Pk " .. (getCreatureSkullType(cid) == SKULL_RED and "red" or "black") .. " sairá: " .. os.date("%d %B %Y %X", skullEnd))
end
end
return TRUE
end

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

  • 0

agora não deu o erro, porem continua aparecendo os frags naquela telinha e essa telinha some quando o player tem mais de 10 frags! Será que é minha pasta LIB ou minhas Distros?

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

  • 0

Ok, se for a "telinha" tente esse script aqui:

 

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 .. "."
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
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, result)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce tem:\n " .. size.day .. " frags hoje (" .. size.day .. "/10)\n " .. (size.day + size.week) .. " na semana (" .. (size.day + size.week) .. "/25)\n " .. (size.day + size.week + size.month) .. " frags no mes (" .. (size.day + size.week + size.month) .. "/70).")
if(size.day > 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sua última vítima foi o jogador " .. contents.day[1].name .. " no level " .. contents.day[1].level .. ".")
end
local skullEnd = getPlayerSkullEnd(cid)
if(skullEnd > 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sua Pk " .. (getCreatureSkullType(cid) == SKULL_RED and "red" or "black") .. " sairá: " .. os.date("%d %B %Y %X", skullEnd))
end
end
return TRUE
end

 

Caso não dê aconselho-te a trocar de servidor!

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

  • 0

FUNCIONOU, MUITO OBRIGADO!

Posso lhe pedir só mais um favor? tem como não aparecer isso (mostrar só o ultimo que eu matei e não mostrar todos) \/

 

* 18 December 2012 12:33:39 at Corinthians The Champion on level 208

* 18 December 2012 12:32:10 at Corinthians The Champion on level 210

* 18 December 2012 12:31:26 at Corinthians The Champion on level 211

* 18 December 2012 12:30:52 at Corinthians The Champion on level 213

* 18 December 2012 12:30:25 at Corinthians The Champion on level 214

* 18 December 2012 12:30:01 at Corinthians The Champion on level 216

* 18 December 2012 12:29:35 at Corinthians The Champion on level 218

Link para o comentário
Compartilhar em outros sites

  • 0

PERFEITO, MUITO OBRIGADO ... REP+ !!!

 

eu tinha te dado rep+ em outro post meu, entao nesse nao da pq aparece isso \/

Você já atingiu seu limite de reputações positivas para hoje

 

 

mas amanha eu venho aqui só pra dar o REP!!!

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

×
×
  • Criar Novo...