function onLook(cid, thing, position, lookDistance)
function getDeathsAndKills(cid, type) -- by vodka
local query,d = db.getResult("SELECT `player_id` FROM "..(tostring(type) == "kill" and "`player_killers`" or "`player_deaths`").." WHERE `player_id` = "..getPlayerGUID(cid)),0
if (query:getID() ~= -1) then
repeat
d = d+1
until not query:next()
query:free()
end
return d
end
if isPlayer(thing.uid) then
doPlayerSetSpecialDescription(thing.uid, "\n"..(getPlayerSex(thing.uid) == 0 and "She" or "He").." has Killed: ["..getDeathsAndKills(thing.uid, "kill").."] Players.\n"..(getPlayerSex(thing.uid) == 0 and "She" or "He").." has Died: ["..getDeathsAndKills(thing.uid, "death").."] Times")
end
return true
end
<event type="look" name="showKD" event="script" value="KillsandDeath.lua"/>
registerCreatureEvent(cid, "showKD")
ahahahah its was working to see frags on me now its not working for me or playersand in creaturescript.xmlCode:function onLook(cid, thing, position, lookDistance) function getDeathsAndKills(cid, type) -- by vodka local query,d = db.getResult("SELECT `player_id` FROM "..(tostring(type) == "kill" and "`player_killers`" or "`player_deaths`").." WHERE `player_id` = "..getPlayerGUID(cid)),0 if (query:getID() ~= -1) then repeat d = d+1 until not query:next() query:free() end return d end if isPlayer(thing.uid) then doPlayerSetSpecialDescription(thing.uid, "\n"..(getPlayerSex(thing.uid) == 0 and "She" or "He").." has Killed: ["..getDeathsAndKills(thing.uid, "kill").."] Players.\n"..(getPlayerSex(thing.uid) == 0 and "She" or "He").." has Died: ["..getDeathsAndKills(thing.uid, "death").."] Times") end return true end
Code:<event type="look" name="showKD" event="script" value="KillsandDeath.lua"/>
and in login.lua
Code:registerCreatureEvent(cid, "showKD")
local 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 onLook(cid, thing, position, lookDistance)
if isPlayer(thing.uid) then
doPlayerSetSpecialDescription(thing.uid, (getPlayerSex(thing.uid) == 0 and ".\nShe" or ".\nHe") .." has "..getPlayerFrags(thing.uid).." frags")
return true
end
end
<event type="look" name="lol" event="script" value="name of script.lua"/>
registerCreatureEvent(cid, "lol")
you tried my script ?k thx i think there is something wrong on my server :S didnt work
btw is it 0.3.6? sorry but if you can't help me its ok
yea :Syou tried my script ?
didnt make any error its was working on log but didnt work on gameshow me log of the error
trust me clay remove rank script and use this script and it will work fine