Na parte do "onKill" ali, você poderia usar assim também.
function onKill(cid, target) if isPlayer(cid) and isPlayer(target) then if isInArray(skulls, getPlayerSkullType(target)) then addPlayerFrag(cid, 1) end end return trueend
Por Furabio, 11 de abr. de 2016 em Websites & Layouts
info
Grupo: Visconde
Registrado: 27/02/13
Posts: 446
Reputação: +282
Gênero: Masculino

Na parte do "onKill" ali, você poderia usar assim também.
function onKill(cid, target) if isPlayer(cid) and isPlayer(target) then if isInArray(skulls, getPlayerSkullType(target)) then addPlayerFrag(cid, 1) end end return trueend
info
Grupo: Conde
Registrado: 07/04/15
Posts: 962
Reputação: +258
Gênero: Masculino

1 minuto atrás, OrochiElf disse:Na parte do "onKill" ali, você poderia usar assim também.
function onKill(cid, target) if isPlayer(cid) and isPlayer(target) then if isInArray(skulls, getPlayerSkullType(target)) then addPlayerFrag(cid, 1) end end return trueend
Uhum, só que acabei esquecendo o nome da função e na correria fiz com for mesmo hahaha.
Funciona sem site esse sistema para versao 0.3.6 ?
info
Grupo: Conde
Registrado: 07/04/15
Posts: 962
Reputação: +258
Gênero: Masculino

2 minutos atrás, leozinpbb disse:Funciona sem site esse sistema para versao 0.3.6 ?
Sim funciona.
14 minutos atrás, Christensen disse:
Sim funciona.
mais onde vai aparecer o rank do top frags ? nao vi nenhum comando que mostre !
info
Grupo: Conde
Registrado: 07/04/15
Posts: 962
Reputação: +258
Gênero: Masculino

1 hora atrás, leozinpbb disse:mais onde vai aparecer o rank do top frags ? nao vi nenhum comando que mostre !
Vá em talkactions/scripts crie topfrags.lua :
function onSay(cid) local str = "" str = "--[\"Top 20 Fraggers\"]--\n\n" local query = db.getResult('SELECT `name`, `frags_all` FROM `players` WHERE `group_id` < 3 AND `account_id` > 1 ORDER BY `frags_all` DESC LIMIT 20'); k = 1 repeat str = str .. "\n " .. k .. ". "..query:getDataString("name").." - [" .. query:getDataInt("frags_all") .. "]" k = k + 1 until not query:next() doShowTextDialog(cid, 2160, str) return trueend
e adicione em talkactions.XML :
<talkaction words="!topfrags;/topfrags" event="script" value="topfrags.lua"/>
Basta digitar !topfrags ou /topfrags que tu verá os 20 players que tem mais frags no seu servidor.
info
Grupo: Conde
Registrado: 07/04/15
Posts: 962
Reputação: +258
Gênero: Masculino

Atualizado!
Editado Abril 15 por christensen
3 horas atrás, christensen disse:Atualizado!
- Design da página melhorado.
- Adicionado ranking dos 3 maiores fraggers do server.
- Adicionado imagem ao tópico.
da error ao tentar inserir as query no sqlite .
info
Grupo: Conde
Registrado: 07/04/15
Posts: 962
Reputação: +258
Gênero: Masculino

Sim pois sqlite não tem unsigned pelo que pesquisei aqui, tenta :
ALTER TABLE players ADD frags_all smallint(5) default 0;
16 horas atrás, christensen disse:Sim pois sqlite não tem unsigned pelo que pesquisei aqui, tenta :
ALTER TABLE players ADD frags_all smallint(5) default 0;
Obrigado funcionou perfeitamente ! +REP
info
Grupo: Artesão
Registrado: 10/11/11
Posts: 118
Reputação: +2

