Ir para conteúdo
  • Cadastre-se

(Resolvido)Fechar script


Ir para solução Resolvido por Movie,

Posts Recomendados

  • Moderador

Alguém pf me ajuda a fechar esse script.. Eu removi um outro sistema que estava dentro dele, mas não consegui remover e ter a funcionalidade do mesmo.

Spoiler

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).."]. [Critical: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,48903)) or 0)).."], [Dodge: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,98798644)) or 0)).."]. \n"..(getPlayerSex(thing.uid) == 0 and "She" or "He").." is ")
        else
        doPlayerSetSpecialDescription(thing.uid, "[Frags: "..getPlayerFrags(thing.uid).."]. [Critical: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,48903)) or 0)).."], [Dodge: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,98798644)) or 0)).."].")
        end
        return true
    elseif thing.uid == cid then
        doPlayerSetSpecialDescription(cid, "[Frags: "..getPlayerFrags(cid).."]. [Critical: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,48903)) or 0)).."], [Dodge: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,98798644)) or 0))..".]")
        else
        doPlayerSetSpecialDescription(cid, "[Frags: "..getPlayerFrags(cid).."].\n [Critical: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,48903)) or 0)).."], [Dodge: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,98798644)) or 0))..".]")
        end     
        local string = 'You see yourself.'
        if getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION) then
            string = string..' You are '.. getPlayerGroupName(cid) ..'. \n[Critical: '..math.max(0,(tonumber(getCreatureStorage(thing.uid,48903)) or 0))..'], [Dodge: '..math.max(0,(tonumber(getCreatureStorage(thing.uid,98798644)) or 0))..'].'
        elseif getPlayerVocation(cid) ~= 0 then
            string = string..' You are '.. getPlayerVocationName(cid) ..'. \n[Critical: '..math.max(0,(tonumber(getCreatureStorage(thing.uid,48903)) or 0))..'], [Dodge: '..math.max(0,(tonumber(getCreatureStorage(thing.uid,98798644)) or 0))..'].'
        else
            string = string..' You have no vocation.'
        end
        string = string..getPlayerSpecialDescription(cid)..''

 
        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 isPlayer(thing.uid) 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

image.png.1a2cddb4fbb7d5882f0bc55f6b79e578.png

Meu Curso sobre Programação para OTServer

Programando OTServer

 

Peça o seu script! Entre agora mesmo no grupo

Developing

 

Conteúdos:

 

Discord: Belmont#7352

Não esqueça do REP+ :)     

Link para o post
Compartilhar em outros sites
  • Moderador
6 horas atrás, Phineasz disse:

Alguém pf me ajuda a fechar esse script.. Eu removi um outro sistema que estava dentro dele, mas não consegui remover e ter a funcionalidade do mesmo.

  Ocultar conteúdo

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).."]. [Critical: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,48903)) or 0)).."], [Dodge: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,98798644)) or 0)).."]. \n"..(getPlayerSex(thing.uid) == 0 and "She" or "He").." is ")
        else
        doPlayerSetSpecialDescription(thing.uid, "[Frags: "..getPlayerFrags(thing.uid).."]. [Critical: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,48903)) or 0)).."], [Dodge: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,98798644)) or 0)).."].")
        end
        return true
    elseif thing.uid == cid then
        doPlayerSetSpecialDescription(cid, "[Frags: "..getPlayerFrags(cid).."]. [Critical: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,48903)) or 0)).."], [Dodge: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,98798644)) or 0))..".]")
        else
        doPlayerSetSpecialDescription(cid, "[Frags: "..getPlayerFrags(cid).."].\n [Critical: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,48903)) or 0)).."], [Dodge: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,98798644)) or 0))..".]")
        end     
        local string = 'You see yourself.'
        if getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION) then
            string = string..' You are '.. getPlayerGroupName(cid) ..'. \n[Critical: '..math.max(0,(tonumber(getCreatureStorage(thing.uid,48903)) or 0))..'], [Dodge: '..math.max(0,(tonumber(getCreatureStorage(thing.uid,98798644)) or 0))..'].'
        elseif getPlayerVocation(cid) ~= 0 then
            string = string..' You are '.. getPlayerVocationName(cid) ..'. \n[Critical: '..math.max(0,(tonumber(getCreatureStorage(thing.uid,48903)) or 0))..'], [Dodge: '..math.max(0,(tonumber(getCreatureStorage(thing.uid,98798644)) or 0))..'].'
        else
            string = string..' You have no vocation.'
        end
        string = string..getPlayerSpecialDescription(cid)..''

 
        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 isPlayer(thing.uid) 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

