Ir para conteúdo
  • Cadastre-se

(Resolvido)top fragger effect on player


Ir para solução Resolvido por Dwarfer,

Posts Recomendados

can any one make a script that send a animated text on the player with top frags

Link para o post
Compartilhar em outros sites
  • Respostas 12
  • Created
  • Última resposta

Top Posters In This Topic

When player with top frags login the game, the effect will be shown.

 

Create a file in creaturescripts/scripts:

 

frageffect.lua

 

Spoiler

local t = {
text = "KILLER", 
effect = 28, 
time = 5 -- interval in second between effects
}

function onLogin(cid)
query = db.getResult("SELECT `player_id`, COUNT(`player_id`) as count FROM `player_killers` GROUP BY `player_id` ORDER BY count DESC LIMIT 1")
    if query:getID() ~= -1 then
        name = getPlayerNameByGUID(query:getDataString("player_id"))
        if getPlayerName(cid) == name then
            SendEffect(cid)
        end
    end
return true
end

function SendEffect(cid)
if isPlayer(cid) then
    doSendMagicEffect(getPlayerPosition(cid), t.effect)
    doSendAnimatedText(getPlayerPosition(cid), t.text, COLOR_LIGHTGREEN)
    addEvent(SendEffect, t.time*1000, cid) 
end
return true
end

 

 

In creaturescripts.xml, add the tag:  <event type="login" name="TopFrags" event="script" value="frageffect.lua"/>

Editado por Dwarfer (veja o histórico de edições)

Contato:

 

Link para o post
Compartilhar em outros sites

thanks @Dwarfer working fine 

can you make another script for top magic level and top guild please i think its all about data base Query 

if its ok 

thanks in advance :)

Link para o post
Compartilhar em outros sites

What did you mean with topguild? Guild with more frags, right? If yes, you can try:

 

Spoiler

local t = {
[1] = {effect = 28, text = "KILLER", time = 10, color = COLOR_LIGHTGREEN}, --topfrags
[2] = {effect = 29, text = "HOT MAGE", time = 10, color = COLOR_DARKRED}, -- topML
[3] = {effect = 30, text = "HOT GUILD", time = 10, color = COLOR_LIGHTBLUE} --topGuildFrags
}

function onLogin(cid)
qrys = {
[1] = db.getResult("SELECT `name` FROM `players` WHERE id = (SELECT `player_id` FROM `player_killers` GROUP BY `player_id` ORDER BY COUNT(`player_id`) DESC LIMIT 1)"),
[2] = db.getResult("SELECT `name` FROM `players` WHERE `group_id` < 2 ORDER BY `maglevel` DESC LIMIT 1"),
[3] = db.getResult("SELECT `g`.`id` AS `id`, `g`.`name` AS `name`, COUNT(`g`.`name`) as `frags` FROM `killers` k LEFT JOIN `player_killers` pk ON `k`.`id` = `pk`.`kill_id` LEFT JOIN `players` p ON`pk`.`player_id` = `p`.`id` LEFT JOIN `guild_ranks` gr ON `p`.`rank_id` = `gr`.`id` LEFT JOIN `guilds` g ON `gr`.`guild_id` = `g`.`id` WHERE `k`.`unjustified` = 1 AND `k`.`final_hit`= 1 GROUP BY `name` ORDER BY `frags` DESC, `name` ASC LIMIT 1")
}

list = {}
for _, v in pairs(qrys) do
    if v:getID() == -1 then
        return true
    end
    table.insert(list, v:getDataString("name"))
end

local index = getTopWhat(cid, list, getPlayerName(cid))

if index ~= nil then
    SendEffect(cid, t[index].effect, t[index].text, t[index].time, t[index].color)
end

return true
end

function SendEffect(cid, effect, text, time, color)
if isPlayer(cid) then
    doSendMagicEffect(getPlayerPosition(cid), effect)
    doSendAnimatedText(getPlayerPosition(cid), text, color)
    addEvent(SendEffect, time*1000, cid, effect, text, time, color) 
end
return true
end

function getTopWhat(cid, list, name)
for i, k in pairs(list) do
    if k == name or k == getPlayerGuildName(cid) then
        return i 
    end
end
return nil
end

 

 

 

Editado por Dwarfer (veja o histórico de edições)

Contato:

 

Link para o post
Compartilhar em outros sites
21 hours ago, Dwarfer said:

What did you mean with topguild? Guild with more frags, right? If yes, you can try:

 

  Hide contents


local t = {
[1] = {effect = 28, text = "KILLER", time = 10, color = COLOR_LIGHTGREEN}, --topfrags
[2] = {effect = 29, text = "HOT MAGE", time = 10, color = COLOR_DARKRED}, -- topML
[3] = {effect = 30, text = "HOT GUILD", time = 10, color = COLOR_LIGHTBLUE} --topGuildFrags
}

function onLogin(cid)
qrys = {
[1] = db.getResult("SELECT `name` FROM `players` WHERE id = (SELECT `player_id` FROM `player_killers` GROUP BY `player_id` ORDER BY COUNT(`player_id`) DESC LIMIT 1)"),
[2] = db.getResult("SELECT `name` FROM `players` WHERE `group_id` < 2 ORDER BY `maglevel` DESC LIMIT 1"),
[3] = db.getResult("SELECT `name` FROM `guilds` WHERE id = (SELECT `guild_id` FROM `guild_kills` GROUP BY `guild_id` ORDER BY COUNT(`guild_id`) DESC LIMIT 1)")
}

list = {}
for _, v in pairs(qrys) do
    if v:getID() == -1 then
        return true
    end
    table.insert(list, v:getDataString("name"))
end

local index = getTopWhat(cid, list, getPlayerName(cid))

if index ~= nil then
    SendEffect(cid, t[index].effect, t[index].text, t[index].time, t[index].color)
end

return true
end

function SendEffect(cid, effect, text, time, color)
if isPlayer(cid) then
    doSendMagicEffect(getPlayerPosition(cid), effect)
    doSendAnimatedText(getPlayerPosition(cid), text, color)
    addEvent(SendEffect, time*1000, cid, effect, text, time, color) 
end
return true
end

function getTopWhat(cid, list, name)
for i, k in pairs(list) do
    if k == name or k == getPlayerGuildName(cid) then
        return i 
    end
end
return nil
end

 

 

 

not working and i registered it and every thing no err in console 

if you just make every script alone not all in 1 script maybe it work 

thank you @Dwarfer

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.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Estatísticas dos Fóruns

    96842
    Tópicos
    519594
    Posts



×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo