• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Deaths/kills

imback1

Unknown member
Joined
Jul 11, 2013
Messages
785
Solutions
1
Reaction score
46
Hello

i need script to show me how many times did i die and my kills :D (frags)
 
Last edited:
Code:
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
and in creaturescript.xml
Code:
<event type="look" name="showKD" event="script" value="KillsandDeath.lua"/>

and in login.lua
Code:
registerCreatureEvent(cid, "showKD")
 
Code:
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
and in creaturescript.xml
Code:
<event type="look" name="showKD" event="script" value="KillsandDeath.lua"/>

and in login.lua
Code:
registerCreatureEvent(cid, "showKD")
ahahahah its was working to see frags on me now its not working for me or players :D
good job :D
 
by dogynub

ok put that in creature scripte.xml creat new lua and paste


Code:
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

in the creature.xml paste this
Code:
<event type="look" name="lol" event="script" value="name of script.lua"/>

and in creaturescrpit-->login paste this before last return true

Code:
registerCreatureEvent(cid, "lol")

This when you look on other players not when you lokk on your self
example:
"royal" kills you.
You look on royal
"you see royale,blblblblbllblblbl.he has 1 frags.
 
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
 
Back
Top