È sempre bom mencionar qual server você usa, versão e até o seu sistema de frags para que alguem possa te ajuda-lo...
Gostei da ideia, caso alguem poder lhe ajudar, me ajudaria tb.. rs
È sempre bom mencionar qual server você usa, versão e até o seu sistema de frags para que alguem possa te ajuda-lo...
Gostei da ideia, caso alguem poder lhe ajudar, me ajudaria tb.. rs
info
Grupo: Artesão
Registrado: 06/01/08
Posts: 137
Reputação: +10
Char no Tibia: LarissaxD

Mudei lá. se alguém puder ajudar, agradeço muito.
up
alguém plz ?
info
Grupo: Conde
Registrado: 07/04/15
Posts: 926
Reputação: +335
Gênero: Masculino

Bom, para que alguem possa oferecer uma ajuda 100% eficiente, é necessário que vc informe qual distro vc usa, e que ponha um link para mostrar qual o frag system q vc está usando exatamente.
info
Grupo: Artesão
Registrado: 06/01/08
Posts: 137
Reputação: +10
Char no Tibia: LarissaxD

Eu uso distro OTX. a versão do frags é essa.. http://www.xtibia.com/forum/topic/145118-creatureevent-contagem-de-frags-no-look/
Alguém ?
info
Grupo: Marquês
Registrado: 25/09/10
Posts: 1.3k
Reputação: +446
Gênero: Masculino

Testa isso numa função aí, veja se da print de um número
local online = getOnlinePlayers() local winner = online[1] for l, pid in pairs(online) do if getPlayerFrags(online[l]) > getPlayerFrags(winner) then local winner = online[l] end end print(getCreatureName(winner))
Não esquece de colocar a função getPlayerFrags junto com o script de test... (eu recomendo colocar ela dentro da pasta data/lib, para não precisar declarar toda hora que usar)
info
Grupo: Artesão
Registrado: 06/01/08
Posts: 137
Reputação: +10
Char no Tibia: LarissaxD

teria como fazer ? eu não sei mecher em scripts =/
info
Grupo: Marquês
Registrado: 25/09/10
Posts: 1.3k
Reputação: +446
Gênero: Masculino

É só copiar um onSay e colocar o script entre o
function onSay(cid, ...)
E o
end
Só colocar no meio,e uma tag você cópia e edita, vou dormir... Qq coisa quando acessar o fórum eu respondo.
info
Grupo: Conde
Registrado: 07/04/15
Posts: 926
Reputação: +335
Gênero: Masculino

*Apenas a titulo de testes...
Vá em data\talkactions e adicione essa tag ao arquivo talkactions.xml:
<talkaction words="!teste" event="script" value="teste.lua"/>
Agora vá em data\talkactions\scripts e crie um arquivo chamado teste.lua e adicione isso dentro:
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 onSay(cid, words, param)
local online = getOnlinePlayers()
local winner = online[1]
for l, pid in pairs(online) do
if getPlayerFrags(online[l]) > getPlayerFrags(winner) then
local winner = online[l]
end
end
print(getCreatureName(winner))
return true
end
Agora, dentro do jogo utilize o comando !teste e então confira no console (distro) se apareceu algum nome de player avulso na ultima linha.
Editado Janeiro 31 por Danihcv
info
Grupo: Artesão
Registrado: 06/01/08
Posts: 137
Reputação: +10
Char no Tibia: LarissaxD

Deu esse erro :
up
info
Grupo: Conde
Registrado: 07/04/15
Posts: 926
Reputação: +335
Gênero: Masculino

Ok... Vamos tentar isolar o problema...
Troque o seu script do sistema, por esse:
*ou seja, troque o ultimo script que vc me mandou por pm, por esse:
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, "fraglook")
return true
end
function onLook(cid, thing, position, lookDistance)
if isPlayer(thing.uid) and thing.uid ~= cid then
doPlayerSetSpecialDescription(thing.uid,'[Frags: '..getPlayerFrags(thing.uid)..']')
return true
elseif thing.uid == cid then
doPlayerSetSpecialDescription(cid,'[Frags: '..getPlayerFrags(cid)..']')
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)..''
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
local online = getOnlinePlayers()
local winner = online[1]
for l, pid in pairs(online) do
if getPlayerFrags(online[l]) > getPlayerFrags(winner) then
local winner = online[l]
end
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, tostring(getCreatureName(winner)))
return true
end
Editado Fevereiro 1 por Danihcv
info
Grupo: Artesão
Registrado: 06/01/08
Posts: 137
Reputação: +10
Char no Tibia: LarissaxD

continua dando o mesmo erro.
up
info
Grupo: Marquês
Registrado: 25/09/10
Posts: 1.3k
Reputação: +446
Gênero: Masculino

AND `pd`.`date` >= " .. (time - (30 * 86400)) .. "
Tá dando boolean
info
Grupo: Artesão
Registrado: 06/01/08
Posts: 137
Reputação: +10
Char no Tibia: LarissaxD

Poderia resolver o problema por favor ? Não entendo... =/
up
alguém plz
Alguém por favor poderia ajudar ?
info
Grupo: Herói
Registrado: 25/02/07
Posts: 859
Reputação: +331
Gênero: Masculino

AND `pd`.`date` >= " .. (time - (30 * 86400)) .. "Tá dando boolean
Acredito que o boolean seja ou no getPlayerGUID(cid) ou na hora de selecionar da tabela (se o player me questão não tiver nada no campo requisitado), não?
info
Grupo: Artesão
Registrado: 06/01/08
Posts: 137
Reputação: +10
Char no Tibia: LarissaxD
Olá gostaria de pedir um script, no qual, ele todo mês automaticamente tivesse um resete no final do mês dos pontos de frag, e um premio para o top frag do servidor, alguém poderia me ajudar por favor.
Server 8.60. Sistema de frag normal, que tem no xtibia.
Agradeço desde de ja.
Editado Janeiro 29 por gabreilk