Postado Agosto 17, 2017 7 anos can any one make a script that send a animated text on the player with top frags
Postado Agosto 17, 2017 7 anos 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 Agosto 17, 2017 7 anos por Dwarfer (veja o histórico de edições) Contato: Email: [email protected] Discord: Dwarfer#2715
Postado Agosto 18, 2017 7 anos Autor 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
Postado Agosto 18, 2017 7 anos 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 Agosto 21, 2017 7 anos por Dwarfer (veja o histórico de edições) Contato: Email: [email protected] Discord: Dwarfer#2715
Postado Agosto 19, 2017 7 anos Autor 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
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.