Ir para conteúdo

aawadallaki

Membro
  • Registro em

  • Última visita

Histórico de Curtidas

  1. Gostei
    aawadallaki deu reputação a Huziwara em [Talkaction] !bless + eficiente com twist of fate   
    Olá galerinha,
    Estou trazendo um script de minha autoria para vocês usufruir-lo.
     
    "O que ele tem de diferente dos outros comandos ?"
     
    Então, ele além de comprar as 5 blessings ele também compra o twist of fate.
    Ao morrer com as 6 blessings por 1 monstro, você perderá apenas as 5 blessings, e o twist of fate continuará, então usando o comando !bless com esse script você comprará apenas as 5 blessings. (Seria um disperdicio comprar as 6 blessings por um preço mais caro, sendo que você já tem a twist of fate).
     
    Quando você morrer para um player, você perderá apenas o twist of fate, então, usando o comando !bless com esse script, você comprará apenas o twist of fate.
     
    Se você não tiver nenhum dos dois, ele comprará todas as blessings por um preço maior, é óbvio.
    O padrão de preço do Script está assim :
    Twist of Fate = 50k
    Todas as 5 blessings = 50k
    Todas as blessings = 100k
     
    Ou seja, se você morrer, ao invés de comprar todas as blessings de novo. você só comprará as que tiverem faltando.
     
    Crie um arquivo: bless.lua e adicione esse conteúdo :
     
    local bless = {1, 2, 3, 4, 5} local five_blessings_price = 50000 -- 50k WITHOUT TWIST OF FATE local twist_of_fate_price = 50000 -- 50k ONLY TWIST OF FATE local all_blessings_price = 100000 -- 100k WITH TWIST OF FATE function onSay(cid, words, param) for i = 1, table.maxn(bless) do if(getPlayerBlessing(cid, bless[i])) and getPlayerPVPBlessing(cid) == true then doPlayerSendCancel(cid, "You already have all blesses.") end if getPlayerBlessing(cid, bless[i]) == FALSE and getPlayerPVPBlessing(cid) == FALSE then if (doPlayerRemoveMoney(cid, all_blessings_price) == TRUE) then for i = 1, table.maxn(bless) do doPlayerAddBlessing(cid, bless[i]) end doPlayerSetPVPBlessing(cid) doCreatureSay(cid, "You has been blessed by Gods with all blessings, including the twist of fate.") doSendMagicEffect(getPlayerPosition(cid), 30) else doPlayerSendCancel(cid, "You don't have 100k to buy the five blessings and twist of fate.") end elseif getPlayerBlessing(cid, bless[i]) == TRUE and getPlayerPVPBlessing(cid) == FALSE then if (doPlayerRemoveMoney(cid, twist_of_fate_price) == TRUE) then doPlayerSetPVPBlessing(cid) doCreatureSay(cid, "You has been blessed with twist of fate. the only bless that you didn't had.") doSendMagicEffect(getPlayerPosition(cid), 30) else doPlayerSendCancel(cid, "You don't have 50k to buy the twist of fate.") end elseif getPlayerBlessing(cid, bless[i]) == FALSE and getPlayerPVPBlessing(cid) == TRUE then if (doPlayerRemoveMoney(cid, five_blessings_price) == TRUE) then for i = 1, table.maxn(bless) do doPlayerAddBlessing(cid, bless[i]) end doCreatureSay(cid, "You has been blessed with the five blessings. Before you had only the twist of fate.") doSendMagicEffect(getPlayerPosition(cid), 30) else doPlayerSendCancel(cid, "You don't have 50k to buy the five blessings.") end end end return true end  
    TAG para você add no talkaction.xml :
    <talkaction log="yes" words="!buybless;/buybless;!bless;/bless" script="bless.lua" />  
    Obrigado, espero que tenham gostado !
  2. Gostei
    Sistema de Loterias por globalevents.
     
    Crie um arquivo .lua com o nome lottery dentro da pasta data/globalevents/scripts/loterry.lua, adicione dentro do arquivo o seguinte code:
    local config = {         lottery_hour = "2 hours", -- Tempo ate a proxima loteria (Esse tempo vai aparecer somente como broadcast message)         rewards_id = {2494, 2472, 2514, 2160}, -- ID dos Itens Sorteados na Loteria         crystal_counts = 10, -- Usado somente se a rewards_id for crystal coin (ID: 2160).         website = "yes", -- Only if you have php scripts and table `lottery` in your database!         days = {                 "Monday-08:00",                 "Monday-13:00",                 "Monday-19:30",                 "Tuesday-08:00",                 "Tuesday-13:00",                 "Tuesday-19:30",                 "Wednesday-08:00",                 "Wednesday-13:00",                 "Wednesday-19:30",                 "Thursday-08:00",                 "Thursday-13:00",                 "Thursday-19:30",                 "Friday-01:22",                 "Friday-13:00",                 "Friday-19:30",                 "Saturday-21:27",                 "Saturday-21:28",                 "Saturday-21:29",                 "Sunday-08:00",                 "Sunday-13:00",                 "Sunday-19:30"                 }         } local function getPlayerWorldId(cid)     if not(isPlayer(cid)) then         return false     end     local pid = getPlayerGUID(cid)     local worldPlayer = 0     local result_plr = db.getResult("SELECT * FROM `players` WHERE `id` = "..pid..";")     if(result_plr:getID() ~= -1) then         worldPlayer = tonumber(result_plr:getDataInt("world_id"))         result_plr:free()         return worldPlayer     end     return false end local function getOnlineParticipants()     local players = {}     for _, pid in pairs(getPlayersOnline()) do         if getPlayerAccess(pid) <= 2 and getPlayerStorageValue(pid, 281821) <= os.time() then             table.insert(players, pid)         end     end     if #players > 0 then         return players     end     return false end       function onThink(cid, interval)     if table.find(config.days, os.date("%A-%H:%M")) then         if(getWorldCreatures(o) <= 0)then             return true         end         local query = db.query or db.executeQuery         local random_item = config.rewards_id[math.random(1, #config.rewards_id)]         local item_name = getItemNameById(random_item)           local data = os.date("%d/%m/%Y - %H:%M:%S")         local online = getOnlineParticipants()                 if online then             local winner = online[math.random(1, #online)]             local world = tonumber(getPlayerWorldId(winner))                         if(random_item == 2160) then                 doPlayerSetStorageValue(winner, 281821, os.time() + 3600 * 24)                 doPlayerAddItem(winner, random_item, config.crystal_counts)                 doBroadcastMessage("[LOTTERY SYSTEM] Winner: " .. getCreatureName(winner) .. ", Reward: " .. config.crystal_counts .." " .. getItemNameById(random_item) .. "s! Congratulations! (Next lottery in " .. config.lottery_hour .. ")")             else                 doPlayerSetStorageValue(winner, 281821, os.time() + 3600 * 24)                 doBroadcastMessage("[LOTTERY SYSTEM] Winner: " .. getCreatureName(winner) .. ", Reward: " ..getItemNameById(random_item) .. "! Congratulations! (Next lottery in " .. config.lottery_hour .. ")")                 doPlayerAddItem(winner, random_item, 1)             end             if(config.website == "yes") then                 query("INSERT INTO `lottery` (`name`, `item`, `world_id`, `item_name`, `date`) VALUES ('".. getCreatureName(winner).."', '".. random_item .."', '".. world .."', '".. item_name .."', '".. data .."');")             end         else             print("Ninguem OnLine pra ganhar na loteria")         end     end     return true end Recomendamos modificar: - rewards_id = {2494, 2472, 2514, 2160}, -- ID dos Itens Sorteados na Loteria Recomendo de item count apenas o 2160, outros podem bugar. - crystal_counts = 10, -- Usado somente se a rewards_id for crystal coin (ID: 2160). Altere pra mais ou menos o dinheiro. - "Monday-08:00", Ajuste os dias e horários como desejado. Em globalevents.xml, adicione:
    <!-- Lottery --> <globalevent name="lottery" interval="60000" event="script" value="lottery.lua"/> Não mexa no code acima.

    Certo, essa é a parte do servidor, agora vamos adicionar as querys necessárias no MySql:
     
    CREATE TABLE `lottery` (    `id` int(11) NOT NULL auto_increment,    `name` varchar(255) NOT NULL,    `item` varchar(255) NOT NULL,    `world_id` tinyint(2) unsigned NOT NULL default '0',    `item_name` varchar(255) NOT NULL,    `date` varchar(256) NOT NULL,    PRIMARY KEY  (`id`)  ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1; Caso você queria adicionar uma query pra testar o site, veja:
    INSERT INTO `lottery` (`id`, `name`, `item`, `world_id`, `item_name`, `date`) VALUES(NULL, 'Character', '2470', '0', 'golden legs', '22/05/2014 - 04:49:50'); Agora vamos pra parte do site, crie um arquivo .php com o nome lottery, adicione dentro do arquivo o seguinte code:
    <?PHP  $main_content .= '<center><h1>Lottery</h1><h3>Lotterys held at 09:00, 14:00 and 20:30 hour, brazil time.</h3></center><br><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><tr BGCOLOR="'.$config['site']['vdarkborder'].'"><td CLASS=white><center><b>Player Name</b></center></td><td CLASS=white width=184 colspan=2><center><b>Winning Item</b></center></td><td width=50 CLASS=white><center><b>World</b></center></td><td width=100 CLASS=white><center><b>Date and Time</b></center></td></tr>';  $lottery = $SQL->query('SELECT id, name, item, world_id, item_name, date FROM lottery WHERE world_id = 0 ORDER BY id DESC;'); foreach($lottery as $result) {   $players++;              if(is_int($players / 2))                  $bgcolor = $config['site']['lightborder'];              else                  $bgcolor = $config['site']['darkborder'];  $main_content .= '<TR BGCOLOR='.$bgcolor.'><TD WIDTH=35%><center><a href="?subtopic=characters&name='.urlencode($result['name']).'">'.$result['name'].'</a></center></td><TD WIDTH=5%><img src=\'/item_images/'.urlencode($result['item']).'.gif\'></td><TD WIDTH=30%><center>'.$result['item_name'].'</center></td><TD WIDTH=7%><center>MegaTibia</center></td></td><TD WIDTH=30%><center>'.$result['date'].'</center></td></tr>';  }  $main_content .= '</table>';  ?> Em index.php adicione:
    case "lottery";    $topic = "Lottery";    $subtopic = "lottery";    include("lottery.php"); break; Em layouts.php adicione o code abaixo:
                    <a href="?subtopic=lottery">                         <div id="submenu_lottery" 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_lottery" class="ActiveSubmenuItemIcon" style="background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);"></div>                                 <div id="ActiveSubmenuItemLabel_lottery" class="SubmenuitemLabel">Lottery</div>                                 <div class="RightChain" style="background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);"></div>                         </div>                 </a> Pronto galera só isso, não esqueça clica em GOSTEI! Comente, participe do tópico, isso nos ajuda muito. 


     
    Créditos:
    .lua - Killua e Matheus
    .php - Matheus e Natanael Beckman
    querys - Natanael Beckman e Matheus
    Atualização 24/05/2014 - Adicionado regras pra não sorteá membro da staff(GM, GOD) - Adicionando sistema de Storage pra não correr o risco de um player ganhar 2x no mesmo dia.

Informação Importante

Confirmação de Termo