image.png.1a2cddb4fbb7d5882f0bc55f6b79e578.png

 

Vai acrescentando "end" no final até parar senão vai removendo os "end" n to pelo pc pra editar pra vc mais posso sugerir que vc mesmo faça as alterações

 

20230912_034613.png.cf49b650c34dd7d7b1f79bd49c70f53c.png

Eu sou um entusiasta da programação apaixonado por ajudar a comunidade open source a crescer. Sempre em busca de novos desafios e oportunidades para contribuir com meu código.  #OpenSource #Programação #Contribuição

 

Link para o post
Compartilhar em outros sites
  • Moderador

@L3K0T Bllz, vou tentar aqui

@L3K0T Não consegui, tentei até tirar a linha que tá dando erro, mas o erro apareceu em outra linha

Meu Curso sobre Programação para OTServer

Programando OTServer

 

Peça o seu script! Entre agora mesmo no grupo

Developing

 

Conteúdos:

 

Discord: Belmont#7352

Não esqueça do REP+ :)     

Link para o post
Compartilhar em outros sites
  • Moderador
  • Moderador

@Movie Eu consegui remover todo o sistema de Army do servidor, única parte que não tive sucesso foi aqui no script do Look. Se você puder remover pra mim por favor, agradeço bastante

Spoiler

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
        local temporary_level = getPlayerStorageValue(thing.uid, ARMY_LEVEL)
        if temporary_level >= 1 then
        doPlayerSetSpecialDescription(thing.uid, " [Frags: "..getPlayerFrags(thing.uid).."], [Critical: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,48903)) or 0)).."], [Dodge: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,98798644)) or 0)).."] \n"..(getPlayerSex(thing.uid) == 0 and "She" or "He").." is ")
        else
        doPlayerSetSpecialDescription(thing.uid, " [Frags: "..getPlayerFrags(thing.uid).."], [Critical: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,48903)) or 0)).."], [Dodge: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,98798644)) or 0)).."]")
        end
        local temporary_level = nil
        return true
    elseif thing.uid == cid then
        local temporary_level = getPlayerStorageValue(cid, ARMY_LEVEL)
        if temporary_level >= 1 then
        doPlayerSetSpecialDescription(cid, " [Frags: "..getPlayerFrags(cid).."], [Critical: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,48903)) or 0)).."], [Dodge: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,98798644)) or 0)).."] You are ")
        else
        doPlayerSetSpecialDescription(cid, " [Frags: "..getPlayerFrags(cid).."], [Critical: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,48903)) or 0)).."], [Dodge: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,98798644)) or 0)).."]")
        end
        local temporary_level = nil      
        local string = 'You see yourself.'
        if getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION) then
            string = string..' You are '.. getPlayerGroupName(cid) ..'. [Critical: '..math.max(0,(tonumber(getCreatureStorage(thing.uid,48903)) or 0))..'], [Dodge: '..math.max(0,(tonumber(getCreatureStorage(thing.uid,98798644)) or 0))..'].'
        elseif getPlayerVocation(cid) ~= 0 then
            string = string..' You are '.. getPlayerVocationName(cid) ..'.'
        else
            string = string..' You have no vocation.'
        end
        string = string..getPlayerSpecialDescription(cid)..''

 
        if getPlayerGuildId(cid) > 0 then 
            string = string..' You are ' .. (getPlayerGuildRank(cid) == '' and 'a member' or getPlayerGuildRank(cid)) ..' of the guild '.. 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 isPlayer(thing.uid) 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 por Phineasz (veja o histórico de edições)

