bilaux 0 Postado Dezembro 30, 2018 Share Postado Dezembro 30, 2018 boa tarde, funciona só quando eu mesmo dou look, se dou em algum não aparece, como resolver ??? function getDeaths(cid) local query, d = db.getResult("SELECT `player_id` FROM `player_killers` 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 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 return doPlayerSetSpecialDescription(thing.uid, '\n'.. '[Frags: ' .. getPlayerFrags(thing.uid) .. ' - Deaths: ' .. getDeaths(thing.uid) .. ']') elseif thing.uid == cid then 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 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 string = string..'\n'.. '[Frags: ' .. getPlayerFrags(cid) .. ' - Deaths: ' .. getDeaths(cid) .. ']' 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 return false, doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string) end return 1 end Link para o comentário Compartilhar em outros sites More sharing options...
Henrique Hassi 0 Postado Dezembro 31, 2018 Share Postado Dezembro 31, 2018 (editado) boa noite, testa essa script, LEMBRANDO QUE É OTX, Mas vale a pena testar... esse é a script, cria com nome de KillsandDeath.lua Citar 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 e no Creaturescript.xml coloca isso Citar <event type="look" name="showKD" event="script" value="KillsandDeath.lua"/> Se deu certo, da 1 REP + ai brother, caso contrario poste o que aparece na sua distro Editado Dezembro 31, 2018 por Henrique Hassi Link para o comentário Compartilhar em outros sites More sharing options...
Diretor Yan Liima 577 Postado Dezembro 31, 2018 Diretor Share Postado Dezembro 31, 2018 (editado) Analisei aqui e parece não ter nenhum problema. Tentei editar pelo celular aqui. Tente assim: Spoiler function getDeaths(cid) local query, d = db.getResult("SELECT `player_id` FROM `player_killers` 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 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) local string = 'You see yourself.' if isPlayer(thing.uid) and thing.uid ~= cid then return doPlayerSetSpecialDescription(thing.uid, '\n'.. '[Frags: ' .. getPlayerFrags(thing.uid) .. ' - Deaths: ' .. getDeaths(thing.uid) .. ']') elseif thing.uid == cid then 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 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 string = string..'\n'.. '[Frags: ' .. getPlayerFrags(cid) .. ' - Deaths: ' .. getDeaths(cid) .. ']' 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 Editado Dezembro 31, 2018 por nedroesdoksdja Link para o comentário Compartilhar em outros sites More sharing options...
bilaux 0 Postado Dezembro 31, 2018 Autor Share Postado Dezembro 31, 2018 msm coisa só aparece se dar look em vc msm, se dar em alguém não aparece... 7 minutos atrás, Yan Liima disse: Analisei aqui e parece não ter nenhum problema. Tentei editar pelo celular aqui. Tente assim: Ocultar conteúdo function getDeaths(cid) local query, d = db.getResult("SELECT `player_id` FROM `player_killers` 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 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) local string = 'You see yourself.' if isPlayer(thing.uid) and thing.uid ~= cid then return doPlayerSetSpecialDescription(thing.uid, '\n'.. '[Frags: ' .. getPlayerFrags(thing.uid) .. ' - Deaths: ' .. getDeaths(thing.uid) .. ']') elseif thing.uid == cid then 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 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 string = string..'\n'.. '[Frags: ' .. getPlayerFrags(cid) .. ' - Deaths: ' .. getDeaths(cid) .. ']' 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 Link para o comentário Compartilhar em outros sites More sharing options...
Diretor Yan Liima 577 Postado Dezembro 31, 2018 Diretor Share Postado Dezembro 31, 2018 13 minutos atrás, bilaux disse: msm coisa só aparece se dar look em vc msm, se dar em alguém não aparece... Estranho irmão... Da algum erro na distro? como está a TAG no creaturescript.xml? Tente assim: Spoiler function getDeaths(cid) local query, d = db.getResult("SELECT `player_id` FROM `player_killers` 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 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) local string = 'You see yourself.' if isPlayer(thing.uid) and thing.uid ~= cid then doPlayerSetSpecialDescription(thing.uid, '\n'.. '[Frags: ' .. getPlayerFrags(thing.uid) .. ' - Deaths: ' .. getDeaths(thing.uid) .. ']') end if thing.uid == cid then 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 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 string = string..'\n'.. '[Frags: ' .. getPlayerFrags(cid) .. ' - Deaths: ' .. getDeaths(cid) .. ']' 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 Link para o comentário Compartilhar em outros sites More sharing options...
bilaux 0 Postado Dezembro 31, 2018 Autor Share Postado Dezembro 31, 2018 não da erro, mais o look só aparece pra ti msm, se alguém te dar look não aparece... no xml ta assim <event type="look" name="showKD" event="script" value="KillsandDeath.lua"/> 9 horas atrás, Yan Liima disse: Estranho irmão... Da algum erro na distro? como está a TAG no creaturescript.xml? Tente assim: Ocultar conteúdo function getDeaths(cid) local query, d = db.getResult("SELECT `player_id` FROM `player_killers` 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 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) local string = 'You see yourself.' if isPlayer(thing.uid) and thing.uid ~= cid then doPlayerSetSpecialDescription(thing.uid, '\n'.. '[Frags: ' .. getPlayerFrags(thing.uid) .. ' - Deaths: ' .. getDeaths(thing.uid) .. ']') end if thing.uid == cid then 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 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 string = string..'\n'.. '[Frags: ' .. getPlayerFrags(cid) .. ' - Deaths: ' .. getDeaths(cid) .. ']' 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 Link para o comentário Compartilhar em outros sites More sharing options...
Diretor Yan Liima 577 Postado Janeiro 6, 2019 Diretor Share Postado Janeiro 6, 2019 Em 31/12/2018 em 09:26, bilaux disse: não da erro, mais o look só aparece pra ti msm, se alguém te dar look não aparece... no xml ta assim <event type="look" name="showKD" event="script" value="KillsandDeath.lua"/> Amigo cheguei de viagem e testei aqui. Aqui está funcionando normal... Deixei da mesma maneira que o seu. Porém no meu login.lua coloquei: registerCreatureEvent(cid, "showKD") mas pra esse tipo de script não é necessario. Você por acaso não tem um outro script de look não né? Nem por creaturescript nem por mods, certo? Pois se tiver pode estar dando conflito. Link para o comentário Compartilhar em outros sites More sharing options...
Marshmello 270 Postado Fevereiro 20, 2019 Share Postado Fevereiro 20, 2019 A questão neste suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta. + Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda. * Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado. Link para o comentário Compartilhar em outros sites More sharing options...
Posts Recomendados