• TibiaFace

    Tibiaface | Una comunidad Open Tibia donde encontras : mapas, scripts, Otserver, npc y amigos etc ...

    .
    demo menumenu

    Afiliados



    Votar:

    [Ayuda] Bug Look Frags Y Deaths

    Compartir:

    Ver el tema anterior Ver el tema siguiente Ir abajo  Mensaje (Página 1 de 1.)

    1Bình chọn [Ayuda] Bug Look Frags Y Deaths Miér Ago 26, 2020 1:28 am

    Mezzony

    Mezzony
    Miembro
    Miembro
    Hola Amigos De TF.

    Tengo un script de look de frag y deaths lo que pasa es que cuando mato a una persona me da 1 frag y 1 death, y a la persona no le adiciona la death como le hago? aqui el script:



    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

    2 participantes

    2Bình chọn Re: [Ayuda] Bug Look Frags Y Deaths Jue Ago 27, 2020 5:50 pm

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    Código:

    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


    Código:

    <event type="look" name="showKD" event="script" value="KillsandDeath.lua"/>

    Código:

    registerCreatureEvent(cid, "showKD")


    aqui tienes todo en creaturescripts



    [Ayuda] Bug Look Frags Y Deaths YNU5B25
    2 participantes
    http://www.tibiaface.com

    3Bình chọn Re: [Ayuda] Bug Look Frags Y Deaths Vie Ago 28, 2020 9:29 am

    Mezzony

    Mezzony
    Miembro
    Miembro
    Gracias Bro!, pero cuando me doy yo mismo look solo sale, youself y mi vocacion, como hago para que yo mismo pueda ver mis frags y deaths?

    2 participantes

    Contenido patrocinado


    2 participantes

    Ver el tema anterior Ver el tema siguiente Volver arriba  Mensaje (Página 1 de 1.)

    Permisos de este foro:
    No puedes responder a temas en este foro.

     

    BienvenidosTibiaFace es una comunidad de Open Tibia. Para participar debes estar registrado (click para Regístrate).