Histórico de Curtidas
-
Maarkiin deu reputação a King Laker em (Resolvido)Duvida RoletaPelo que entendi disso V
(100000/10000 = 10% chance to win) 1000 = 1%
10000 = 10%
50000 = 50%
100000 = 100%
Como exemplo a primeira linha dos premios:
[{1, 10001}] = {itemid = 3079, amount = 1, amountChance = 80000}, O item 3079 tem 80% de chance de ser o item entregue para o vencedor.
-
Maarkiin deu reputação a Igorzerah em index.php diferente@Maarkiin não precisa cria o php na pasta pages e coloca no os treco la no layout.php e ja era.
-
Maarkiin deu reputação a Markin em [Gesior AAC] Most Creature KillersBom, hoje fiquei um bom tempo para achar este conteúdo que eu acho que vale a pena estar neste fórum... Eu achei ele neste fórum porém o tópico que ele foi postado esta tudo bagunçado contendo apenas CTRL+C e CTRL+V(este aqui)...
--------------------------------------------------------------------------------------------------------------------
A função deste código é mostrar em uma pagina de seu site um ranking em que mostra quem matou a maior quantidade de determinados monstros... Eu particularmente acho muito bom este sistema.
Imagem de exemplo:
--------------------------------------------------------------------------------------------------------------------
Crie um arquivo dentro da pasta htdocs com o nome countKill.php e adicione isso dentro:
<?php /* Scrip by zonet */ $kills = $config['site']['creatureKills']; $limit = $config['site']['creatureKillShowLimit']; $main_content .= '<table border="0px" cellspacing="1px" cellpadding="4px" width="100%"> <tr bgcolor="#505050" style="color: white;"><th width="10%">Creature</th><th>Creature name</th><th>Most Killer ( '.$limit.' )</th></tr>'; $row = 1; foreach($kills as $name => $storage) { $qa = $SQL->query('SELECT `player_storage`.`player_id`, `player_storage`.`key`, `player_storage`.`value` AS `value`, `players`.`id`, `players`.`name` AS `name` FROM `player_storage` LEFT JOIN `players` ON `player_storage`.`player_id` = `players`.`id` WHERE `player_storage`.`key` = '.$storage.' ORDER BY ABS(value) DESC LIMIT '.$limit)->fetchAll(); $color = ( $row % 2 ? $config['site']['darkborder'] : $config['site']['lightborder']); $row++; $main_content .= '<tr bgcolor="'.$color.'"><td><img src="/images/monsters/'.(str_replace(" ", "" , $name)).'.gif"></td><td width="20%" style="font-size: 13pt; font-weight: bold; color: darkorange;"><center>'.(ucfirst($name)).'</center></td><td>'; $a = 0; foreach( $qa as $q ) { $a++; if($a == 1) $main_content .= '<font color="green">'; if($a == $limit) $main_content .= '<font color="red">'; if($a == $limit/2) $main_content .= '<font color="darkorange">'; $main_content .= '<b>'.$a.'. Name:</b> <a href="?subtopic=characters&name='.urlencode($q['name']).'">'.$q['name'].'</a> (Kills: '.$q['value'].') </font></font></font><br />'; } } $main_content .= '</td></table>'; ?> Em htdocs/config abra o arquivo config.php e adicione a seguinte linha no final:
$config['site']['creatureKillShowLimit'] = 6; $config['site']['creatureKills'] = array('dragon' => 9541, 'dragon lord' => 9542, 'frost dragon' => 9543, 'wyrm' => 9544, 'demon' => 9545); Agora abra o arquivo index.php que fica dentro da pasta htdocs e logo abaixo desta parte:
case "killstatistics"; $topic = "Last Kills"; $subtopic = "killstatistics"; include("killstatistics.php"); break; Adicione isso:
case "countkill"; $topic = "Count Kills"; $subtopic = "countkill"; include("countKill.php"); break; Em htdocs/layouts/tibiacom abra o arquivo layouts.php e logo abaixo disto:
<a href='index.php?subtopic=killstatistics'> <div id='submenu_killstatistics' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'> <div class='LeftChain' style='background-image:url(<?PHP echo "$layout_name"; ?>/images/general/chain.gif);'></div> <div id='ActiveSubmenuItemIcon_killstatistics' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo "$layout_name"; ?>/images/menu/icon-activesubmenu.gif);'></div> <div class='SubmenuitemLabel'>Last Kills</div> <div class='RightChain' style='background-image:url(<?PHP echo "$layout_name"; ?>/images/general/chain.gif);'></div> </div> </a> Adicione isso:
<a href='index.php?subtopic=countkill'> <div id='submenu_countkill' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'> <div class='LeftChain' style='background-image:url(<?PHP echo "$layout_name"; ?>/images/general/chain.gif);'></div> <div id='ActiveSubmenuItemIcon_killstatistics' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo "$layout_name"; ?>/images/menu/icon-activesubmenu.gif);'></div> <div class='SubmenuitemLabel'>Count Kills</div> <div class='RightChain' style='background-image:url(<?PHP echo "$layout_name"; ?>/images/general/chain.gif);'></div> </div> </a> Bom a parte do website esta pronta, vamos para o servidor agora!
Em creaturescripts/scripts crie um arquivo com o nome count.lua e adicione isso dentro:
local monsters = { ["dragon"] = 9541, ["dragon lord"] = 9542, ["frost dragon"] = 9543, ["wyrm"] = 9544, ["demon"] = 9545, } function onKill(cid, target) if(isPlayer(target) ~= true and isPlayer(cid)) then local name = getCreatureName(target) local monster = monsters[string.lower(name)] if(monster) then local killedMonsters = getPlayerStorageValue(cid, monster) if(killedMonsters < 0) then killedMonsters = 1 end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You killed " .. killedMonsters .. " " .. name .. "'s.") setPlayerStorageValue(cid, monster, killedMonsters + 1) end end return true end Em creaturescripts abra o arquivo creaturescripts.xml e adicione isso dentro:
<event type="kill" name="countKill" event="script" value="count.lua"/> Em creaturescripts/scripts abra o arquivo login.lua e adicione esta tag:
registerCreatureEvent(cid, "countKill") Pronto, o sistema foi instalado, agora vamos configurar!
Para adicionar novos monstros basta modificar esta parte no código lua em creaturescripts:
local monsters = { ["dragon"] = 9541, ["dragon lord"] = 9542, ["frost dragon"] = 9543, ["wyrm"] = 9544, ["demon"] = 9545, } E nesta parte em layouts.php
$config['site']['creatureKillShowLimit'] = 6; $config['site']['creatureKills'] = array('dragon' => 9541, 'dragon lord' => 9542, 'frost dragon' => 9543, 'wyrm' => 9544, 'demon' => 9545); Tópico original: Aqui
Créditos: Zonet
-
Maarkiin deu reputação a Dwarfer em (Resolvido)Alavanca potion.local config = { money = 10000, -- Dinheiro que vai custar item = 7591, -- ID do item que vai vender count = 100, -- Quantidade } function onUse(cid, item, fromPosition, itemEx, toPosition) local p = getPlayerPosition(cid) if getPlayerFreeCap(cid) < getItemWeightById(config.item, config.count) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Você não tem cap suficiente para ".. config.count.." "..getItemNameById(config.item)..".") doSendMagicEffect(p, CONST_ME_POFF) return true end if not doPlayerRemoveMoney(cid, config.money) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Você não possui "..config.money.. " gold coins.") doSendMagicEffect(p, CONST_ME_POFF) return true end doPlayerAddItem(cid, config.item, config.count) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você comprou "..config.count.." "..getItemNameById(config.item)..".") doSendAnimatedText(toPosition, "SUCCESS!", COLOR_TEAL) doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945) return true end
-
Maarkiin deu reputação a Markin em (Resolvido)[AJUDA] erro de servidor por uma scriptusa esse aqui:
local config = { positions = { ["Hunts"] = { x = 1024, y = 908, z = 5 }, ["Vocation"] = { x = 1033, y = 909, z = 5 }, ["Konoha"] = { x = 11, y = 794, z = 7 }, ["Retornar"] = { x = 395, y = 1223, z = 7 } } } function onThink(cid, interval, lastExecution) for text, pos in pairs(config.positions) do doSendAnimatedText(pos, text, math.random(1, 255)) end return TRUE end globalevents.xml
<globalevent name="tpmensagem1" interval="2100" script="tlpmenssage.lua"/> -
Bom dia jovens, graças ao grande Omega eu consegui terminar o código do NPC Dicer, a função para checar o gold foi feita por ele então deem um beijo nele
O NPC é parecido com aqueles BOTS que ficam no tibia global em yalahar normalmente, você joga uma quantia em gold e fala L ou H também pode ser Low ou High e com sorte pode ganhar o dobro da quantia apostada, exemplo:
Eu vou lá jogo 20k na mesa e falo Low, caso caia nos números 1, 2 ou 3 eu irei ganhar o dobro da quantia que eu apostei que no foi 20k, mas se cair nos números 4, 5 ou 6 eu iria perder esses 20k.
O High é a mesma coisa porém ao contrario, se eu falo High e cair nos numero 4, 5 ou 6 eu ganho o dobro da quantia que eu apostei e se cair no 1, 2 ou 3 eu perderia tudo.
Crie um arquivo em data/npc com o nome dicer.xml e adicione isso dentro:
<?xml version="1.0"?> <npc name="Dicer" script="data/npc/scripts/dicer.lua" walkinterval="1000" floorchange="0"> <health now="100" max="100"/> <look type="132" head="114" body="0" legs="0" feet="114" addons="3"/> <parameters> <parameter key="message_greet" value="Ola {|PLAYERNAME|}, caso queria tentar a sorte diga {L} ou {Low} para apostar nos numeros {1}, {2} ou {3} ||| {H} ou {High} para apostar nos numeros {4}, {5} ou {6}!" /> </parameters> </npc> Agora vá até data/npc/scripts e crie um arquivo com o nome dicer.lua e adicione isso dentro:
local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid local coins = {[2148] = 1, [2152] = 100, [2160] = 10000} function countMoneyOnPos(pos) local money = 0 for stack = 1, 50 do pos.stackpos = stack local item = getThingFromPos(pos) if item and item.uid > 0 then if coins[item.itemid] then money = money + coins[item.itemid] * item.type end end end return money end local posCoal = {x = 169, y = 58, z = 7} -- POSIÇÃO DO COAL, ONDE O GOLD DEVE ESTAR local posNpc = {x = 193, y = 45, z = 7} -- POSIÇÃO DO NPC local pos = getPosByDir(getThingPos(cid), getCreatureLookDirection(cid), 1) -- NÃO ALTERAR if msgcontains(msg, 'l') or msgcontains(msg, 'L') or msgcontains(msg, 'low') or msgcontains(msg, 'Low') then if countMoneyOnPos(pos) > 0 then if math.random(1, 6) <= 3 then doPlayerAddMoney(cid, countMoneyOnPos(pos)*2) doRemoveItem(getTileItemById(pos, 2148).uid) repeat until not doRemoveItem(getTileItemById(pos, 2148).uid) doRemoveItem(getTileItemById(pos, 2152).uid) repeat until not doRemoveItem(getTileItemById(pos, 2152).uid) doRemoveItem(getTileItemById(pos, 2160).uid) repeat until not doRemoveItem(getTileItemById(pos, 2160).uid) doSendMagicEffect(posNpc, 26) doSendMagicEffect(posNpc, 28) doCreatureSay(getNpcId(), getCreatureName(cid)..' tirou o numero '..math.random(1, 3)..', parabéns!', TALKTYPE_ORANGE_1) else doRemoveItem(getTileItemById(pos, 2148).uid) repeat until not doRemoveItem(getTileItemById(pos, 2148).uid) doRemoveItem(getTileItemById(pos, 2152).uid) repeat until not doRemoveItem(getTileItemById(pos, 2152).uid) doRemoveItem(getTileItemById(pos, 2160).uid) repeat until not doRemoveItem(getTileItemById(pos, 2160).uid) doSendMagicEffect(posNpc, 2) doSendMagicEffect(posNpc, 26) doCreatureSay(getNpcId(), getCreatureName(cid)..' tirou o numero '..math.random(4, 6)..', tente novamente!', TALKTYPE_ORANGE_1) end else doCreatureSay(getNpcId(), getCreatureName(cid)..', coloque uma quantia de gold no recipiente para começar a apostar!', TALKTYPE_ORANGE_1) end elseif msgcontains(msg, 'h') or msgcontains(msg, 'H') or msgcontains(msg, 'high') or msgcontains(msg, 'High') then if countMoneyOnPos(pos) > 0 then if math.random(1, 6) <= 3 then doPlayerAddMoney(cid, countMoneyOnPos(pos)*2) doRemoveItem(getTileItemById(pos, 2148).uid) repeat until not doRemoveItem(getTileItemById(pos, 2148).uid) doRemoveItem(getTileItemById(pos, 2152).uid) repeat until not doRemoveItem(getTileItemById(pos, 2152).uid) doRemoveItem(getTileItemById(pos, 2160).uid) repeat until not doRemoveItem(getTileItemById(pos, 2160).uid) doSendMagicEffect(posNpc, 26) doSendMagicEffect(posNpc, 28) doCreatureSay(getNpcId(), getCreatureName(cid)..' tirou o numero '..math.random(4, 6)..', parabéns!', TALKTYPE_ORANGE_1) else doRemoveItem(getTileItemById(pos, 2148).uid) repeat until not doRemoveItem(getTileItemById(pos, 2148).uid) doRemoveItem(getTileItemById(pos, 2152).uid) repeat until not doRemoveItem(getTileItemById(pos, 2152).uid) doRemoveItem(getTileItemById(pos, 2160).uid) repeat until not doRemoveItem(getTileItemById(pos, 2160).uid) doSendMagicEffect(posNpc, 2) doSendMagicEffect(posNpc, 26) doCreatureSay(getNpcId(), getCreatureName(cid)..' tirou o numero '..math.random(1, 3)..', tente novamente!', TALKTYPE_ORANGE_1) end else doCreatureSay(getNpcId(), getCreatureName(cid)..', coloque uma quantia de gold no recipiente para começar a apostar!', TALKTYPE_ORANGE_1) end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Você deve fazer alterações nesta parte:
local posCoal = {x = 169, y = 58, z = 7} -- POSIÇÃO DO COAL, ONDE O GOLD DEVE ESTAR local posNpc = {x = 193, y = 45, z = 7} -- POSIÇÃO DO NPC Aconselhável montar uma área pro npc ficar idêntica a da fotos para não bugar o código, o coal() deve sempre ficar na frente do player pois a função ira chegar o gold a frente do player.
Ao falar Hi
Npc verificando que não tem gold no coal
Vencendo uma aposta
Perdendo uma aposta
Créditos:
Markin(Anne)
Omega pela função de checar o gold