Obrigado por compartir
Editado Janeiro 8 por Bennyhappy
info
Grupo: Conde
Registrado: 07/04/15
Posts: 962
Reputação: +258
Gênero: Masculino
***IMPORTANTE***
A parte para website foi desenvolvida para funcionar em gesior, então dificilmente irá funcionar em outros sem alguma alteração.
Recentemente fiz um top fragger e decidi disponibilizar, existe um parecido que foi feito pelo Ryzor usei ele como base e melhorei o código tanto php e lua, de acordo com o que eu precisei.
***IMAGEM DO TOP FRAGGERS***
Primeiramente vamos instalar a parte do website(PHP).
Abram seu layout.php e procure por :
e cole logo abaixo :
dps na pasta /pages/ e crie fraggers.php e adicione no arquivo :
<?phpif(!defined('INITIALIZED')) exit;$main_content .= '<div class="TableContainer"> <div class="CaptionContainer"> <div class="CaptionInnerContainer"> <span class="CaptionEdgeLeftTop" style="background-image:url(./layouts/tibiarl/images/content/box-frame-edge.gif);"></span> <span class="CaptionEdgeRightTop" style="background-image:url(./layouts/tibiarl/images/content/box-frame-edge.gif);"></span> <span class="CaptionBorderTop" style="background-image:url(./layouts/tibiarl/images/content/table-headline-border.gif);"></span> <span class="CaptionVerticalLeft" style="background-image:url(./layouts/tibiarl/images/content/box-frame-vertical.gif);"></span> <div class="Text">The 3 best killers on '.htmlspecialchars($config['server_name']).'</div> <span class="CaptionVerticalRight" style="background-image:url(./layouts/tibiarl/images/content/box-frame-vertical.gif);"></span> <span class="CaptionBorderBottom" style="background-image:url(./layouts/tibiarl/images/content/table-headline-border.gif);"></span> <span class="CaptionEdgeLeftBottom" style="background-image:url(./layouts/tibiarl/images/content/box-frame-edge.gif);"></span> <span class="CaptionEdgeRightBottom" style="background-image:url(./layouts/tibiarl/images/content/box-frame-edge.gif);"></span> </div> </div> <table class="Table5" cellpadding="0" cellspacing="0"> <tbody> <tr> <td> <div class="InnerTableContainer"> <table style="width:100%;"> <tbody> <tr> <td> <div class="TableShadowContainerRightTop"> <div class="TableShadowRightTop" style="background-image:url(./layouts/tibiarl/images/content/table-shadow-rt.gif);"></div> </div> <div class="TableContentAndRightShadow" style="background-image:url(./layouts/tibiarl/images/content/table-shadow-rm.gif);"> <div class="TableContentContainer"> <table bgcolor="#D4C0A1" border="0" cellpadding="3" cellspacing="1" width="100%"> <tr bgcolor="#505050"></tr> <tr> <td> <table border="0" cellpadding="4" cellspacing="1" width="100%"> <tr bgcolor="#505050"> <td align="center" class="white" colspan="3"><b>Ranking</b> </td> </tr> <tbody> <tr bgcolor="#F1E0C6">';$rankingFrags = $SQL->query('SELECT name, frags_all, lookbody, lookfeet, lookhead, looklegs, looktype, lookaddons FROM players WHERE group_id = 1 AND account_id != 1 ORDER BY frags_all DESC LIMIT 3');$rm = 1;foreach ($rankingFrags as $member) { $main_content .= ' <td align="center"> <img style="margin-top: -40px; margin-left: -50px; position: relative;" src="images/trofeus/'.$rm.'.gif" /> <img style="margin-top: -45px; margin-left: -40px;" src="outfit.php?id='.$member['looktype'].'&addons='.$member['lookaddons'].'&head='.$member['lookhead'].'&body='.$member['lookbody'].'&legs='.$member['looklegs'].'&feet='.$member['lookfeet'].'" width="80" height="80" /> <br> <a href="?subtopic=characters&name='.$member['name'].'"> '.$member['name'].'</a> <br> <b>'.$member['frags_all'].'</b> </td> '; $rm++;}$main_content .= ' </td> </tr> </table></tr></tbody> </table> <br/> </div> </div> <div class="TableShadowContainer"> <div class="TableBottomShadow" style="background-image:url(./layouts/tibiarl/images/content/table-shadow-bm.gif);"> <div class="TableBottomLeftShadow" style="background-image:url(./layouts/tibiarl/images/content/table-shadow-bl.gif);"></div> <div class="TableBottomRightShadow" style="background-image:url(./layouts/tibiarl/images/content/table-shadow-br.gif);"></div> </div> </td> </tr> </tbody> </table> </div> </td> </tr> </tbody> </table></div><br />';$main_content .= '<div class="TableContainer"> <div class="CaptionContainer"> <div class="CaptionInnerContainer"> <span class="CaptionEdgeLeftTop" style="background-image:url(./layouts/tibiarl/images/content/box-frame-edge.gif);"></span> <span class="CaptionEdgeRightTop" style="background-image:url(./layouts/tibiarl/images/content/box-frame-edge.gif);"></span> <span class="CaptionBorderTop" style="background-image:url(./layouts/tibiarl/images/content/table-headline-border.gif);"></span> <span class="CaptionVerticalLeft" style="background-image:url(./layouts/tibiarl/images/content/box-frame-vertical.gif);"></span> <div class="Text">TOP Frags on '.htmlspecialchars($config['server_name']).'</div> <span class="CaptionVerticalRight" style="background-image:url(./layouts/tibiarl/images/content/box-frame-vertical.gif);"></span> <span class="CaptionBorderBottom" style="background-image:url(./layouts/tibiarl/images/content/table-headline-border.gif);"></span> <span class="CaptionEdgeLeftBottom" style="background-image:url(./layouts/tibiarl/images/content/box-frame-edge.gif);"></span> <span class="CaptionEdgeRightBottom" style="background-image:url(./layouts/tibiarl/images/content/box-frame-edge.gif);"></span> </div> </div> <table class="Table5" cellpadding="0" cellspacing="0"> <tbody> <tr> <td> <div class="InnerTableContainer"> <table style="width:100%;"> <tbody> <tr> <td> <div class="TableShadowContainerRightTop"> <div class="TableShadowRightTop" style="background-image:url(./layouts/tibiarl/images/content/table-shadow-rt.gif);"></div> </div> <div class="TableContentAndRightShadow" style="background-image:url(./layouts/tibiarl/images/content/table-shadow-rm.gif);"> <div class="TableContentContainer"><table border="0" cellspacing="1" cellpadding="4" width="100%"> <tr bgcolor="#505050"> <td class="white" style="text-align: center; font-weight: bold;">Name</td> <td class="white" style="text-align: center; font-weight: bold;">Frags</td> </tr>';$topFrags = $SQL->query('SELECT name, frags_all FROM players WHERE group_id = 1 AND account_id != 1 ORDER BY frags_all DESC LIMIT 30');$bgcount = 0;foreach ($topFrags as $member) { $bgcount++; if(is_int($bgcount / 2)): $bgcolor = $config['site']['darkborder']; else: $bgcolor = $config['site']['lightborder']; endif; $main_content .= '<tr bgcolor="'.$bgcolor.'"> <td><a href="?subtopic=characters&name='.$member['name'].'">'.$member['name'].'</a></td> <td style="text-align: center;">'.$member['frags_all'].'</td> </tr>';};$main_content .= ' </table> </div> </div> <div class="TableShadowContainer"> <div class="TableBottomShadow" style="background-image:url(./layouts/tibiarl/images/content/table-shadow-bm.gif);"> <div class="TableBottomLeftShadow" style="background-image:url(./layouts/tibiarl/images/content/table-shadow-bl.gif);"></div> <div class="TableBottomRightShadow" style="background-image:url(./layouts/tibiarl/images/content/table-shadow-br.gif);"></div> </div> </td> </tr> </tbody> </table> </div> </td> </tr> </tbody> </table></div>';?>Com isso já poderemos verificar os top fraggers do nosso ot acessando www.meusite.com/?subtopic=fraggers
Agora vamos instalar a parte de frags no servidor(LUA).
Primeiramente rode esse comando na sua database :
Vá em creatuscripts/scripts e crie topfrags.lua:
local skulls = {SKULL_WHITE, SKULL_YELLOW, SKULL_RED, SKULL_BLACK}function addPlayerFrag(cid, value) db.executeQuery("UPDATE `players` SET `frags_all` = `frags_all` + " .. value .. " WHERE `id` = " .. getPlayerGUID(cid) .. ";") return trueendfunction onKill(cid, target) if isPlayer(cid) and isPlayer(target) then for i= 1, #skulls do if getPlayerSkullType(target) == skulls[i] then addPlayerFrag(cid, 1) break end end end return trueendfunction onLogin(cid) registerCreatureEvent(cid, "TopFrags") return trueendem creatuscripts.XML adicione:
Pronto!! sistema instalado.
Confira como fica a página : http://baiakfontana.com/?subtopic=fraggers
abrçs
Editado Abril 15 por christensen
v2