Ir para conteúdo

Vodkart

Herói
  • Total de itens

    3406
  • Registro em

  • Última visita

  • Dias Ganhos

    111

Posts postados por Vodkart

  1. Uma função inútil que retorna o último sábado do mês...

     

     

    function getLastSaturday(mes, ano)
        local date ={day=31, month= mes, year=ano}
        local saturday =os.date("*t",os.time(date)).wday
        return 31-(saturday%7)
    end

    exemplo de uso:

    print(getLastSaturday(8, 2015)) -- 29
    print(getLastSaturday(9, 2015)) -- 26
    print(getLastSaturday(10, 2015)) -- 31
    print(getLastSaturday(11, 2015)) -- 28
    print(getLastSaturday(12, 2015)) -- 26
    print(getLastSaturday(12, 2016)) -- 31

     

     

     

  2. Serve só para colocar pontos em números grandes.
    function getMilharNumber(number)
    local vod, kar, t = string.match(number,'^([^%d]*%d)(%d*)(.-)$')
    return vod..(kar:reverse():gsub('(%d%d%d)', '%1.'):reverse())..t
    end

    print(getMilharNumber(10)) -- 10
    print(getMilharNumber(100)) -- 100
    print(getMilharNumber(1000)) -- 1.000
    print(getMilharNumber(10000)) -- 10.000
    print(getMilharNumber(100000)) -- 100.000
    print(getMilharNumber(1000000)) -- 1.000.000
    print(getMilharNumber(10000000)) -- 10.000.000
    print(getMilharNumber(100000000)) -- 100.000.000

     

     

  3. @DeCarvalho


    É bem simples de adc, vc já tem a função que adc vip? só precisa de umas 3 linhas no máximo...


    @Fawz


    Por isso o sistema é TOTALMENTE editável.


    Você pode editar os level que recebeção premios e quantos pontos precisa para receber premiações.


    A dificuldade é sua.


    Eu posso colocar por exemplo:


    A primeira premiação só receba com 100 pontos


    e como conseguir 100 pontos?


    eu edito na lib dizendo que quando o jogador atingir level 50(exemplo) só receba 5 pontos, nossa, até eu atingir 100 pontos terei que chamar muito jogador...

    ficando díficil.


    ai o jogador atingi level 100, ai eu recebo mais 6 pontos, e então vai acumulando, por isso fiz uma tabela para colocar varios pontos como premiação:


    rewards = {
    [10] = {items = {{2160,1},{2173,1}}, p_days = 0, mount_id = 0, p_points = 0 , out = {0,0}},
    [25] = {items = {{2160,2},{2173,1}}, p_days = 0, mount_id = 0, p_points = 0 , out = {0,0}},
    [50] = {items = {{2160,3},{2173,1}}, p_days = 0, mount_id = 0, p_points = 0 , out = {0,0}},
    [100] = {items = {{2160,4},{2173,1}}, p_days = 0, mount_id = 0, p_points = 0 , out = {0,0}},
    [200] = {items = {{2160,5},{2173,1}}, p_days = 0, mount_id = 0, p_points = 0 , out = {0,0}},
    [250] = {items = {{2160,6},{2173,1}}, p_days = 0, mount_id = 0, p_points = 0 , out = {698, 699}},
    [500] = {items = {{2160,7},{2173,1}}, p_days = 0, mount_id = 0, p_points = 0 , out = {0,0}}
    }


    e digo isso porque esse sistema é para servidor LOW RATES, que a dificuldade de pegar level é demorada.


    imagina eu ter que conseguir 200 pontos? ou até os 500?


    por isso devo chamar mais jogadores, para que isso fique mais fácil.

    e para não bular, eu só recebo pontos se esses mesmo jogadores UPAREM no servidor.

    se não seria muito fácil criar contas, usar o comando e ganhar pontos...


  4. 2// Desculpe a ignorancia.. joão precisa ter level 50 para ganhar os premios?

    Se ele for level 30 e a maria no level 10 falar !invited joao e chegar no level 50 ganhando assim para o joão 5 pontos.. e então? se ele não tiver level 50.. para onde vão esses pontos?



    Não, O sistema nesse caso está configurado da seguinte maneira:


    João precisa ser no MINIMO level 50 para que maria usa o comando !invited JOÃO.


    se o joão for level 49, ela não vai conseguir nada.


    Lembrando que maria só pode usar o comando até LEVEL 30.


    Porque disso? para que jogadores não possam criar várias contas e ficar upando só para pegar points.




    3// MUST READ Um detalhe.. faça o script para que todos possam usar, não somente joão e maria



    obs: UM ou mais jogador pode invitar o mesmo PLAYER!


    digamos:


    MARIA, JULIA, ISABELA, DENIVALDO, ETC... ESSES TODOS PODEM USAR O COMANDO PARA INVITAR O MESMO JOGADOR. !INVITED JOÃO


    QUANTO MAIS O JOGADOR CHAMAR, MELHOR!



    P.s// Não sei se é pedir muito mas poderia editar para ser possível receber vipDays também como recompensa? achei meio complicado fazer sozinho e com medo de gerar erro :) então acho que voê por ter feito conseguiria fazer isso de forma funcional e prática..




    Até poderia fazer, mas teria que adptar paea vários sistemas vip e isso é chato

  5. Resumo: Para quem já jogou league of legends, o sistema é "parecido" com o Invite Friends, e para quem não jogou irei dar uma breve descrição sobre o sistema.

     

    Descrição: O sistema oferece algumas premiações como: Itens, Premium Days, Montarias, Premium Points(para site) e Outfits. Claro que isso tudo é configurável.

    A ideia principal do sistema foi que essas premiações fossem exclusivas do sistema, digamos, que os jogadores só fossem recompensados e tivessem certas montarias/outfits se ele atingisse num número "X" de pontos por ter ajudado seu servidor a crescer!

    Como todo mundo almeja algo exclusivo e difícil de ser obtido, iria instigar os jogadores a usar o sistema e convidar seus amigos para o servidor!

     

    Como Funciona o Sistema?

     

    O sistema foi planejado para que jogadores "espertinhos" não burlassem o sistema e acontece da seguinte maneira:

     

    Temos o jogador João e a jogadora Maria:

     

    Maria necessita ser level 30 ou menor que 30(Configurável) para utilizar uma talkactions e dizer por quem foi invitada para o servidor, vamos supor que João a convidou Maria para jogar, João por sua vez necessita também ter um level avançado, digamos 50 ou superior(Configurável). Feito com sucesso o uso do sistema, ele funciona da seguinte maneira:

    OBS: Você pode dizer o nome do jogador mesmo que ele esteja OFFLINE! :)

     

    OBS2: Um ou mais Players podem ser invitador pelo MESMO JOGADOR! ENTÃO QUANTO MAIS PLAYER VOCÊ CHAMAR, MAIS FÁCIL DE RECEBER PONTOS E PREMIAÇÕES

     

    O jogador invitado, no caso o João, teria que atingir um número "X" de pontos para receber premiações, por exemplo:

     

    * Com 10 Pontos jogão recebe: Itens

    * Com 25 Pontos jogão recebe: Itens e Premium Points

    * Com 50 Pontos jogão recebe: Itens e Montaria

    * Com 100 Pontos jogão recebe: Itens, Premium Points, Premium Days e Outifit

    (Claro que isso é tudo configurável em uma Tabela)

     

    E como recebo Recebo esses Pontos VODKART SEU FILHO DA PUTA!

     

    Se lembra que João Convidou Maria para Jogar? Então... Maria tem que atingir certos leveis para que João receba esses pontos! Por exemplo a tabela do sistema:

    levels_win = {
    [50] = 5,
    [80] = 6,
    [100] = 8,
    [150] = 10
    },
    Se Maria atingir level 50, João recebe 5 pontos
    Se Maria atingir level 80, João recebe 6 pontos
    Etc... Claro que isso tudo é acumulativo!
    E sabe o que mais? João recebe Pontos mesmo se estiver ONLINE ou OFFLINE!
    Sem mais delongas, Vamos instalar o sistema!
    Instalando o Sistema:
    data\creaturescripts\scripts
    InviteFriends.lua
    function onLogin(player)
    player:registerEvent("FriendsPoints")
    if player:getStorageValue(_invite_friends.storages[1]) < 0 then
    player:setStorageValue(_invite_friends.storages[1], 0) 
    player:setStorageValue(_invite_friends.storages[4], 0)
    end
    if getInvitePoints(player) > 0 then
    local acc = player:getAccountId()
    local FriendPoints, CheckPoints = getInvitePoints(player), player:getStorageValue(_invite_friends.storages[4])
    for vod, ka in pairs(_invite_friends.rewards) do
    local str = ""
    if FriendPoints >= vod and CheckPoints < vod then
    str = str.."--> Invite Players System <--\n\nVocê acaba de receber algumas recompensas:\n\nItems: \n"..getItemsFromList(ka.items)..".\n\n"
    if ka.p_days > 0 then 
    player:addPremiumDays(ka.p_days) 
    str = str.."Premium Days:\n"..ka.p_days.." Premium Days." 
    end
    if ka.p_points > 0 then 
    db.executeQuery('UPDATE accounts SET premium_points=premium_points+' .. p_points ..' WHERE id=' .. acc)
    str = str.."Premium Points:\n"..ka.p_points.." Premium Points."
    end
    if ka.out[1] > 0 then 
    player:addOutfitAddon(player:getSex() == PLAYERSEX_FEMALE and ka.out[1] or ka.out[2], 3) 
    str = str.."[New Outfit]\nRecebeu uma Nova Outfit."
    end
    if ka.mount_id > 0 then 
    player:addMount(ka.mount_id) 
    str = str.."[New Outfit]\nRecebeu uma Nova Montaria."
    end
    player:setStorageValue(_invite_friends.storages[4], FriendPoints)
    local town_id = player:getTown():getId()
    if #ka.items > 0 then
    local parcel = player:getDepotChest(town_id, true):addItem(2595)
    for _, i_i in ipairs(ka.items) do
    local item, amount = i_i[1],i_i[2]
    if isItemStackable(item) or amount == 1 then
    parcel:addItem(item, amount)
    else
    for i = 1, amount do
    parcel:addItem(item, 1)
    end
    end
    end
    end
    local townid = player:getTown():getId()
    local letter = player:getDepotChest(town_id, true):addItem(2598, 1, true, 1)
    letter:setAttribute(ITEM_ATTRIBUTE_WRITER, "[+] Invite Players System [+]")
    letter:setAttribute(ITEM_ATTRIBUTE_TEXT, str)
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE,"[Invite Players System] Você Recebeu algumas premiações por estar convidando jogadores para o servidor, Por favor conferir os itens no Depot.")
    end
    end 
    end
    return true
    end
    function onAdvance(player, skill, oldlevel, newlevel)
    if (skill == SKILL__LEVEL) then
    if hasInviteFriend(player) and player:getStorageValue(_invite_friends.storages[3]) < newLevel and _invite_friends.levels_win[newLevel] then
    local f_name, points = getNameFriend(player), _invite_friends.levels_win[newLevel]
    player:setStorageValue(_invite_friends.storages[3], newLevel)
    addInvitePoints(f_name, points)
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "[Invite Friends] você atingiu o level "..newLevel.." e o seu amigou "..f_name.." recebeu "..points.." Friend Points. Obrigado!")
    end
    end
    return true
    end
    creaturescripts.xml
    <event type="advance" name="FriendsPoints" script="InviteFriends.lua"/>
    <event type="login" name="FriendsLogin" script="InviteFriends.lua"/>
    data\lib\core
    invitefriends.lua
    _invite_friends = {
    storages = {202301, 202302, 202303, 202304}, -- points, jogador, recompensa lvl, recompensa items
    level_max = 30, -- até que level ele precisa falar seu friend
    level_need = 50, -- que lever o jogador precisa ser para ganhar pontos
    levels_win = {
    [50] = 5,
    [80] = 6,
    [100] = 8,
    [150] = 10
    },
    rewards = {
    [10] = {items = {{2160,1},{2173,1}}, p_days = 0, mount_id = 0, p_points = 0 , out = {0,0}},
    [25] = {items = {{2160,2},{2173,1}}, p_days = 0, mount_id = 0, p_points = 0 , out = {0,0}},
    [50] = {items = {{2160,3},{2173,1}}, p_days = 0, mount_id = 0, p_points = 0 , out = {0,0}},
    [100] = {items = {{2160,4},{2173,1}}, p_days = 0, mount_id = 0, p_points = 0 , out = {0,0}},
    [200] = {items = {{2160,5},{2173,1}}, p_days = 0, mount_id = 0, p_points = 0 , out = {0,0}},
    [250] = {items = {{2160,6},{2173,1}}, p_days = 0, mount_id = 0, p_points = 0 , out = {698, 699}},
    [500] = {items = {{2160,7},{2173,1}}, p_days = 0, mount_id = 0, p_points = 0 , out = {0,0}}
    }
    }
    function getInvitePoints(cid)
    local cid = Player(cid)
    if cid == nil then
    return false
    end
    return getPlayerStorageValue(cid, _invite_friends.storages[1]) < 0 and 0 or getPlayerStorageValue(cid, _invite_friends.storages[1])
    end
    function hasInviteFriend(cid)
    local cid = Player(cid)
    if cid == nil then
    return false
    end
    return getPlayerStorageValue(cid, _invite_friends.storages[2]) > 0 and true or false
    end
    function getNameFriend(cid)
    local cid = Player(cid)
    if cid == nil then
    return false
    end
    return getPlayerNameByGUID(getPlayerStorageValue(cid, _invite_friends.storages[2]))
    end
    function addInvitePoints(name, amount)
    local pid, Guid = getPlayerByName(name), getPlayerGUIDByName(name)
    if not pid then
    local getFriendPoints = db.storeQuery("SELECT `value` FROM `player_storage` WHERE `player_id` = ".. Guid .." AND `key` = ".._invite_friends.storages[1])
    if getFriendPoints ~= false then
    db.asyncQuery("UPDATE `player_storage` SET `value` = ".. (result.getDataInt(getFriendPoints, "value")+amount) .." WHERE `player_id` = ".. Guid .." AND `key` = ".._invite_friends.storages[1])
    end
    else
    setPlayerStorageValue(getPlayerByName(name), _invite_friends.storages[1], getInvitePoints(getPlayerByName(name))+amount)
    end
    return true
    end
    function getItemsFromList(items) -- by vodka
    local str = ''
    if table.maxn(items) > 0 then
    for i = 1, table.maxn(items) do
    str = str .. items[i][2] .. ' ' .. ItemType(items[i][1]):getName()
    if i ~= table.maxn(items) then str = str .. ', ' end end end
    return str
    end
    function getPlayerNameByGUID(guid)
    local a = db.storeQuery('SELECT `name` FROM `players` WHERE `id` = ' .. guid .. ' LIMIT 1')
    if a then
    return result.getDataString(a, "name")
    end
    return nil
    end
     
    function PlayerExist(name) -- by vodka
    local a = db.storeQuery('SELECT `id` FROM `players` WHERE `name` = ' .. db.escapeString(name))
    if a ~= false then
    return true
    end
    return false
    end

     


    Na mesma pasta procure por data\lib\core.lua e adc essa linha:
    dofile('data/lib/core/invitefriends.lua')
    data\talkactions\scripts
    InviteFriends.lua
    function onSay(player, words, param)
    local param = param:lower()
    if param == "" or not param then
    player:sendCancelMessage("Você precisa digitar o nome de um jogador.") return false
    elseif param == "points" then
    player:popupFYI("[+] Invite Friend System [+]\n\nvocê tem ["..getInvitePoints(player).."] Friends Points.") return false
    elseif hasInviteFriend(player) then
    player:sendCancelMessage("Você já agradeceu o jogador ["..getNameFriend(player).."] por te convidar a jogar neste servidor.") return false
    elseif not getPlayerGUIDByName(param) then
    player:sendCancelMessage("Desculpe, mas o jogador [" .. param .. "] não existe.") return false
    elseif player:getLevel() > _invite_friends.level_max or result.getDataInt(db.storeQuery("SELECT `level` FROM `players` WHERE `id` = "..getPlayerGUIDByName(param)), "level") < _invite_friends.level_need then
    player:sendCancelMessage((player:getLevel() > _invite_friends.level_max and "Desculpe, mas você precisa ter no maximo level ".._invite_friends.level_max.." para usar este comando." or "Desculpe, mas o jogador ["..param.."] precisa ter no minimo level ".._invite_friends.level_need.." para ser escolhido.")) return false
    elseif player:getName():lower() == param then
    player:sendCancelMessage("Desculpe, mas você não pode se auto invitar.") return false
    end
    player:setStorageValue(_invite_friends.storages[2], getPlayerGUIDByName(param))
    player:sendTextMessage(25, "Você indicou o jogador "..param..", este sistema é uma forma de agradecer a vocês por trazerem seus amigos para jogar.")
    player:getPosition():sendMagicEffect(math.random(28,30))
    return false
    end
    talkactions.xml
    <talkaction words="!invited" separator=" " script="InviteFriends.lua"/>
    Exemplo de uso do comando:
    Vodkart me chamou para jogador? uso o comando:
    !invited vodkart
    Configurando o Sistema:
    *Vá na LIB do sistema que você adicionou*
    level_max = 30, -- até que level ele precisa falar seu friend
    level_need = 50, -- que lever o jogador precisa ser para ganhar pontos
    levels_win = { -- [LEVEL QUE PRECISA ATINGIR] = QUANTIDADE DE PONTOS QUE O OUTRO JOGADOR VAI RECEBER
    [50] = 5,
    [80] = 6,
    [100] = 8,
    [150] = 10
    }
    rewards = {
    [10] = {items = {{2160,1},{2173,1}}, p_days = 0, mount_id = 0, p_points = 0 , out = {0,0}},
    [25] = {items = {{2160,2},{2173,1}}, p_days = 0, mount_id = 0, p_points = 0 , out = {0,0}},
    [50] = {items = {{2160,3},{2173,1}}, p_days = 0, mount_id = 0, p_points = 0 , out = {0,0}},
    [100] = {items = {{2160,4},{2173,1}}, p_days = 0, mount_id = 0, p_points = 0 , out = {0,0}},
    [200] = {items = {{2160,5},{2173,1}}, p_days = 0, mount_id = 0, p_points = 0 , out = {0,0}},
    [250] = {items = {{2160,6},{2173,1}}, p_days = 0, mount_id = 0, p_points = 0 , out = {698, 699}},
    [500] = {items = {{2160,7},{2173,1}}, p_days = 0, mount_id = 0, p_points = 0 , out = {0,0}}
    }
    rewards = {
    [PONTOS NECESSÁRIO PARA OBTER A PREMIAÇÃO] =
    exemplo:
    [10] = {items = {{2160,1},{2173,1}}, p_days = 0, mount_id = 0, p_points = 0 , out = {0,0}},
    com 10 pontos ele irá rceber aquele itens acima /\
    items = {} -- Poderá adicionar itens em uma tabela dizendo {id do item, quantidade}
    p_days = 0 -- se o jogador vai receber Premium Days? 0 ou Quantidade que vc deseja dar
    mount_id = 0 -- Se o jogador vai receber montaria? Colocar o Mount ID(que fica em mounts.xml) Ou deixar 0 para nenhuma
    p_points = 0 -- se o jogador vai receber Premium Points? 0 ou Quantidade que vc deseja dar
    out = {0,0} -- se vai recever outfit? {FEMALE, MALE} OU {0 , 0} para nenhuma

     

  6. pra checar se está de MC tem que ver se o jogador está online, como você falou que a contagem era de todos os membros(on e off) não dei muita importância pra MC, sobre as mensagens da pra fazer elas aleatórias numa tabela, e de forma randômica mandar as msg.

     

    sobre o piso não é melhor checar se os membros estão online?

     

     

     

  7. da pra adc um parâmetro no modulo de travel.


    vá em data\npc\lib\npcsystem e abra o modules.lua


    procura essa função:




    function StdModule.travel(cid, message, keywords, parameters, node)
    local npcHandler = parameters.npcHandler
    if(npcHandler == nil) then
    error('StdModule.travel called without any npcHandler instance.')
    end

    if(not npcHandler:isFocused(cid)) then
    return false
    end

    if(parameters.premium and not isPlayerPremiumCallback(cid)) then
    npcHandler:say('I can only allow premium players to travel with me.', cid)
    elseif(parameters.level ~= nil and getPlayerLevel(cid) < parameters.level) then
    npcHandler:say('You must reach level ' .. parameters.level .. ' before I can let you go there.', cid)
    elseif(parameters.storage ~= nil and getPlayerStorageValue(cid, parameters.storage) <= 0) then
    npcHandler:say(parameters.storageInfo or 'You may not travel here.', cid)
    elseif(not doPlayerRemoveMoney(cid, parameters.cost)) then
    npcHandler:say('You do not have enough money!', cid)
    elseif(isPlayerPzLocked(cid)) then
    npcHandler:say('Get out of there with this blood.', cid)
    else
    doTeleportThing(cid, parameters.destination, 0)
    doSendMagicEffect(parameters.destination, 10)
    end

    npcHandler:resetNpc()
    return true
    end



    e deixe ela assim:





    function StdModule.travel(cid, message, keywords, parameters, node)
    local npcHandler = parameters.npcHandler
    if(npcHandler == nil) then
    error('StdModule.travel called without any npcHandler instance.')
    end

    if(not npcHandler:isFocused(cid)) then
    return false
    end

    if(parameters.premium and not isPlayerPremiumCallback(cid)) then
    npcHandler:say('I can only allow premium players to travel with me.', cid)
    elseif(parameters.vip ~= nil and getPlayerStorageValue(cid, 13540) - os.time() <= 0) then
    npcHandler:say('I can only allow VIP players to travel with me.', cid)
    elseif(parameters.level ~= nil and getPlayerLevel(cid) < parameters.level) then
    npcHandler:say('You must reach level ' .. parameters.level .. ' before I can let you go there.', cid)
    elseif(parameters.storage ~= nil and getPlayerStorageValue(cid, parameters.storage) <= 0) then
    npcHandler:say(parameters.storageInfo or 'You may not travel here.', cid)
    elseif(not doPlayerRemoveMoney(cid, parameters.cost)) then
    npcHandler:say('You do not have enough money!', cid)
    elseif(isPlayerPzLocked(cid)) then
    npcHandler:say('Get out of there with this blood.', cid)
    else
    doTeleportThing(cid, parameters.destination, 0)
    doSendMagicEffect(parameters.destination, 10)
    end

    npcHandler:resetNpc()
    return true
    end



    agr no script de npc de barco só usar assim por exemplo:



    local travelNode = keywordHandler:addKeyword({'carlin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Carlin for 0 gold coins?'})

    travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, vip = true, level = 0, cost = 0, destination = {x=32387, y=31820, z=6} })

    travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})


  8.  

    Acho que deu um biziu: em vez de remover a parede, tá criando as grade sde ID 1343 impossibilitando do evento continuar...

     

     

    isso é simples, você adiciona no MAPA EDITOR as parades, configura no script o ID delas e POS, quando começar o evento a função vai checar se tem realmente as paredes naquele lugar q vc configurou, caso não tiver, vai cria-las.

    Hahaha bem bacana esse seu script, só fica meio enjuativo se vc colocar sempre esse evento, cê bem que podia colocar mais umas posições, tipo uns 7 locais de scripts configuraveis, ai um por semana, num lugar diferente não ia enjoar ;)

     

    vou fazer isso então, só vou adc uma storage igual eu fiz no map changer.

     

    qndo eu atualizar aviso

  9. Informações:

     

    Repassei esse sistema:

     

    http://www.xtibia.com/forum/topic/192920-battlefield-event/page-1

     

    para a nova versão

     

    Versão: TFS 1.1 ou SUPERIOR(NÃO FUNCIONA NO TFS 1.0)

     

     

    OBS: Favor ter noções básicas de como instalar o sistema no seu server.

     

     

     

    Instalando o Sistema:

     

     

     

    data\creaturescripts\scripts

     

    battlefield.lua

    function onLogin(player)
    player:registerEvent("battledeath")
    if Game.getStorageValue(_Lib_Battle_Info.TeamOne.storage) == -1 then
    Game.setStorageValue(_Lib_Battle_Info.TeamOne.storage, 0)
    Game.setStorageValue(_Lib_Battle_Info.TeamTwo.storage, 0)
    Game.setStorageValue(_Lib_Battle_Info.storage_count, 0)
    end
    if player:getStorageValue(_Lib_Battle_Info.TeamOne.storage) >= 1 or player:getStorageValue(_Lib_Battle_Info.TeamTwo.storage) >= 1 then
    player:setStorageValue(_Lib_Battle_Info.TeamOne.storage, -1)
    player:setStorageValue(_Lib_Battle_Info.TeamTwo.storage, -1)
    player:teleportTo(player:getTown():getTemplePosition())
    end
    return true
    end
    function onPrepareDeath(creature, lastHitKiller, mostDamageKiller)
    if creature:isPlayer() and creature:getStorageValue(_Lib_Battle_Info.TeamOne.storage) >= 1 or creature:getStorageValue(_Lib_Battle_Info.TeamTwo.storage) >= 1 then
    local MyTeam = creature:getStorageValue(_Lib_Battle_Info.TeamOne.storage) >= 1 and _Lib_Battle_Info.TeamOne.storage or _Lib_Battle_Info.TeamTwo.storage
    local EnemyTeam = creature:getStorageValue(_Lib_Battle_Info.TeamOne.storage) >= 1 and _Lib_Battle_Info.TeamTwo.storage or _Lib_Battle_Info.TeamOne.storage
    Game.setStorageValue(MyTeam, (Game.getStorageValue(MyTeam)-1))
    creature:sendTextMessage(MESSAGE_INFO_DESCR, "[Battle Field] You Are Dead!")
    creature:setStorageValue(MyTeam, -1)
    creature:removeCondition(CONDITION_OUTFIT)
    if Game.getStorageValue(MyTeam) == 0 then
    getWinnersBattle(EnemyTeam)
    else
    doBroadCastBattle(23,"[BattleField Information] ".._Lib_Battle_Info.TeamOne.name.." "..Game.getStorageValue(_Lib_Battle_Info.TeamOne.storage).." VS "..Game.getStorageValue(_Lib_Battle_Info.TeamTwo.storage).." " .._Lib_Battle_Info.TeamTwo.name)
    end
    end
    return true
    end
    creaturescript.xml
    <event type="login" name="battleflogin" script="battlefield.lua"/>
    <event type="preparedeath" name="battledeath" script="battlefield.lua"/>
    -------------------------------------------//-------------------------------------------------
    data\events\scripts abra o arquivo creature.lua e troque:
    function Creature:onTargetCombat(target)
    return true
    end
    por
    function Creature:onTargetCombat(target)
    if not self then return true end
    if self:isPlayer() and target:isPlayer() then
    if self:getStorageValue(_Lib_Battle_Info.TeamOne.storage) >= 1 and target:getStorageValue(_Lib_Battle_Info.TeamOne.storage) >= 1 or self:getStorageValue(_Lib_Battle_Info.TeamTwo.storage) >= 1 and target:getStorageValue(_Lib_Battle_Info.TeamTwo.storage) >= 1 then 
    return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER
    end
    end
    return true
    end
    events.xml Troque:
    <event class="Creature" method="onTargetCombat" enabled="0" />
    por
    <event class="Creature" method="onTargetCombat" enabled="1" />
    -------------------------------------------//-------------------------------------------------
    data\globalevents\scripts
    battlefieldstart.lua
    function onStartup()
    
    Game.setStorageValue(_Lib_Battle_Info.TeamOne.storage, 0)
    Game.setStorageValue(_Lib_Battle_Info.TeamTwo.storage, 0)
    Game.setStorageValue(_Lib_Battle_Info.storage_count, 0)
    return true
    end
    battlefieldthink.lua
    
    _Lib_Battle_Days = {
    ["Tuesday"] = {
    ["16:00"] = {players = 30},
    ["15:32"] = {players = 2}
    },
    ["Wednesday"] = {
    ["23:06"] = {players = 2}
    },
    ["Thursday"] = {
    ["11:26"] = {players = 4},
    ["20:30"] = {players = 10}
    }
    }
    function onThink(interval)
    if _Lib_Battle_Days[os.date("%A")] then
    hours = tostring(os.date("%X")):sub(1, 5)
    tb = _Lib_Battle_Days[os.date("%A")][hours]
    if tb and (tb.players % 2 == 0) then
    local tp = Game.createItem(1387, 1, _Lib_Battle_Info.tpPos)
    tp:setActionId(45000)
    CheckEvent(_Lib_Battle_Info.limit_Time)
    Game.setStorageValue(_Lib_Battle_Info.storage_count, tb.players)
    broadcastMessage("The event BattleField was opened and We are waiting "..tb.players.." Players! Team divided into "..((tb.players)/2).." VS "..((tb.players)/2))
    end
    end
    return true
    end
    globalevents.xml
    <globalevent type="startup" name="NoBugBattle" script="battlefieldstart.lua"/>
    <globalevent interval="60000" name="BattleField" script="battlefieldthink.lua"/>

    -------------------------------------------//-------------------------------------------------

     

    data\lib\core

     

    battlefield.lua

    _Lib_Battle_Info = {
    Reward = {
    exp = {true, 100}, items = {true, 2160, 10}, premium_days = {false, 1}
    },
    TeamOne = {name = "Black Assassins", storage = 140120, pos = {x=95,y=113,z=7}},
    TeamTwo = {name = "Red Barbarians",storage = 140121,pos = {x=100,y=116,z=7}},
    storage_count = 180400,
    tpPos = {x=92, y=116, z=7},
    limit_Time = 2 -- em minutos
    }
    function resetBattle()
    Game.setStorageValue(_Lib_Battle_Info.TeamOne.storage, 0) 
    Game.setStorageValue(_Lib_Battle_Info.TeamTwo.storage, 0)
    end
    function doBroadCastBattle(type, msg)
    for _, cid in pairs(Game.getPlayers()) do
    if Player(cid):getStorageValue(_Lib_Battle_Info.TeamOne.storage) == 1 or Player(cid):getStorageValue(_Lib_Battle_Info.TeamTwo.storage) == 1 then
    Player(cid):sendTextMessage(type, msg)
    end
    end
    end
    function getWinnersBattle(storage)
    local str, c = "" , 0
    for _, cid in pairs(Game.getPlayers()) do
    local player = Player(cid)
    if player:getStorageValue(storage) >= 1 then
    if _Lib_Battle_Info.Reward.exp[1] == true then player:addExperience(_Lib_Battle_Info.Reward.exp[2]) end
    if _Lib_Battle_Info.Reward.items[1] == true then player:addItem(_Lib_Battle_Info.Reward.items[2], _Lib_Battle_Info.Reward.items[3]) end
    if _Lib_Battle_Info.Reward.premium_days[1] == true then player:addPremiumDays(_Lib_Battle_Info.Reward.premium_days[2]) end
    player:teleportTo(player:getTown():getTemplePosition())
    player:setStorageValue(storage, -1)
    player:removeCondition(CONDITION_OUTFIT)
    c = c+1 
    end
    end
    str = str .. ""..c.." Player"..(c > 1 and "s" or "").." from team "..(Game.getStorageValue(_Lib_Battle_Info.TeamOne.storage) == 0 and _Lib_Battle_Info.TeamTwo.name or _Lib_Battle_Info.TeamOne.name).." won the event battlefield!"
    resetBattle()
    OpenWallBattle()
    return broadcastMessage(str)
    end
    function OpenWallBattle()
    local B = {
    {1543,{x=96, y=124, z=7, stackpos = 1}},
    {1543,{x=95, y=124, z=7, stackpos = 1}}
    }
    for i = 1, #B do
    if getTileItemById(B[i][2], B[i][1]).uid == 0 then
    doCreateItem(B[i][1], 1, B[i][2])
    else
    doRemoveItem(getThingfromPos(B[i][2]).uid,1)
    end
    end
    end
    function removeBattleTp()
    local t = getTileItemById(_Lib_Battle_Info.tpPos, 1387).uid
    return t > 0 and doRemoveItem(t) and doSendMagicEffect(_Lib_Battle_Info.tpPos, CONST_ME_POFF)
    end
    function CheckEvent(delay)
    if delay > 0 and Game.getStorageValue(_Lib_Battle_Info.storage_count) > 0 then
    broadcastMessage("[BattleField Event] We are waiting "..Game.getStorageValue(_Lib_Battle_Info.storage_count).." players to Battlefield starts")
    elseif delay == 0 and Game.getStorageValue(_Lib_Battle_Info.storage_count) > 0 then
    for _, cid in pairs(Game.getPlayers()) do
    local player = Player(cid)
    if player:getStorageValue(_Lib_Battle_Info.TeamOne.storage) == 1 or player:getStorageValue(_Lib_Battle_Info.TeamTwo.storage) == 1 then
    player:teleportTo(player:getTown():getTemplePosition())
    player:setStorageValue(_Lib_Battle_Info.TeamOne.storage, -1)
    player:setStorageValue(_Lib_Battle_Info.TeamTwo.storage, -1)
    player:removeCondition(CONDITION_OUTFIT)
    end
    end
    broadcastMessage("The event cannot be started because not had enough players.")
    Game.setStorageValue(_Lib_Battle_Info.storage_count, 0)
    resetBattle()
    removeBattleTp()
    end
    addEvent(CheckEvent, 60000, delay-1)
    end
    Na mesma pasta procure por data\lib\core.lua e adc essa linha:
    dofile('data/lib/core/battlefield.lua')
    -------------------------------------------//-------------------------------------------------
    data\movements\scripts
    battlefield.lua
    
    local conditionRed = Condition(CONDITION_OUTFIT)
    conditionRed:setTicks(120 * 60 * 1000)
    conditionRed:setOutfit({lookType = 143, lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94})
    local conditionBlack = Condition(CONDITION_OUTFIT)
    conditionBlack:setTicks(120 * 60 * 1000)
    conditionBlack:setOutfit({lookType = 134, lookHead = 114, lookBody = 114, lookLegs = 114, lookFeet = 114})
    function onStepIn(creature, item, position, fromPosition)
    local player = creature:getPlayer()
    if player == nil then return false end
    if player:getGroup():getId() >= 3 then
    return player:teleportTo(_Lib_Battle_Info.TeamOne.pos)
    end
    if Game.getStorageValue(_Lib_Battle_Info.storage_count) > 0 then
    local getMyTeam = Game.getStorageValue(_Lib_Battle_Info.TeamOne.storage) < Game.getStorageValue(_Lib_Battle_Info.TeamTwo.storage) and {_Lib_Battle_Info.TeamOne.storage,_Lib_Battle_Info.TeamOne.pos,_Lib_Battle_Info.TeamOne.name,conditionBlack} or {_Lib_Battle_Info.TeamTwo.storage,_Lib_Battle_Info.TeamTwo.pos, _Lib_Battle_Info.TeamTwo.name, conditionRed}
    player:addCondition(getMyTeam[4])
    player:setStorageValue(getMyTeam[1], 1)
    Game.setStorageValue(getMyTeam[1], Game.getStorageValue(getMyTeam[1])+1)
    player:teleportTo(getMyTeam[2])
    player:sendTextMessage(MESSAGE_INFO_DESCR, "You will join the team " .. getMyTeam[3] .. "!")
    Game.setStorageValue(_Lib_Battle_Info.storage_count, Game.getStorageValue(_Lib_Battle_Info.storage_count)-1)
    end
    if Game.getStorageValue(_Lib_Battle_Info.storage_count) == 0 then
    removeBattleTp()
    broadcastMessage("Battlefield will start in 2 minutes, please create your strategy!")
    addEvent(broadcastMessage, 2*60*1000-500, "BattleField will begin now!")
    addEvent(OpenWallBattle, 2*60*1000)
    end
    return true
    end
    movements.xml
    <movevent event="StepIn" actionid="45000"  script="battlefield.lua"/>
    -------------------------------------------//-------------------------------------------------
    Configurações do TIME:
    em data\lib\core\battlefield.lua tem essas linhas:
    _Lib_Battle_Info = {
    Reward = {
    exp = {true, 100}, items = {true, 2160, 10}, premium_days = {false, 1}
    },
    TeamOne = {name = "Black Assassins", storage = 140120, pos = {x=95,y=113,z=7}},
    TeamTwo = {name = "Red Barbarians",storage = 140121,pos = {x=100,y=116,z=7}},
    storage_count = 180400,
    tpPos = {x=92, y=116, z=7},
    limit_Time = 10 -- em minutos
    }
    exp = {true,100} -- se vai receber exp ao ganhar evento? true ou false e quantidade
    items = {true, 2160, 10} -- se vai receber items ao ganhar o evento, true ou false e id, quantidade do item
    premium_days = {false, 1} -- se vai receber premium days ao ganhar o evento, true ou false e quantidade

    TeamOne = {name = "Black Assassins", storage = 140120, pos = {x=95,y=113,z=7}},
    TeamTwo = {name = "Red Barbarians",storage = 140121,pos = {x=100,y=116,z=7}},
    Name = nome do time
    Storage = Não mexa
    Pos = Onde cada time vai nascer
    storage_count = 180400 -- NÃO MEXAR
    tpPos = {x=92, y=116, z=7} -- Onde o teleporte irá aparecer ao iniciar o evento
    limit_Time = 10 -- É o tempo limite para os jogadores entrarem no teleport.(em minutos)
    Configurar Datas dos Eventos:
    Em data\globalevents\scripts\battlefieldthink.lua vai ter essa tabela:
    _Lib_Battle_Days = {
    ["Tuesday"] = {
    ["16:00"] = {players = 30},
    ["15:32"] = {players = 2}
    },
    ["Wednesday"] = {
    ["23:06"] = {players = 2}
    },
    ["Thursday"] = {
    ["11:26"] = {players = 4},
    ["20:30"] = {players = 10}
    }
    }
    ["DIA DA SEMANA"] = {
    ["HORARIO"] = {players = QUANTOS JOGADORES IRÃO PARTICIPAR}
    Regra: Sempre coloque números pares para os jogadores, do contrário o evento não irá iniciar.
  10. pq ta fazendo pelo nome? acessa pelo id do player que não tem erro

     

     

     

    local coNdConf = {
    needPz = true, -- Precisa estar em Pz pra resetar? [true, false]
    needPa = false, -- Precisa ser Premium Account Pra resetar? [true, false]
    withe = false, -- Players com Pk Withe podem resetar? [true, false]
    red = false, -- Players com Pk Red pode resetar? [true, false]
    battle = false, -- Players precisão estar sem battle pra resetar? [true, false]
    teleport = true, -- Teleportar Player para o templo após resetar? [true, false]
    look = true, -- Aparecer Resets no Look do Player? [true, false] 
    resetConf = {
    Level = 350, -- Level Necessário para Resetar. [Valor]
    backLvl = 100 -- Level que voltará após o Reset. [Valor]
    }
    }
    function getPlayerReset(cid)
    local check = db.getResult("SELECT `reset` FROM `players` WHERE `id`= "..getPlayerGUID(cid))
    return check:getDataInt("reset") <= 0 and 0 or check:getDataInt("reset") 
    end
    function onSay(cid, words, param)
    local resetValue = getPlayerReset(cid) + 1
    if getPlayerLevel(cid) < coNdConf.resetConf.Level then
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "- Level Necessário Para o Reset ["..coNdConf.resetConf.Level.."]. Faltam "..coNdConf.resetConf.Level-getPlayerLevel(cid).." level's para você Resetar. -") return true
    elseif coNdConf.needPz and not getTilePzInfo(getCreaturePosition(cid)) then
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"- Você Precisa estar em Protection Zone Para Resetar. -") return true
    elseif coNdConf.needPa == true and not isPremium(cid) then
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"- Você Precisa ser Premium Account para Resetar. -") return true
    elseif not coNdConf.withe and getCreatureSkullType(cid) == 3 then
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"- Você não pode resetar em condições de PK Withe. -") return true
    elseif not coNdConf.red and getCreatureSkullType(cid) == 4 then
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"- Você não pode resetar em condições de PK Red. -") return true
    elseif coNdConf.battle and getCreatureCondition(cid, CONDITION_INFIGHT) then
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"- Você Precisa estar sem Battle para Resetar. -") return true
    end
    doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
    doRemoveCreature(cid)
    db.query("UPDATE `players` SET `reset` = " .. resetValue .. ", `level` = "..coNdConf.resetConf.Level..", `experience` = "..getExperienceForLevel(coNdConf.resetConf.Level)..", `description` = "..(coNdConf.look and "[Resets: "..resetValue.."]" or "").." WHERE `id`= "..getPlayerGUID(cid))
    return true
    end
  11.  

    function onStatsChange(cid, attacker, type, combat, value)
        if type == STATSCHANGE_HEALTHLOSS and isMonster(cid) and isPlayer(attacker) then
                if value > 0 then
                    local damageBonus = math.ceil(value + ((value / 100) * 5))
                    doTargetCombatHealth(attacker, cid, combat, - damageBonus, - damageBonus, CONST_ME_HITBYPOISON)
                    end
                end
        return true
    end
    function onCombat(cid, target)
        if isPlayer(cid) then
            if getPlayerStorageValue(cid, 9903) >= 1 then
                registerCreatureEvent(target, "damageBonus")
            end
        end
        return true
    end
  12.  

    Quando você cria um conteúdo de evento, ele vai ser postado como qualquer outro, ajudando quem precisa ou quem se interessa pela ideia.

     

    O intuito desse "evento" é uma disputa entre scripters que gostam do que faz, um duelo para onde o mais criativo, organizado e etc vencerá.

     

    Como nosso fórum é totalmente gratuito, não temos fins lucrativos para investir em premiações com esses concursos, bem que gostariamos.

     

    As vezes o conhecimento adquerido nesses eventos vale mais do quem, como você citou, uma simples premium account.

     

    sim claro, participa quem quer. Só acho que se o premio fosse melhor, mais gente iria participar.

  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...