Meu Curso sobre Programação para OTServer

Programando OTServer

 

Peça o seu script! Entre agora mesmo no grupo

Developing

 

Conteúdos:

 

Discord: Belmont#7352

Não esqueça do REP+ :)     

Link para o post
Compartilhar em outros sites
  • Moderador
3 horas atrás, Phineasz disse:

@Movie Eu consegui remover todo o sistema de Army do servidor, única parte que não tive sucesso foi aqui no script do Look. Se você puder remover pra mim por favor, agradeço bastante

  Mostrar conteúdo oculto


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
        local temporary_level = getPlayerStorageValue(thing.uid, ARMY_LEVEL)
        if temporary_level >= 1 then
        doPlayerSetSpecialDescription(thing.uid, "[Frags: "..getPlayerFrags(thing.uid).."]. [Critical: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,48912)) or 0)).."!], [Dodge: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,48901)) or 0)).."!]\n"..(getPlayerSex(thing.uid) == 0 and "She" or "He").." is "..ARMY[getPlayerStorageValue(thing.uid, ARMY_LEVEL)][3].." and have "..getPlayerStorageValue(thing.uid, ARMY_EXPERIENCE).." of "..ARMY[getPlayerStorageValue(thing.uid, ARMY_LEVEL)][2].." army points.")
        else
        doPlayerSetSpecialDescription(thing.uid, "[Frags: "..getPlayerFrags(thing.uid).."] No have army points.\n[Critical: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,48912)) or 0)).."!], [Dodge: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,48901)) or 0)).."!]")
        end
        local temporary_level = nil
        return true
    elseif thing.uid == cid then
        local temporary_level = getPlayerStorageValue(cid, ARMY_LEVEL)
        if temporary_level >= 1 then
        doPlayerSetSpecialDescription(cid, "[Frags: "..getPlayerFrags(cid).."]. [Critical: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,48912)) or 0)).."!], [Dodge: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,48901)) or 0)).."!] You are "..ARMY[getPlayerStorageValue(cid, ARMY_LEVEL)][3].." and have "..getPlayerStorageValue(cid, ARMY_EXPERIENCE).." of "..ARMY[getPlayerStorageValue(cid, ARMY_LEVEL)][2].." army points.")
        else
        doPlayerSetSpecialDescription(cid, "[Frags: "..getPlayerFrags(cid).."] You no have army points.\n [Critical: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,48912)) or 0)).."!], [Dodge: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,48901)) or 0)).."!]")
        end
        local temporary_level = nil      
        local string = 'You see yourself.'
        if getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION) then
            string = string..' You are '.. getPlayerGroupName(cid) ..'. \n[Critical: '..math.max(0,(tonumber(getCreatureStorage(thing.uid,48912)) or 0))..'!], [Dodge: '..math.max(0,(tonumber(getCreatureStorage(thing.uid,48901)) or 0))..'!].'
        elseif getPlayerVocation(cid) ~= 0 then
            string = string..' You are '.. getPlayerVocationName(cid) ..'. \n[Critical: '..math.max(0,(tonumber(getCreatureStorage(thing.uid,48912)) or 0))..'!], [Dodge: '..math.max(0,(tonumber(getCreatureStorage(thing.uid,48901)) or 0))..'!].'
        else
            string = string..' You have no vocation.'
        end
        string = string..getPlayerSpecialDescription(cid)..''

 
        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 isPlayer(thing.uid) 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

 

 

Me fala o que esse sistema de army faz, não sei onde posso alterar no code ou não.

Link para o post
Compartilhar em outros sites
  • Moderador

@Movie O sistema de Army é um sistema de graduação, você pode subir ranks ao matar jogadores. Esse Fraglook ele só mostra o seu rank e quantos pontos faltam para o próximo rank, e era isso que eu estava tentando remover.

 

@Movie Eu editei o script aqui, consegui deixar do jeito que eu quero, mas eu deixei tudo sobre o Army dentro do script, será que isso pode da conflito? Também editei o script do tópico.

Meu Curso sobre Programação para OTServer

Programando OTServer

 

Peça o seu script! Entre agora mesmo no grupo

