<event type="login" name="registered" event="script" value="newlook.lua"/>
<event type="look" name="newlook" event="script" value="newlook.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
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
to thisLUA:<group id="1" name="Player"/>
LUA:<group id="1" name="Player" customFlags="8192"/>
on data/xml/groups.xml
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
<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"/>
[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>'
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
[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>
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
At LUA? everything is possible!(i can say that in the future ^^)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!
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