• 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!

[solved]

add @ creaturescripts.xml
XML:
<event type="login" name="registered" event="script" value="newlook.lua"/>
<event type="look" name="newlook" event="script" value="newlook.lua"/>

create @ creaturescripts/scripts/newlook.lua

LUA:
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) and thing.uid ~= cid then
        doPlayerSetSpecialDescription(thing.uid,'\n[Lv: '..getPlayerLevel(thing.uid)..'] [Frags: '..getPlayerFrags(thing.uid)..']')
    end
    return true
end

function onLogin(cid)
    registerCreatureEvent(cid, "newlook")
    return true
end
 
FTW you are saving my day today LOL ++++++++++++++ REP

Thanks !

EDIT#1:
havind problem...

01:58 You see Magebotter (Level 130). He is an elder druid
[Lv: 130] [Frags: 0].

i want remove this (Level 130)

TY

EDIT#2 FIX:

i found how to.

just change this
LUA:
<group id="1" name="Player"/>
to this
LUA:
<group id="1" name="Player" customFlags="8192"/>

on data/xml/groups.xml

(u will need w8 for rep "You must spread some Reputation around before giving it to Cybershot again.") hehe
 
Last edited:
Yo Cybershot sorry for taking your time AGAIN lol.. but there is anyway to add the death counts too? like this.

He is NAME
[Lv:xxx] [Frags:xxx] [Deaths: xxx]

that would be epic haha thanks man!
 
i don't remember if there is a query to count exact player-to-player kills(not like frags which expire) so..
LUA:
local storage = 1358 --storage to store amount of kills

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 onLogin(cid)
    registerCreatureEvent(cid, "newlook")
    registerCreatureEvent(cid, "killCount")
    return true
end
 
function onLook(cid, thing, position, lookDistance)
    if isPlayer(thing.uid) and thing.uid ~= cid then
        doPlayerSetSpecialDescription(thing.uid,'\n[Lv: '..getPlayerLevel(thing.uid)..'] [Frags: '..getPlayerFrags(thing.uid)..'] [Deaths: '..math.max(0, getCreatureStorage(thing.uid))..']')
    end
    return true
end
 
function onKill(cid, target, lastHit)
    if isPlayer(cid) and isPlayer(target) and lastHit then
        doCreatureSetStorage(target, storage, math.max(1, getCreatureStorage(target, storage)+1))
    return true
end

XML:
<event type="login" name="registered" event="script" value="newlook.lua"/>
<event type="look" name="newlook" event="script" value="newlook.lua"/>
<event type="kill" name="killCount" event="script" value="newlook.lua"/>
 
@Cyber

igot this error:

[Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/newlook.lua:
47: 'end' expected (to close 'function' at line 43) near '<eof>'
[Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/n
ewlook.lua)
data/creaturescripts/scripts/newlook.lua:47: 'end' expected (to close 'function'
at line 43) near '<eof>'
[Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/newlook.lua:
47: 'end' expected (to close 'function' at line 43) near '<eof>'
[Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/n
ewlook.lua)
data/creaturescripts/scripts/newlook.lua:47: 'end' expected (to close 'function'
at line 43) near '<eof>'
[Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/newlook.lua:
47: 'end' expected (to close 'function' at line 43) near '<eof>'
[Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/n
ewlook.lua)
data/creaturescripts/scripts/newlook.lua:47: 'end' expected (to close 'function'
at line 43) near '<eof>'
 
LUA:
local storage = 1358 --storage to store amount of kills
 
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 onLogin(cid)
    registerCreatureEvent(cid, "newlook")
    registerCreatureEvent(cid, "killCount")
    return true
end
 
function onLook(cid, thing, position, lookDistance)
    if isPlayer(thing.uid) and thing.uid ~= cid then
        doPlayerSetSpecialDescription(thing.uid,'\n[Lv: '..getPlayerLevel(thing.uid)..'] [Frags: '..getPlayerFrags(thing.uid)..'] [Deaths: '..math.max(0, getCreatureStorage(thing.uid))..']')
    end
    return true
end
 
function onKill(cid, target, lastHit)
    if isPlayer(cid) and isPlayer(target) and lastHit then
        doCreatureSetStorage(target, storage, math.max(1, getCreatureStorage(target, storage)+1))
    end
    return true
end
 
Hehe now this when i look other player.

Code:
[Error - CreatureScript Interface]
data/creaturescripts/scripts/newlook.lua:onLook
Description:
data/creaturescripts/scripts/newlook.lua:38: bad argument #2 to 'max' (number ex
pected, got boolean)
stack traceback:
        [C]: in function 'max'
        data/creaturescripts/scripts/newlook.lua:38: in function <data/creatures
cripts/scripts/newlook.lua:36>
 
LUA:
local storage = 1358 --storage to store amount of kills
 
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 onLogin(cid)
    registerCreatureEvent(cid, "newlook")
    registerCreatureEvent(cid, "killCount")
    return true
end
 
function onLook(cid, thing, position, lookDistance)
    if isPlayer(thing.uid) and thing.uid ~= cid then
        doPlayerSetSpecialDescription(thing.uid,'\n[Lv: '..getPlayerLevel(thing.uid)..'] [Frags: '..getPlayerFrags(thing.uid)..'] [Deaths: '..math.max(0, getCreatureStorage(thing.uid, storage))..']')
    end
    return true
end
 
function onKill(cid, target, lastHit)
    if isPlayer(cid) and isPlayer(target) and lastHit then
        doCreatureSetStorage(target, storage, math.max(1, getCreatureStorage(target, storage)+1))
    end
    return true
end
 
Damn u LOL awesome ty lord of lua codes LOL

22:09 You see Cybershot. He is an elder druid
[Lv: 120] [Frags: 0] [Deaths: 1].


Just one question its possible do this

22:11 You see yourself. You are an elder druid.

to this

22:11 You see yourself. You are an elder druid.
[Lv: 120] [Frags: 0] [Deaths: 1].

to the player see his frags and deaths? if its too hard don't worry u already helped me a lot!
 
Just one question its possible do this

22:11 You see yourself. You are an elder druid.

to this

22:11 You see yourself. You are an elder druid.
[Lv: 120] [Frags: 0] [Deaths: 1].

to the player see his frags and deaths? if its too hard don't worry u already helped me a lot!
At LUA? everything is possible!(i can say that in the future ^^)
LUA:
local storage = 1358 --storage to store amount of kills
 
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 onLogin(cid)
    registerCreatureEvent(cid, "newlook")
    registerCreatureEvent(cid, "killCount")
    return true
end
  
function onKill(cid, target, lastHit)
    if isPlayer(cid) and isPlayer(target) and lastHit then
        doCreatureSetStorage(target, storage, math.max(1, getCreatureStorage(target, storage)+1))
    end
    return true
end

function onLook(cid, thing, position, lookDistance)
    if isPlayer(thing.uid) and thing.uid ~= cid then
        doPlayerSetSpecialDescription(thing.uid,'\n[Lv: '..getPlayerLevel(thing.uid)..'] [Frags: '..getPlayerFrags(thing.uid)..'] [Deaths: '..math.max(0, getCreatureStorage(thing.uid, storage))..']')
        return true
    elseif thing.uid == cid then
        doPlayerSetSpecialDescription(cid,'\n[Lv: '..getPlayerLevel(cid)..'] [Frags: '..getPlayerFrags(cid)..'] [Deaths: '..math.max(0, getCreatureStorage(cid, storage))..']')
        local string = 'You see yourself.'
        if getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION) then
            string = string..' You are '.. getPlayerGroupName(cid) ..'.'
        elseif getPlayerVocation(cid) ~= 0 then
            string = string..' You are '.. getPlayerVocationName(cid) ..'.'
        else
            string = string..' You have no vocation.'
        end
        string = string..getPlayerSpecialDescription(cid)..'\n'
    
        if getPlayerNameByGUID(getPlayerPartner(cid), false, false) ~= nil then
            string = string..' You are '.. (getPlayerSex(cid) == 0 and 'wife' or 'husband') ..' of '.. getPlayerNameByGUID(getPlayerPartner(cid)) ..'.'
        end
    
        if getPlayerGuildId(cid) > 0 then 
            string = string..' You are ' .. (getPlayerGuildRank(cid) == '' and 'a member' or getPlayerGuildRank(cid)) ..' of the '.. getPlayerGuildName(cid)
            string = getPlayerGuildNick(cid) ~= '' and string..' ('.. getPlayerGuildNick(cid) ..').' or string..'.'
        end 
    
        if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEECREATUREDETAILS) then
            string = string..'\nHealth: ['.. getCreatureHealth(cid) ..' / '.. getCreatureMaxHealth(cid) ..'], Mana: ['.. getCreatureMana(cid) ..' / '.. getCreatureMaxMana(cid) ..'].'
            string = string..'\nIP: '.. doConvertIntegerToIp(getPlayerIp(cid)) ..'.'
        end

        if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEEPOSITION) then
            string = string..'\nPosition: [X:'.. position.x..'] [Y:'.. position.y..'] [Z:'.. position.z..'].'
        end
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string)  
        return false
    end
    return true
end
 
Last edited:
just one word. AWESOME man wtf who are u? LOL

1536671.aca2d25a.560.jpg

no more;
 
Back
Top