Developing

 

Conteúdos:

 

Discord: Belmont#7352

Não esqueça do REP+ :)     

Link para o post
Compartilhar em outros sites
  • Moderador

Tenta

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).."], [Critical: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,48903)) or 0)).."], [Dodge: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,98798644)) or 0)).."] \n"..(getPlayerSex(thing.uid) == 0 and "She" or "He").." is ")
	elseif thing.uid == cid then
        doPlayerSetSpecialDescription(cid, " [Frags: "..getPlayerFrags(cid).."], [Critical: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,48903)) or 0)).."], [Dodge: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,98798644)) or 0)).."]") 
        local string = 'You see yourself.'
        if getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION) then
            string = string..' You are '.. getPlayerGroupName(cid) ..'. [Critical: '..math.max(0,(tonumber(getCreatureStorage(thing.uid,48903)) or 0))..'], [Dodge: '..math.max(0,(tonumber(getCreatureStorage(thing.uid,98798644)) or 0))..'].'
        elseif getPlayerVocation(cid) ~= 0 then
            string = string..' You are '.. getPlayerVocationName(cid) ..'.'
        else
            string = string..' You have no vocation.'
        end
        string = string..getPlayerSpecialDescription(cid)..''

 
        if getPlayerGuildId(cid) > 0 then 
            string = string..' You are ' .. (getPlayerGuildRank(cid) == '' and 'a member' or getPlayerGuildRank(cid)) ..' of the guild '.. 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 isPlayer(thing.uid) 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 post
Compartilhar em outros sites
  • Moderador

@Movie Deu certo! Brigadão. Posso te pedir mais uma coisa? Será que você consegue mudar o Look de aparecer a posição pra aparecer em tudo que ele de Look? Por que essa parte do script só está funcionando quando o player da look nele mesmo.

Meu Curso sobre Programação para OTServer

Programando OTServer

 

Peça o seu script! Entre agora mesmo no grupo

Developing

 

Conteúdos:

 

Discord: Belmont#7352

Não esqueça do REP+ :)     

Link para o post
Compartilhar em outros sites
  • Moderador
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).."], [Critical: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,48903)) or 0)).."], [Dodge: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,98798644)) or 0)).."] \n"..(getPlayerSex(thing.uid) == 0 and "She" or "He").." is ")
	elseif thing.uid == cid then
        doPlayerSetSpecialDescription(cid, " [Frags: "..getPlayerFrags(cid).."], [Critical: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,48903)) or 0)).."], [Dodge: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,98798644)) or 0)).."]") 
        local string = 'You see yourself.'
        if getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION) then
            string = string..' You are '.. getPlayerGroupName(cid) ..'. [Critical: '..math.max(0,(tonumber(getCreatureStorage(thing.uid,48903)) or 0))..'], [Dodge: '..math.max(0,(tonumber(getCreatureStorage(thing.uid,98798644)) or 0))..'].'
        elseif getPlayerVocation(cid) ~= 0 then
            string = string..' You are '.. getPlayerVocationName(cid) ..'.'
        else
            string = string..' You have no vocation.'
        end
        string = string..getPlayerSpecialDescription(cid)..''

 
        if getPlayerGuildId(cid) > 0 then 
            string = string..' You are ' .. (getPlayerGuildRank(cid) == '' and 'a member' or getPlayerGuildRank(cid)) ..' of the guild '.. 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
 
            string = string..'\nPosition: [X:'.. position.x..'] [Y:'.. position.y..'] [Z:'.. position.z..'].'
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string)  
        return false
    end
    return true
end

 

Link para o post
Compartilhar em outros sites
  • Moderador

Ele só está aparecendo a Postion quando você da look em sí próprio

