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
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
function onThink(interval)
for _,cid in ipairs(getPlayersOnline()) do
f = getPlayerFrags(cid)
if f => 50 and f < 100 then
if getCreatureSkullType(cid) == 0 then
doCreatureSetSkullType(cid, 3)
end
elseif f => 100 and f < 250 then
if getCreatureSkullType(cid) == 0 then
doCreatureSetSkullType(cid, 1)
end
elseif f => 250 and f < 600 then
if getCreatureSkullType(cid) == 0 then
doCreatureSetSkullType(cid, 2)
end
elseif f => 600 and f < 1000 then
if getCreatureSkullType(cid) == 0 then
doCreatureSetSkullType(cid, 4)
end
elseif f => 1000 then
if getCreatureSkullType(cid) == 0 then
doCreatureSetSkullType(cid, 5)
end
end
end
return true
end
Doggy noob ja pierdole co nick -.- said:Code:if getCreatureSkullType(cid) ~= 3 then doCreatureSetSkullType(cid, 3) end
i think that i will not work.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
function onThink(interval)
for _,cid in ipairs(getPlayersOnline()) do
f = getPlayerFrags(cid)
if f => 50 and f < 100 then
if getCreatureSkullType(cid) == 0 then
doCreatureSetSkullType(cid, 3)
end
elseif f => 100 and f < 250 then
if getCreatureSkullType(cid) == 0 then
doCreatureSetSkullType(cid, 1)
end
elseif f => 250 and f < 600 then
if getCreatureSkullType(cid) == 0 then
doCreatureSetSkullType(cid, 2)
end
elseif f => 600 and f < 1000 then
if getCreatureSkullType(cid) == 0 then
doCreatureSetSkullType(cid, 4)
end
elseif f => 1000 then
if getCreatureSkullType(cid) == 0 then
doCreatureSetSkullType(cid, 5)
end
end
end
return true
end