Ir para conteúdo

adm oliveira

Membro
  • Registro em

  • Última visita

Histórico de Curtidas

  1. Gostei
    adm oliveira deu reputação a Snowsz em Anti Trash pra tfs 0.4   
    Amigo, tens de informar a versão do servidor, sempre!
  2. Gostei
    adm oliveira deu reputação a vankk em Cast não funfa no site   
    Não tenho ideia de quais seriam as estruturas para criar a tabela reports. Enfim, tenta isso.
     
    CREATE TABLE `reports` ( `id` INT NOT NULL AUTO_INCREMENT, `world_id` TINYINT(4) UNSIGNED NOT NULL DEFAULT 0, `player_id` INT NOT NULL DEFAULT 1, `posx` INT NOT NULL DEFAULT 0, `posy` INT NOT NULL DEFAULT 0, `posz` INT NOT NULL DEFAULT 0, `timestamp` BIGINT NOT NULL DEFAULT 0, `report` TEXT NOT NULL, `reads` INT NOT NULL DEFAULT 0, PRIMARY KEY (`id`), KEY (`world_id`), KEY (`reads`), FOREIGN KEY (`player_id`) REFERENCES `players`(`id`) ON DELETE CASCADE ) ENGINE = InnoDB;  
  3. Gostei
    adm oliveira deu reputação a L3K0T em Final do evento WoE   
    envie os arquivos por spoiler e as tags
  4. Gostei
    adm oliveira deu reputação a ViitinG em (Resolvido)[Pedido] tile   
    Caso não esteja conseguindo com o meu eu vou explicar como configurar :
    function onStepIn(cid, item, pos) if isPlayer(cid) == TRUE then if (item.actionid == 4036) then doPlayerSendTextMessage(cid,24,"Now you are citizen of CITY.") doPlayerSetTown(cid,13) elseif (item.actionid == 4037) then doPlayerSendTextMessage(cid,24,"Now you are citizen of CITY.") doPlayerSetTown(cid,4) elseif (item.actionid == 4038) then doPlayerSendTextMessage(cid,24,"Now you are citizen of CITY.") doPlayerSetTown(cid,5) end end end
  5. Gostei
    adm oliveira deu reputação a Skydangerous em [Pedido] Item que teleporta   
    function onUse(cid, item, frompos, item2, topos) pos = {x=***, y=***, z=*} doTeleportThing(cid, pos) doPlayerSendTextMessage(cid,22,"Mensagem que irá dizer.") doRemoveItem(item.uid, 1) end return TRUE end


    <action itemid="id do item" script="nome do arquivo.lua"/>


    Test ai , tenho que ir pra aula até !
  6. 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.
  7. Gostei
    adm oliveira deu reputação a ViitinG em [talkactions] Adicionar item para todos players online   
    Para quem não sabe como funciona o script é o seguinte o ADM pode usar o comando para adicionar um item para todos os players online no servidor.
     
    • Adicionando o script •
     
    Em "data/talkactions/talkactions.xml" adicione está tag :
    <talkaction log="yes" words="/additem" access="5" event="script" value="additem.lua"/> Em "data/talkactions/scripts" crie um arquivo lua com o nome "additem" e adicione este script nele :
    function onSay(cid, words, param, channel) local t = string.explode(param, ",") if t[1] ~= nil and t[2] ~= nil then local list = {} for i, tid in ipairs(getPlayersOnline()) do list[i] = tid end for i = 1, #list do doPlayerAddItem(list[i],t[1],t[2]) doBroadcastMessage(getPlayerName(cid) .. " Acabou de dar: " .. t[2] .." ".. getItemNameById(t[1]) .. " para todos os players online!") end else doPlayerPopupFYI(cid, "No parm...\nSend:\n /itemadd itemid,how_much_items\nexample:\n /itemadd 2160,10") end return true end • Configurando •
     
     
  8. Gostei
    adm oliveira deu reputação a WarW0lf em Ganhar X Item em X Level   
    Em creaturescripts/scripts crie recompensa.lua e coloque:



    Em login.lua:



    E em creaturescript.xml:

  9. Gostei
    adm oliveira deu reputação a Skydangerous em [CreatureEvent] Level up = Ful Mana e Full Health   
    Script: Level up = Ful Mana e Full Health
    Função: Ao evoluir sua vida e mana regenera no máximo
    Testado: Versão 8.6



    INSTALANDO
    vá na pasta creaturescript/scripts e cria um arquivo no formato .lua com o nome de fullmh
    e cole isto:



    function onAdvance(cid, skill, oldlevel, newlevel) if skill == SKILL__LEVEL then doCreatureAddHealth(cid, getCreatureMaxHealth(cid)) doCreatureAddMana(cid, getCreatureMaxMana(cid)) end return TRUE end em seguida, em login.lua adicione o evento registerCreatureEvent(cid, "fullmh") depois em creaturescript.xml adicione a tag: <event type="advance" name="fullmh" event="script" value="fullmh.lua"/>



    Script Exclusivo Tibia King

  10. Gostei
    adm oliveira deu reputação a Tibia2015br em area vip   
    ai gente estou mostrando como criar uma area vip onde so pleyers vip pode pasar
     
     
     
    Em movemments.xml adicione:
     
    <movevent type="StepIn" actionid="9999" event="script" value="premium tile.lua"/>
     
    Agora em movemments -> scripts  criem um arquivo lua chamado premium tile.lua: e cole isso
     
    function onStepIn(cid, item, position, fromPosition)
     
    local Denied = "Voce nao é Premium" -- mensagem que deseja que aparece quando não for premiun
    local Welcome = "Bem vindo a uma area Premium."
     
     
    if isPremium(cid) == false then
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, Denied)
    doTeleportThing(cid, fromPosition, true)
    doSendMagicEffect(position,13)
    return TRUE
    end
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, Welcome)
    doSendMagicEffect(position,14)
    return TRUE
    end
     
     
    AS DUAS MSM EM VERDE VC PODE EDITAR A PRIMEIRA
     
    ocal Denied = "Voce nao é Premium"  É A MSM Q VAI APARECER SE O PLAYER NÃO FOR PREMIUM
     
    local Welcome = "Bem vindo a uma area Premium." É A MSM Q VAI APARECER SE O PLAYER FOR PREMIUN
  11. Gostei
    adm oliveira deu reputação a TsplayerT em Afk System!   
    ALO, COM QUEM EU FALO?
    ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
    INTRODUÇÃO
     
        Galera, nesse topico estarei ensinando um projeto meu de Afk System, que foi esqueçido.
    Esse sistema é bem basico e simples, porém é legal, util e interresante...
    Só avisando... Ele é totalmente configuravel xD
    Então vamos la...
    ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
    COMO FUNCIONA
     
      
       O jogador digitará um comando e fica saindo automaticamente umas mensagens em cima dele, também apareçerá uma mensagem de o jogador estará ausente, e apareçerá tambem uma janela dissendo que se o jogador se mover será cancelado o  sistema.
        NÃO INTENDEU? VEJA COM SEUS PROPRIOS OLHOS.

    ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
    ENSINANDO
     
       Crie um arquivo chamado "Afk" em tipo ".lua" em: data\talkactions\scripts
     
    e coloca essas configurações dentro do arquivo criado:


     
    Após fazer isso abra o arquivo "TalkActions" do tipo ".xml". Localizado em: data\talkactions
     
    E coloque essa linha no aquivo:



     
    ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
    CONFIGURANDO
     
    ESSAS CONFIGURAÇÕES SÃO PARA TROCAR AS MENSAGENS.
     
         Onde está escrito em VERMELHO, é onde fica as mensagem que fica em cima do Jogador.
    Obs¹: Caso queira mensagem diferentes, digite-as entre aspas e separadas por virgula
    Obs²: Essas mensagens ficam repetindo sequencialmente.
     
         O número escrito em AZUL, é o tempo em segundos que a mensagem apareçerá (Intervalo)
     
         Em AMARELO, é a mensagem que apareçerá em vermelho, essa mensagem é como se fosse porque o jogador está ausente(Configurado somente no arquivo, não pelo jogador)
     
         O CINZA ESCURO, é a mensagem que apereçerá na janela, para alertar o jogador que se ele se mover ele para de mandar essas mensagens.
    ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
    AJUDEI? GOSTOU? FOI BOM? ESTÁ EXPLICATIVO? ESTÁ ORGANIZADO? DA REP+ afinal, não explode o Dedo..
    ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
  12. Gostei
    adm oliveira deu reputação a Adriano SwaTT em [NPC] Bank (Igual Tibia Global)   
    Procurei aqui pelo forum, e não achei um NPC de Bank que fosse tão perfeito como este que estou postando...
    Eu mesmo havia postado há alguns dias atrás um NPC de Bank, mas não é tão bom quanto este...

    Detalhes do NPC:
    Executa as funções como do Tibia Global.
    Deposit, Transfer, Withdraw, Change Gold, Change Platinum, Change Crystal...

    Funcionando perfeitamente...
    #Testado'

    Vamos ao que interessa.

    Crie um arquivo chamado "bank.xml" na pasta "data / npc"... Cole o código abaixo dentro do arquivo:
    <?xml version="1.0" encoding="UTF-8"?> <npc name="BankMan" script="data/npc/scripts/bank.lua" walkinterval="25" floorchange="0" access="5" > <health now="150" max="150"/> <look type="132" head="115" body="0" legs="114" feet="0" addons="3" corpse="2212"/> <parameters> <parameter key="message_greet" value="Welcome |PLAYERNAME|! Here, you can {deposit}, {withdraw} or {transfer} your money from your bank account. I can change your coins too."/> <parameter key="message_alreadyfocused" value="You are drunked ? I talk with you."/> <parameter key="message_farewell" value="Goodbye. I wanna see your money... oh you again."/> </parameters> </npc> Salve e feche o arquivo.

    Agora vá na pasta Scripts e crie um arquivo chamado "bank.lua" e cole o código abaixo dentro do mesmo:
     
    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 --------------------MESSAGES------------------------------------------------------------------------------ if msgcontains(msg, 'deposit') then selfSay('Please tell me how much gold it is you would like to deposit.', cid) talkState[talkUser] = 1 elseif msgcontains(msg, 'withdraw') then selfSay('Please tell me how much gold you would like to withdraw.', cid) talkState[talkUser] = 3 elseif msgcontains(msg, 'transfer') then selfSay('Please tell me the amount of gold coins you would like to transfer.', cid) talkState[talkUser] = 5 elseif msgcontains(msg, 'change gold') then selfSay('How many platinum coins do you want to get?', cid) talkState[talkUser] = 8 elseif msgcontains(msg, 'change platinum') then selfSay('Do you want to change your platinum coins to gold or crystal?', cid) talkState[talkUser] = 10 elseif msgcontains(msg, 'change crystal') then selfSay('How many crystal coins do you want to change to platinum?', cid) talkState[talkUser] = 15 elseif msgcontains(msg, 'balance') then n = getPlayerBalance(cid) selfSay('Your balance are '..n..' golds.', cid) talkState[talkUser] = 0 ----------------------DEPOSIT------------------------------------------------------- elseif talkState[talkUser] == 1 then if msgcontains(msg, 'all') then n = getPlayerMoney(cid) selfSay('Do you want deposit '..n..' golds ?', cid) talkState[talkUser] = 2 else n = getNumber(msg) selfSay('Do you want deposit '..n..' golds ?', cid) talkState[talkUser] = 2 end elseif talkState[talkUser] == 2 then if msgcontains(msg, 'yes') then if getPlayerMoney(cid) >= n then doPlayerDepositMoney(cid,n) selfSay('Sucessfull. Now your balance account is ' ..getPlayerBalance(cid)..' golds.', cid) talkState[talkUser] = 0 else selfSay('You don\'t have money.', cid) end else selfSay('Ok then', cid) end ----------------------WITHDRAW------------------------------------------------------------------------------------- elseif talkState[talkUser] == 3 then if msgcontains(msg, 'all') then n = getPlayerBalance(cid) selfSay('Do you want withdraw '..n..' golds ?', cid) talkState[talkUser] = 4 else n = getNumber(msg) selfSay('Do you want withdraw '..n..' golds ?', cid) talkState[talkUser] = 4 end elseif talkState[talkUser] == 4 then if msgcontains(msg, 'yes') then if getPlayerBalance(cid) >= n then doPlayerWithdrawMoney(cid, n) selfSay('Here you are, '..n..' gold. Now your balance account is ' ..getPlayerBalance(cid)..' golds.', cid) talkState[talkUser] = 0 else selfSay('There is not enough gold on your account', cid) end else selfSay('Ok then', cid) end ----------------------TRANSFER---------------------------------------------------------------------------------------- elseif talkState[talkUser] == 5 then if msgcontains(msg, 'all') then n = getPlayerBalance(cid) selfSay('Who would you like transfer '..n..' gold to?', cid) talkState[talkUser] = 6 else n = getNumber(msg) selfSay('Who would you like transfer '..n..' gold to?', cid) talkState[talkUser] = 6 end elseif talkState[talkUser] == 6 then p = msg selfSay('So you would like to transfer '..n..' gold to '..p..'?', cid) talkState[talkUser] = 7 elseif talkState[talkUser] == 7 then if msgcontains(msg, 'yes') then if getPlayerBalance(cid) >= n then if doPlayerTransferMoneyTo(cid, p, n) == TRUE then selfSay('You have transferred '..n..' gold to '..p..' and your account balance is '..getPlayerBalance(cid)..' golds.', cid) talkState[talkUser] = 0 else selfSay('This player does not exist. Please tell me a valid name!', cid) talkState[talkUser] = 0 end else selfSay('There is not enough gold on your account', cid) talkState[talkUser] = 0 end else selfSay('Ok then', cid) talkState[talkUser] = 0 end ----------------------CHANGE GOLD--------------------------------------------------------------------------------- elseif talkState[talkUser] == 8 then n = getNumber(msg) b = n * 100 selfSay('So I should change '..b..' of your gold coins to '..n..' platinum coins for you?', cid) talkState[talkUser] = 9 elseif talkState[talkUser] == 9 then if msgcontains(msg, 'yes') then if doPlayerRemoveItem(cid, 2148, b) == TRUE then doPlayerAddItem(cid, 2152, n) talkState[talkUser] = 0 else selfSay('You don\'t have money.', cid) talkState[talkUser] = 0 end else selfSay('Ok. We cancel.', cid) talkState[talkUser] = 0 end ---------------------CHANGE PLATINUM------------------------------------------------------------------------- elseif talkState[talkUser] == 10 then if msgcontains(msg, 'gold') then selfSay('How many platinum coins do you want to change to gold?', cid) talkState[talkUser] = 11 elseif msgcontains(msg, 'crystal') then selfSay('How many crystal coins do you want to get?', cid) talkState[talkUser] = 13 end elseif talkState[talkUser] == 11 then n = getNumber(msg) b = n * 100 selfSay('So I should change '..n..' of your platinum coins to '..b..' gold coins for you?', cid) talkState[talkUser] = 12 elseif talkState[talkUser] == 12 then if msgcontains(msg, 'yes') then if doPlayerRemoveItem(cid, 2152, n) == TRUE then doPlayerAddItem(cid, 2148, b) talkState[talkUser] = 0 else selfSay('You don\'t have money.', cid) talkState[talkUser] = 0 end else selfSay('Ok. We cancel.', cid) talkState[talkUser] = 0 end elseif talkState[talkUser] == 13 then n = getNumber(msg) b = n * 100 selfSay('So I should change '..b..' of your platinum coins to '..n..' crystal coins for you?', cid) talkState[talkUser] = 14 elseif talkState[talkUser] == 14 then if msgcontains(msg, 'yes') then if doPlayerRemoveItem(cid, 2152, b) == TRUE then doPlayerAddItem(cid, 2160, n) talkState[talkUser] = 0 else selfSay('You don\'t have money.', cid) talkState[talkUser] = 0 end else selfSay('Ok. We cancel.', cid) talkState[talkUser] = 0 end ---------------------CHANGE CRYSTAL------------------------------------------------------------------------------- elseif talkState[talkUser] == 15 then n = getNumber(msg) b = n * 100 selfSay('So I should change '..n..' of your crystal coins to '..b..' platinum coins for you?', cid) talkState[talkUser] = 16 elseif talkState[talkUser] == 16 then if msgcontains(msg, 'yes') then if doPlayerRemoveItem(cid, 2160, n) == TRUE then doPlayerAddItem(cid, 2152, b) talkState[talkUser] = 0 else selfSay('You don\'t have money.', cid) talkState[talkUser] = 0 end else selfSay('Ok. We cancel.', cid) talkState[talkUser] = 0 end end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) -- function maded by Gesior-- function getNumber(txt) --return number if its number and is > 0, else return 0 x = string.gsub(txt,"%a","") x = tonumber(x) if x ~= nill and x > 0 then return x else return 0 end end  
     
     

    Salve o arquivo e feche-o.

    Agora seu NPC está pronto, basta adicioná-lo ao seu mapa usando o Map Editor.
    Espero que seja de utilidade de alguém...

    Créditos: Tibiaa4e (outro forum)
    Pequeno Tuto: Adriano Swatt
     
    Testado em:
    Versões do Client: 8.54 e 8.60.
    Versões da Distro: TFS 3.4.5, TFS 0.4 e Alissow 0.4.1.

    Espero que seja útil.


    Abraços'
  13. Gostei
    Nome: Experiencia para Guild Função: A pedidos de um membro do forum (TioSlash). Aqui está um script que ira adicionar uma porcentagem de Experiência por jogadores online. Exemplo: Ao alcançar 5  jogadores da Guild Online, todos que estiverem online recebem 2% de xp adicional por jogador. Ou seja, um total de +10% de xp. Bom para servidores com bastante RPG, incentivando a cooperação.  
    Atualizações: Dia 17/08/2014  
    Versão: Testada somente na "10.31". (OTX Server - Galaxy) Créditos:  Kazuza - (eu) Por ter criado.
    TioSlash - Pela Ideia.
    Vodkart - Por ter achado a função dele que retorna os jogadores da Guild ( sem ela com meu nivel de script não teria conseguido).
    xWhiteWolf - Por uma ajudinha.
     
     
    "Pasta Servidor > Data > Creaturescripts > Scripts" crie "ExpGuild.lua".
    function getGuildMembersOnline(GuildId) local players,query = {},db.getResult("SELECT `name` FROM `players` WHERE `rank_id` IN (SELECT `id` FROM `guild_ranks` WHERE `guild_id` = " .. GuildId .. ");") if (query:getID() ~= -1) then repeat table.insert(players,query:getDataString("name")) until not query:next() query:free() end return #players > 0 and players or false end function onLogin(cid) local guild_id = getPlayerGuildId(cid) local minimo = 2 local max = 2 local porcentagem = 2 ----------------------------------------- doPlayerSetExperienceRate(cid, 1) if guild_id == 0 then addEvent(doPlayerSendTextMessage, 200,cid, MESSAGE_STATUS_CONSOLE_RED,"[GUILD] Entre em uma guild para ter bonus de experiencia.") return true end if guild_id > 0 then local membros_online = table.maxn(getGuildMembersOnline(guild_id)) local tabela_membros = getGuildMembersOnline(guild_id) --if #getPlayersByIp(getPlayerIp(cid)) >= max then --doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED,"[GUILD] Players com Multi-Cliente nao contam para ganhar o bonus de experiencia.") --return true --end if membros_online <= minimo then addEvent(doPlayerSendTextMessage, 2000, cid, MESSAGE_STATUS_CONSOLE_RED,"[GUILD] Para ter bonus de experiencia precisa ter mais de "..minimo.." jogadores da guild online.\n Jogadores da Guild Online ["..membros_online.."]") return true end if membros_online > minimo then for var = 1, #tabela_membros do local nomes = getCreatureByName(tabela_membros[var]) local XP = ((membros_online*porcentagem) / 100) + 1.00 doPlayerSetExperienceRate(nomes, XP) addEvent(doPlayerSendTextMessage,1000,nomes, MESSAGE_STATUS_CONSOLE_RED, "[GUILD] A experiencia dos membros da guilda foi aumentada para +"..membros_online*porcentagem.."% - Membro "..getCreatureName(cid).." logou.") end return true end end end "Pasta Servidor > Data > Creaturescripts > Scripts" crie "ExpGuild_out.lua".
    function getGuildMembersOnline(GuildId) local players = {} for _, pid in pairs(getPlayersOnline()) do if getPlayerGuildId(pid) == tonumber(GuildId) then table.insert(players, getPlayerName(pid)) end end return #players > 0 and players or false end function onLogout(cid) if getPlayerGuildId(cid) == 0 then return true else local guild_id = getPlayerGuildId(cid) local membros_online = table.maxn(getGuildMembersOnline(guild_id)) local tabela_membros = getGuildMembersOnline(guild_id) local porcentagem = 2 local minimo = 2 ----------------------------------------- for var = 1, #tabela_membros do local nomes = getCreatureByName(tabela_membros[var]) local membros_online = membros_online - 1 if membros_online <= minimo then doPlayerSetExperienceRate(nomes, 1.0) doPlayerSendTextMessage(nomes, MESSAGE_STATUS_CONSOLE_RED,"[GUILD] Nao tem mais o numero de players necessarios para ganhar o bonus de experiencia - Membro "..getCreatureName(cid).." deslogou.") end if membros_online > minimo then local XP = ((membros_online*porcentagem) / 100) + 1.00 doPlayerSetExperienceRate(nomes, XP) doPlayerSendTextMessage(nomes, MESSAGE_STATUS_CONSOLE_RED, "[GUILD] A experiencia dos membros da guilda foi ajustada para "..membros_online*porcentagem.."% - Membro "..getCreatureName(cid).." deslogou.") end end return true end end   "Pasta Servidor > Data > Creaturescripts" em creaturescripts.xml adicione:
    <event type="login" name="ExpGuild" event="script" value="exp_guild.lua"/> <event type="logout" name="ExpGuild_out" event="script" value="exp_guild_out.lua"/> "Pasta Servidor > Data > Creaturescripts > Scripts" em login.lua adicione:
    Lá em baixo, onde tem registerCreatureEvent ponha esses dois:
    registerCreatureEvent(cid, "ExpGuild") registerCreatureEvent(cid, "ExpGuild_out")  
     
    PS: Qualquer erro, postem. É muito importante. Como este é meu segundo script na vida. Pode ser que aconteça de dar erros. Eu testei pouco.
  14. Gostei
    adm oliveira deu reputação a Wakon em [TFS 0.4/0.3.6] Aviso de bless ao sair da zona de proteção.   
    Fiz esse script a bastante tempo a pedido de um membro e resolvi postar para vocês .
     
    Versão testada: 8.60
    TFS: 0.4 / 0.3.6
    Função: Ao sair de uma zona de proteção, caso o player esteja sem bless, ele manda uma mensagem na tela avisando que está sem bless.
     
    Em "Data/creaturescripts/scripts", copie e cole um arquivo.LUA e renomeie para checkBless.lua, apague tudo e cole:
    function onThink(cid, lastExecution, thinkInterval) if(getTilePzInfo(getCreaturePosition(cid))) == false and getPlayerStorageValue(cid, 23333) <= 0 then for b = 1,5 do if getPlayerBlessing(cid, b) == false then setPlayerStorageValue(cid, 23333, 1) return doPlayerSendTextMessage(cid, 22, "Você não tem todas as bless, tome cuidado.") end end elseif (getTilePzInfo(getCreaturePosition(cid))) == true and getPlayerStorageValue(cid, 23333) == 1 then setPlayerStorageValue(cid, 23333, -1) end return true end Em "Data/creaturescripts", abra o creaturescripts.xml e adicione:
    <event type="think" name="checkBless" event="script" value="checkBless.lua"/> Novamente em "Data/creaturescripts/scripts", abra o arquivo login.lua e adicione:
    registerCreatureEvent(cid, "checkBless") Espero que gostem , caso dê algum erro, me avise!
      Créditos: Wakon - Script ScythePanthom -- Pela idéia.

Informação Importante

Confirmação de Termo