Spoiler

 


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).."], [Critical: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,48903)) or 0)).."], [Dodge: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,98798644)) or 0)).."] \n"..(getPlayerSex(thing.uid) == 0 and "She" or "He").." is ")
	elseif thing.uid == cid then
        doPlayerSetSpecialDescription(cid, " [Frags: "..getPlayerFrags(cid).."], [Critical: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,48903)) or 0)).."], [Dodge: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,98798644)) or 0)).."]") 
        local string = 'You see yourself.'
        if getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION) then
            string = string..' You are '.. getPlayerGroupName(cid) ..'. [Critical: '..math.max(0,(tonumber(getCreatureStorage(thing.uid,48903)) or 0))..'], [Dodge: '..math.max(0,(tonumber(getCreatureStorage(thing.uid,98798644)) or 0))..'].'
        elseif getPlayerVocation(cid) ~= 0 then
            string = string..' You are '.. getPlayerVocationName(cid) ..'.'
        else
            string = string..' You have no vocation.'
        end
        string = string..getPlayerSpecialDescription(cid)..''

 
        if getPlayerGuildId(cid) > 0 then 
            string = string..' You are ' .. (getPlayerGuildRank(cid) == '' and 'a member' or getPlayerGuildRank(cid)) ..' of the guild '.. 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
 
            string = string..'\nPosition: [X:'.. position.x..'] [Y:'.. position.y..'] [Z:'.. position.z..'].'
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string)  
        return false
    end
    return true
end

image.thumb.png.d3ed1037975dfb1a4423a5974debf8d3.png

Meu Curso sobre Programação para OTServer

Programando OTServer

 

Peça o seu script! Entre agora mesmo no grupo

Developing

 

Conteúdos:

 

Discord: Belmont#7352

Não esqueça do REP+ :)     

Link para o post
Compartilhar em outros sites
  • Moderador
  • Solução

Tenta assim

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, "Position: [X:".. position.x.."] [Y:".. position.y.."] [Z:".. position.z.."]\n[Frags: "..getPlayerFrags(thing.uid).."], [Critical: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,48903)) or 0)).."], [Dodge: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,98798644)) or 0)).."] \n"..(getPlayerSex(thing.uid) == 0 and "She" or "He").." is ")
	elseif thing.uid == cid then
        doPlayerSetSpecialDescription(cid, " [Frags: "..getPlayerFrags(cid).."], [Critical: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,48903)) or 0)).."], [Dodge: "..math.max(0,(tonumber(getCreatureStorage(thing.uid,98798644)) or 0)).."]") 
        local string = 'You see yourself.'
        if getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION) then
            string = string..' You are '.. getPlayerGroupName(cid) ..'. [Critical: '..math.max(0,(tonumber(getCreatureStorage(thing.uid,48903)) or 0))..'], [Dodge: '..math.max(0,(tonumber(getCreatureStorage(thing.uid,98798644)) or 0))..'].'
        elseif getPlayerVocation(cid) ~= 0 then
            string = string..' You are '.. getPlayerVocationName(cid) ..'.'
        else
            string = string..' You have no vocation.'
        end
        string = string..getPlayerSpecialDescription(cid)..''

 
        if getPlayerGuildId(cid) > 0 then 
            string = string..' You are ' .. (getPlayerGuildRank(cid) == '' and 'a member' or getPlayerGuildRank(cid)) ..' of the guild '.. 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
 
            string = string..'\nPosition: [X:'.. position.x..'] [Y:'.. position.y..'] [Z:'.. position.z..'].'
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string)  
        return false
    end
    return true
end

 

Link para o post
Compartilhar em outros sites
  • Moderador

@Movie Agora deu pra aparecer quando da Look em outro Player, mas quando da Look no piso não mostra

image.thumb.png.7346be10581a6a810d0e262caa327019.png

Meu Curso sobre Programação para OTServer

Programando OTServer

 

Peça o seu script! Entre agora mesmo no grupo

Developing

 

Conteúdos:

 

Discord: Belmont#7352

Não esqueça do REP+ :)     

Link para o post
Compartilhar em outros sites
  • Moderador
  • Moderador

@Movie Tranquilo, já ajudou pra caramba, obrigado mano, tmj

Meu Curso sobre Programação para OTServer

Programando OTServer

 

Peça o seu script! Entre agora mesmo no grupo

Developing

 

Conteúdos:

 

Discord: Belmont#7352

Não esqueça do REP+ :)     

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo