Ir para conteúdo

buchal

Membro
  • Registro em

  • Última visita

Histórico de Curtidas

  1. Obrigado
    buchal deu reputação a Dwarfer em Job System   
    ACABOU A MOLEZA! Você que sempre fez os NPC's trabalharem dia e noite, disponíveis a qualquer momento mesmo que seja apenas para receber um "hi, buy rope, yes". A COISA MUDOU! Agora você vai ter que ralar. E olhe que os monstros estão com muito gold para gastar devido às mortes de aventureiros, despreparados de AOL ou de bençãos, que acabam por deixar dinheiro nas suas backpacks. VÁ TRABALHAR, SEU VAGAB..! 
     
    Depois dessa ladainha toda, estava eu testando algumas funções, umas coisitas aqui e ali e ao misturar tudo saiu isso aí meio que sem querer. Tem uns pontos que podem ser melhorados, mas como disse serviu apenas como uns testes para mim, mas resolvi compartilhar, mesmo sendo simplesinho. Acho que será útil para servidor com um pouquinho de RPG. Testado em TFS 0.4 e versão 8.60.
     
    O Job System é um sistema no qual o player atenderá pedidos dos monstros. Cada pedido correto, o player ganha 1 job point que pode ser utilizado para comprar itens no npc ou como você queira fazer, em quests, acessos, seja lá o que for. O funcionamento é demonstrado no vídeo abaixo:
     
     
     
    Segue o código do sistema (MOD) e do NPC.
     
    jobsystem.xml
     
     
     
    CONFIGURAÇÃO:
     
    Desde que configure corretamente o mapa, não tem praticamente nada para modificar. 
    monsters = { [1] = {"Amazon", "Dwarf", "Elf Scout"}, [2] = {"Barbarian Bloodwalker", "Dwarf Guard", "Warlock"}, [3] = {"Vampire Bride", "Dwarf Geomancer", "Infernalist"} }  
    times = { deal = 30, lever = 2 } Aqui deal é o tempo em segundos entre cada pedido. Lever é o tempo em minutos para poder usar a alavanca novamente. Aconselho deixá-los nesses valores, já testei e funcionou certinho assim.
     
    A configuração ocorre praticamente no mapa:
     
    1 - Crie uma "loja" do mesmo tamanho e com a mesma configuração que as mostradas no vídeo e na imagem abaixo. Apenas com a posição do meio livre.
     

     
    Não importa a "orientação" da loja. A única exigência é que a alavanca sempre esteja do lado do braço direito do char, conforme a imagem.
     
    MUITO IMPORTANTE: NÃO USE ITENS STACKABLES NA LOJA
     

     
    2. Definindo o rank da loja:
    ALAVANCA DE ACTION ID:
     
    4421 - Rank Apprentice
    4422 - Rank Merchant
    4423 - Rank Rashid
     
    3. Todos os itens que não devem ser arrastados (itens da loja ou de decoração que não devam ser arrastados como o royal axe que mostrei lá no vídeo) devem receber o actionid 4420.
     
    4. Os pisos onde os monstros serão criados devem ter actionid 4420. Além disso, ser área no-pvp e no logout (apenas por precaução).
     
    5. Toda a área restante deve ser Protection Zone (PZ). Além disso, os locais do centro da loja onde os players ficarão devem ser No Logout Area.
     
     
    Dwarfer.xml
     
     
     
    job.lua
     
     
     
    Configuração do NPC:
     
    promote = {tomerchant = 50, torashid = 100}, tomerchant = 50 -> São necessários 50 pontos no rank Apprentice para avançar
    torashid = 100 -> São necessários 100 pontos no rank Merchant para avançar
     
    entice_rank = {-- Apprentice [2154] = {price = 1}, [2158] = {price = 3}, [2155] = {price = 7}, [2156] = {price = 100} }, merchant_rank = { -- Merchant [1998] = {price = 15}, [5950] = {price = 25}, [1987] = {price = 70}, [2402] = {price = 100} }, rashid_rank = { -- Rashid [9993] = {price = 15}, [9992] = {price = 25}, [9992] = {price = 70}, [7399] = {price = 100}} }  
    [id_do_item] = {price = preço do item}  que aparecerá na lista do NPC. 
     
    É isso aí, seus vagal's  
  2. Gostei
    buchal deu reputação a Vodkart em [8.6][Talk] Reedem Codes [Sqlite][+Beta]   
    Descrição:
     

     

     
     
     
     
    Execute no banco de dados:
     
    CREATE TABLE resgate_codes ( id INTEGER NOT NULL, code VARCHAR( 255 ) NOT NULL, items VARCHAR( 500 ) NOT NULL, premium_points INT NOT NULL DEFAULT 0, premium_days INT NOT NULL DEFAULT 0, PRIMARY KEY ( id ) );  
     
    Adicione na sua lib:
     
    function getPremiumPoints(cid) local query = db.getResult("SELECT `premium_points` FROM `accounts` WHERE `id` = "..getPlayerAccountId(cid)) return query:getDataInt("premium_points") <= 0 and 0 or query:getDataInt("premium_points") end function setPremiumPoints(cid, amount) return db.executeQuery("UPDATE `accounts` SET `premium_points` = "..amount.." WHERE `id` = "..getPlayerAccountId(cid)) end function getCodesFromServe(p) local ret = db.getResult("SELECT `id` FROM `resgate_codes` WHERE `code` = "..db.escapeString(p)) return ret:getID() ~= -1 and ret:getDataInt("id") or 0 end  
     
    Data/Talkactions
     
    createcode.lua
    function onSay(cid, words, param, channel) local param = param:lower() if param == "" or not param then doPlayerSendCancel(cid, "insira um codigo novo.") return true end local code = getCodesFromServe(param) if code ~= 0 then doPlayerSendCancel(cid, "Your code ["..param.."] already exist.") return true end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your code ["..param.."] create sucefull, now you can add items, premium days or premium points.") return db.executeQuery("INSERT INTO `resgate_codes` (`code`, `items`, `premium_points`, `premium_days`) VALUES ('".. param .."', '{}', '0', '0');") end  
    addcode.lua
    function onSay(cid, words, param, channel) local t = string.explode(param:lower(), ",") if (param == "") then doPlayerPopupFYI(cid, "[Redeem Code System]\n\nHow Use Command?\n\nTo add rewards from code enter: /addcode,type\n\n[Types:]\n\nItems\nPremium\nPoints\n\n\Exemples:\n\n/addcode items,crystal coin, 100 --To add item from code, use item name, amount.\n\n/addcode premium,10 -- To set 10 premium days in code\n\n/addcode points,20 -- To set 20 premium points in code") return true end local code = getCodesFromServe(t[1]) if code == 0 then doPlayerSendCancel(cid, "Code ["..t[1].."] does exist.") return true end if isInArray({"items","item","itens","iten"}, t[2]) then if tonumber(t[4]) ~= nil and tostring(t[3]) ~= nil then local itemid, amount = getItemIdByName(t[3], false), tonumber(t[4]) if not itemid then doPlayerSendCancel(cid, "Sorry, this item does not exist.") return true end local d = db.getResult("SELECT `items` FROM `resgate_codes` WHERE `id` = "..code):getDataString("items") local y,n = {},0 for a,b in d:gmatch("(%d+),(%d+)") do n = n + 1 y[n] = {a,b} end table.insert(y, {itemid, amount}) local str = "{" for i, x in pairs(y) do str = str.."{".. x[1] .. "," .. x[2] .. "}" if i ~= table.maxn(y) then str = str .. ',' else str = str .. '}' end end db.executeQuery("UPDATE `resgate_codes` SET `items` = "..db.escapeString(str).." WHERE `id` = "..code) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You Added "..amount.." "..t[3].." from code ["..t[1].."].") return true else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need to enter the item name, amount.")return true end elseif isInArray({"pa","premium","premmy","premiun"}, t[2]) then local min, max = 1, 999 if not tonumber(t[3]) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, only number.") return true elseif tonumber(t[3]) < min or tonumber(t[3]) > max then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, Min "..min.." and Max "..max.." points.") return true end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Now the code receives total "..t[3].." premium days.") db.executeQuery("UPDATE `resgate_codes` SET `premium_days` = "..t[3].." WHERE `id` = "..code) return true elseif isInArray({"points","pp","point","pontos"}, t[2]) then local min, max = 1, 999 if not tonumber(t[3]) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, only number.") return true elseif tonumber(t[3]) < min or tonumber(t[3]) > max then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, Min "..min.." and Max "..max.." points.") return true end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Now the code receives total "..t[3].." premium days.") db.executeQuery("UPDATE `resgate_codes` SET `premium_points` = "..t[3].." WHERE `id` = "..code) return true end return true end  
    codes.lua
    function onSay(cid, words, param, channel) local param,str = param:lower(),'' if not param then return true end local code = getCodesFromServe(param) if code == 0 then doPlayerSendCancel(cid, "Your code ["..param.."] does exist or Already used.") return true end local info = db.getResult("SELECT * FROM `resgate_codes` WHERE `id` = "..code) local d,k,p = info:getDataString("items"),info:getDataInt("premium_points"),info:getDataInt("premium_days") local t,n = {},0 for a,b in d:gmatch("(%d+),(%d+)") do n = n + 1 t[n] = {a,b} end if #t > 0 then local backpack = doPlayerAddItem(cid, 1999, 1) for _, i_i in ipairs(t) do local item, amount = i_i[1],i_i[2] if isItemStackable(item) or amount == 1 then doAddContainerItem(backpack, item, amount) else for i = 1, amount do doAddContainerItem(backpack, item, 1) end end end str = str.."".. (str == "" and "" or ", ") ..""..getItemsFromList(t) end if p > 0 then doPlayerAddPremiumDays(cid, p) str = str.."".. (str == "" and "" or ", ") .." "..p.." premium days" end if k > 0 then local total = (getPremiumPoints(cid)+k) setPremiumPoints(cid, total) str = str.."".. (str == "" and "" or ", ") .." "..k.." premium points" end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You successfully redeemed the code ["..param.."]! Reward(s):\n"..str) return db.executeQuery("DELETE FROM `resgate_codes` WHERE `id` = "..code) end  
    talkactions.xml
    <talkaction words="/resgatecode;!resgatecode" event="script" value="codes.lua"/> <talkaction words="!createcode;/createcode" access="5" event="script" value="createcode.lua"/> <talkaction words="!addcode;/addcode" access="5" event="script" value="addcode.lua"/>  
     
    Observações:
     
    * Testado somente em servidores com SQLITE
    * Futuramente estarei acrescentando e modificando o código para melhorias
    * Em breve um comando especial "/generate codes" para gerar códigos com itens randômicos(com chances)
    * Quem tiver alguma ideia ou querer passar para servidores com site estarei dando auxilia no tópico.
  3. Gostei
    buchal deu reputação a Enzo Caue em Sms shop   
    Eu já vi um layout do gesior com isso.. eu mesmo já usei.. está em algum lugar aqui no fórum.
     
    https://github.com/malucooo/capernia-ots-datapack/tree/master/res/www
    http://www.mediafire.com/file/wi442jqkt89efeu/Pack_Premium.rar
     
    Tenho quase certeza que é este aqui -> https://github.com/malucooo/Otxserver-Global/tree/master/Site Gesior
     
    Fique a vontade para testar.
  4. Gostei
    buchal deu reputação a Vodkart em [8.6] Task System 4.0! (Task system + Daily Task System)   
    Removido:
     
    *Boss Room
    *Rank Task
    *Prêmios para os 10 primeiros a terminar todas as tasks
     
    Adicionado:
     
    *Daily Task System (Sistema exclusivo de Task diario, podendo pegar 1x a cada 24 hrs, irei explicar mais depois.)
    *Task agora é por progresso, você não pode sair e voltar, terá que terminar a task 1 para avançar para a task  2, assim sucessivamente.
    *Task Points
    *Level para realizar a task
    *Nova talkaction que mostra uma janela de informações sobre o level da task, premios que irá receber, progresso, etc...
    *Items para entrega(Se o jogador deverá levar algum item junto com a quantidade de monstro morta) para finalizar a task
    *Sistema de look Task (Varia de acordo com a sua quantidade de Task Points, podendo ficar por exemplo como "Huntsman", "Ranger", etc...(alterável)
    *Mods e npc mais "clean", várias linhas removidas e o sistema está mais rápido
    *Vou Adicionar "scripts extras" Como:
    --> Tile que só passa quem tiver permissão depois de finalizar determinada quest
     --> Npc de Boss Room para entrar e enfrentar o monstro quem fez determinada quest
     
     
    [+] Resumo do Task system + Daily Task System [+]
     
    Task System: É o sistema de task "original", onde consiste em matar determinada quantidade de monstros(E entregar certo itens <- é configurável), para receber recompensas como Exp, Money e Items.
     
    Algumas mudanças do simple task 3.0 para o 4.0 foram:
     
    [+] O sistema agora é por progresso, isso quer dizer que você terá que ir terminando a quest para avançar para a seguinte.
    [+] O sistema Também recebeu uma alteração, fazendo com que as Tasks precisem que o jogador tenha um level determinado
    [+] A tabela para edição está mais fácil, fazendo com que você adicione ou remova monstros com mais tranquilidade, inclusive alterações das Rewards da Task.
     
    Daily Task System: É um sistema que desenvolvi para que os jogadores sempre estejam se comunicando com o npc de Task, no caso da Task Diaria, vária de acordo com o level do jogador, por exemplo:
     
    Jogadores entre level 6 ao 49 poderá cair em uma dessas 3 Task Diarias: Orcs, Tarantulas ou Wyverns
    Jogadores entre level 50 ao 79 poderá cair em uma dessas 3 Task Diarias: Dragons, Wailing Widows ou Ancient Scarabs
     
    E por ai vai, claro que você poderá aumentar as Task Diarias dependendo do level, eu fiz 3 para cada level que é pra postar, mas tudo isso você pode aumentar! Dependendo do seu servidor.
     
    E sim, você pode fazer a TASK "ORIGINAL" e a TASK "DIARIA" ao mesmo tempo! Ambas são distintas e possuem Rewards diferenciadas!
     
    No caso da Task diaria, levando em conta que você começou a fazer ela no dia 08/01 ás 20:00 Hrs, você tem até o dia 09/01 ás 20:00Hrs para termina-la e receber a recompensa, caso termine antes, a Task diaria só irá ficar disponível para repetição a partir desta mesma data 09/01 20:00 Hrs;
     
    [+] Caso você não termine a tempo, não tem problema, basta esperar este horário e começar uma nova Task.
    [+] Caso você começou a Daily Task e terminou antes desta data. mas por algum motivo esqueceu de entregar e a mesma passou do prazo, não tem importância, caso você tenha matado todos os monstros até 09/01 20:00 Hrs, você poderá entregar está Task em qualquer horário para receber suas Rewards e começar uma task a partir do momento em que você entregou! (INJUSTIÇA AQUI NÃO CARALHO).
     
    [+] Comandos Adicionais [+]
     
    /task -- Mostra as informações da sua Task Atual, como Nome da Task, Level, Rewards, Monstros que você poderá matar, Se tem que entregar algum Item junto, etc...
    /task daily -- É basicamente mostra a mesma informação da Task Principal, porém mostra também qual o prazo limite para entrega da task.
    /task counter -- É um comando que ATIVA ou DESATIVA o contador de monstros mortos na task no seu Channel.
     
    [+] Imagens [+]
     
    Cline neste link para ver algumas imagens da Task : http://imgur.com/a/eLIY3
     
     
     
    ------------------------------------------------ // --------------------------------------------------------------
     
    [+] Instalação do Sistema [+]
     
    Requisitos: Nível Médio de conhecimento em scripting LUA
     
    Pasta Mods
     
    Simple Task.xml
     
    https://pastebin.com/raw/P5hqMC3j
     
    NPC:
     
     
    Ludger.xml
     
    https://pastebin.com/raw/R56yLWHw
     
    simple_task.lua
     
    https://pastebin.com/raw/1mRzJ6aJ
     
    ---------------------------------------------- // ----------------------------------
     
    [+] configuração [+ ]
     
    Task System Principal
     
    task_sys = { [1] = {name = "Trolls", start = 176201, monsters_list = {"Troll","Troll champion"}, level = 8, count = 40, points = 0, items = {}, reward = {}, exp = 2000, money = 2000} }  
    [1]  --> O número entre os colchetes [] significa a ordem da Task, como a Task é por progresso sempre começará no 1 e irá pro [2], assim sucessivamente.
    name --> É o nome da task que o jogador irá fazer.
    start --> é a storage que indicará se o jogador começou a Task
    monster_list ={} --> É o nome dos monstros em que o jogador deverá caçar para completar a Task
    level --> É o level necessário para dar inicio á Task
    count --> É o número de monstros que o jogador tem que matar para completar a Task
    points --> Aqui determinada quantos Task points o jogador irá receber ao completar a Task
    items = {} --> Aqui determinada se além de matar os monstros, o jogador terá que entregar item também! Caso tenha só colocar o {ITEM_ID, QUANTIDADE} EX:
    items = {{2173,1},{2160,10},{2493,2}} rewad --> Aqui determinada se o jogador irá receber itens ao terminar a Task, mesma formula do items /\
    reward = {{2520,1},{2173,1}} exp --> Se o jogador irá receber Exp ao terminar a task. 0 ou quantidade de exp
    Money --> Se o jogador irá receber dinheiro ao terminar a task. 0 ou quantidade de dinheiro
     
     
    Daily Task System
     
    daily_task = { [1] = {name = "Orcs" ,monsters_list = {"Orc Berserker","Orc Rider","Orc Leader","Orc Warlord"}, count = 100, points = 0, reward = {}, exp = 5000, money = 10000} }  
    Segue o padrão da Task original, exceto que não precisa entregar items para o npc!
     
    Como funciona A randomização de level de acordo com a Daily task?
     
    Procure por está tabela em MODS
     
    local t = { [{6,49}] = {1,3}, [{50,79}] = {4,6}, [{80,129}] = {7,9}, [{130,math.huge}] = {10,12} }  
    entre as chaves e colchetes é o level do jogador para as Daily Task, Você pode adicionar quantas você quiser!
     
    Digamos que:
     
    [{6,49}] = {1,3}  --> Quer dizer que entre o level 6 ao 49 o jogador poderá cair na Daily Task número 1(Orcs), 2(Tarantulas) ou 3(Wyvern)!
    [{50,79}] = {4,6} --> Quer dizer que entre o level 50 ao 79 o jogador poderá cair na Daily Task número 4(Dragons), 5(Wailing Widows) ou 6(Ancient Scarabs)!
    ...
    [{130,math.huge}] = {10,12} --> Quer dizer que o jogador level 130 ou MAIS poderá cair na Daily Task número 10(Undead Dragons), 11(HydraS) ou 12(Ghastly Dragons)!
     
     
    Look Rank System
    Procure por está tabela em MODS
     
    local ranks = { [{1, 20}] = "Huntsman", [{21, 50}] = "Ranger", [{51, 100}] = "Big Game Hunter", [{101, 200}] = "Trophy Hunter", [{201, math.huge}] = "Elite Hunter" }  
    Entre 1-20 Task points o Rank será Huntsman
    Entre 21-50 Task posints o Rank será Ranger
    Entre 51-100 Task Points o rank será Big Game Hunter
    etc...
    Altere como quiser!
     
     
  5. Gostei
    buchal deu reputação a Vodkart em [8.6] [Talkactions] - Find Item   
    É um comando para procurar determinado item no servidor, ele procura em:
     
    *Jogador
    *Depot
    *House Tiles
     
    basta usar o comando /find NOME DO ITEM
     
    exemplo: /find solar axe
     

     

     

     
     
    Obs: Como é feito por DB, os items só ficaram salvo quando der serve save(hora que altera os valores na data base), então se o jogador receber o item as 15:00 e só de serve save as 16:00, só irá aparecer no comando as 16:00 horas.
     
     
     
    talkactions
     
    finditem.lua
    function onSay(cid, words, param) if param == '' or tonumber(param) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "/find item name") return true end local item_id = getItemIdByName(tostring(param), false) if not item_id then doPlayerSendCancel(cid, "This item does not exist.") return true end local str, player_depotitems, players_items, tile_items = "",{},{},{} local dp = db.getResult("SELECT `player_id`, `count` FROM `player_depotitems` WHERE `itemtype` = "..item_id),{} if (dp:getID() ~= -1) then repeat player_depotitems[#player_depotitems+1] = {dp:getDataInt("player_id"), dp:getDataInt("count") } until not(dp:next()) dp:free() end local pi = db.getResult("SELECT `player_id`, `count` FROM `player_items` WHERE `itemtype` = "..item_id),{} if (pi:getID() ~= -1) then repeat players_items[#players_items+1] = {pi:getDataInt("player_id"), pi:getDataInt("count") } until not(pi:next()) pi:free() end local hi = db.getResult("SELECT `tile_id`, `count` FROM `tile_items` WHERE `itemtype` = "..item_id),{} if (hi:getID() ~= -1) then repeat local tile = db.getResult("SELECT `house_id`, `x`, `y`, `z` FROM `tiles` WHERE `id` = "..hi:getDataInt("tile_id")),{} tile_items[#tile_items+1] = {tile:getDataInt("house_id"),tile:getDataInt("x"),tile:getDataInt("y"),tile:getDataInt("z")} until not(hi:next()) hi:free() end if #player_depotitems > 0 then str = str .. "#DEPOT ITEMS#\nQuantidade - Jogador\n" for i = 1, table.maxn(player_depotitems) do str = str .. player_depotitems[i][2] .. ' ' .. getPlayerNameByGUID(player_depotitems[i][1]) ..' \n' end end if #players_items > 0 then str = str .. (str ~= "" and "--------------//-------------\n\n#PLAYER ITEMS#\nQuantidade - Jogador\n" or "#PLAYER ITEMS#\nQuantidade - Jogador\n") for i = 1, table.maxn(players_items) do str = str .. players_items[i][2] .. ' ' .. getPlayerNameByGUID(players_items[i][1]) ..' \n' end end if #tile_items > 0 then str = str .. (str ~= "" and "--------------//-------------\n\n#TILE ITEMS#\nHouse ID - Tile Position\n" or "#TILE ITEMS#\nHouse ID -Tile Position\n") for i = 1, table.maxn(tile_items) do str = str .. tile_items[i][1] .. ' - {x = ' .. tile_items[i][2] ..', y = ' .. tile_items[i][3] ..', z = ' .. tile_items[i][4] ..'} \n' end end return doShowTextDialog(cid,item_id, str) end  
    TAG
    <talkaction log="yes" words="!find;/find" access="5" event="script" value="finditem.lua"/>  
  6. Gostei
    buchal deu reputação a Vodkart em [8.6] Invite Players System!   
    change
     
    doPlayerAddOutfit(cid, getPlayerSex(cid) == 0 and ka.out[1] or ka.out[2], 3)  
    to
     
    doPlayerAddOutfit(target, getPlayerSex(target) == 0 and ka.out[1] or ka.out[2], 3)  
    esse sistema de points e outfit eu tinha colocado dps do sistema já feito, ai eu adicionei quando postei no site, nem tinha testado essas partes... Fora isso não tem mais nenhum erro 
  7. Gostei
    buchal recebeu reputação de Vodkart em [8.6] Invite Players System!   
    Tudo funciona! Eu te amo!
    Obrigado! :D  :D
    Só mais uma coisa.
    Se você alterar a quantidade de out = {0,0} sobre out = {128,136} recebendo um erro.
     
    [17:13:17.305] [Error - CreatureScript Interface] [17:13:17.305] data/creaturescripts/scripts/InviteFriends.lua:onAdvance [17:13:17.305] Description: [17:13:17.305] (luaGetPlayerSex) Player not found [17:13:17.321] [Error - CreatureScript Interface] [17:13:17.321] data/creaturescripts/scripts/InviteFriends.lua:onAdvance [17:13:17.321] Description: [17:13:17.321] (luaDoPlayerAddOutfit) Player not found  
    Feito:
    doPlayerAddOutfit(getPlayerByNameWildcard(name), getPlayerSex(getPlayerByNameWildcard(name)) == 0 and ka.out[1] or ka.out[2], 3)
  8. Gostei
    buchal deu reputação a Vodkart em [8.6] Invite Players System!   
    ops
     
    function MandarItensProDp(name, items, texto) local backpack = doPlayerAddItem(getPlayerByNameWildcard(name), 1999, 1) -- backpackID for _, i_i in ipairs(items) do local item, amount = i_i[1],i_i[2] if isItemStackable(item) or amount == 1 then doAddContainerItem(backpack, item, amount) else for i = 1, amount do doAddContainerItem(backpack, item, 1) end end end local carta = doAddContainerItem(backpack, 1952) doItemSetAttribute(carta, "writer", "[+] Invite Players System [+]") doItemSetAttribute(carta, "text", texto) return true end  
  9. Gostei
    buchal recebeu reputação de Vodkart em [8.6] Invite Players System!   
    Erro:
    [12:54:00.950] [Error - CreatureScript Interface] [12:54:00.950] data/creaturescripts/scripts/InviteFriends.lua:onAdvance [12:54:00.951] Description: [12:54:00.952] (luaDoAddContainerItem) Container not found [12:54:00.953] [Error - CreatureScript Interface] [12:54:00.953] data/creaturescripts/scripts/InviteFriends.lua:onAdvance [12:54:00.954] Description: [12:54:00.955] (luaDoItemSetAttribute) Item not found  
  10. Gostei
    buchal deu reputação a Vodkart em [8.6] Invite Players System!   
    function MandarItensProDp(name, items, texto) local backpack = doPlayerAddItem(getPlayerByNameWildcard(name), 1999, 1) -- backpackID for _, i_i in ipairs(items) do local item, amount = i_i[1],i_i[2] if isItemStackable(item) or amount == 1 then doAddContainerItem(backpack, item, amount) else for i = 1, amount do doAddContainerItem(backpack, item, 1) end end end local carta = doAddContainerItem(backpack, 1952) doItemSetAttribute(carta, "writer", "[+] Invite Players System [+]") doItemSetAttribute(carta, "text", texto) return true end  
  11. Gostei
    buchal deu reputação a Vodkart em [8.6] Invite Players System!   
    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, 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 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
    * 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!
     
     
    data\creaturescripts\scripts
     
    InviteFriends.lua
    function onLogin(cid) registerCreatureEvent(cid, "FriendsPoints") if getPlayerStorageValue(cid, _invite_friends.storages[1]) < 0 then setPlayerStorageValue(cid, _invite_friends.storages[1], 0) setPlayerStorageValue(cid, _invite_friends.storages[4], 0) end if getInvitePoints(cid) > 0 then getRewardsFriend(getCreatureName(cid), getPlayerGUID(cid)) end return true end function onAdvance(cid, skill, oldLevel, newLevel) if (skill == SKILL__LEVEL) then if hasInviteFriend(cid) and getPlayerStorageValue(cid, _invite_friends.storages[3]) < newLevel and _invite_friends.levels_win[newLevel] then local f_name, points = getNameFriend(cid), _invite_friends.levels_win[newLevel] local f_pid = getPlayerGUIDByName(f_name) setPlayerStorageValue(cid, _invite_friends.storages[3], newLevel) addInvitePoints(f_name, points) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "[Invite Friends] você atingiu o level "..newLevel.." e o seu amigou "..f_name.." recebeu "..points.." Friend Points. Obrigado!") if isPlayer(getPlayerByNameWildcard(f_name)) then getRewardsFriend(f_name, f_pid) end end end return true end  
    creaturescript.xml
    <event type="login" name="FriendsLogin" event="script" value="InviteFriends.lua"/> <event type="advance" name="FriendsPoints" event="script" value="InviteFriends.lua"/>  
     
    data\talkactions\scripts
     
    InviteFriends.lua
    function onSay(cid, words, param, channel) local param = param:lower() if param == "" or not param then doPlayerSendCancel(cid, "Você precisa digitar o nome de um jogador.") return true elseif param == "points" then doPlayerPopupFYI(cid,"[+] Invite Friend System [+]\n\nvocê tem ["..getInvitePoints(cid).."] Friends Points.") return true elseif hasInviteFriend(cid) then doPlayerSendCancel(cid, "Você já agradeceu o jogador ["..getNameFriend(cid).."] por te convidar a jogar neste servidor.") return true elseif not getPlayerGUIDByName(param) then doPlayerSendCancel(cid, "Desculpe, mas o jogador [" .. param .. "] não existe.") return true elseif getPlayerLevel(cid) > _invite_friends.level_max or db.getResult("SELECT `level` FROM `players` WHERE `id` = "..getPlayerGUIDByName(param)):getDataInt("level") < _invite_friends.level_need then doPlayerSendCancel(cid, (getPlayerLevel(cid) > _invite_friends.level_max and "Desculpe, mas você precisa ter no minimo 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 true elseif getPlayerIp(cid) == tonumber(db.getResult("SELECT `lastip` FROM `players` WHERE `id` = "..getPlayerGUIDByName(param)):getDataString("lastip")) then doPlayerSendCancel(cid, "Desculpe, mas você não pode se auto invitar por estar com o mesmo IP.") return true elseif getCreatureName(cid):lower() == param then doPlayerSendCancel(cid, "Desculpe, mas você não pode se auto invitar.") return true end doInviteFriend(cid, getPlayerGUIDByName(param)) doPlayerSendTextMessage(cid, 25, "Você indicou o jogador "..param..", este sistema é uma forma de agradecer a vocês por trazerem seus amigos para jogar.") doSendMagicEffect(getCreaturePosition(cid), math.random(28,30)) return true end  
    talkactions.xml
    <talkaction words="/invited;!invited" event="script" value="InviteFriends.lua"/>  
     
     
    data/lib
     
    InviteFriends.lua
    _invite_friends = { storages = {202301, 202302, 202303, 202304}, -- points, jogador, recompensa lvl, recompensa items level_max = 20, -- até que level ele precisa falar seu friend level_need = 30, -- que lever o jogador precisa ser para ganhar pontos levels_win = { -- leveis que receberão os pontos(feito pelo onAdvance) [50] = 5, [80] = 6, [100] = 8, [150] = 10 }, rewards = { -- a cada tantos pontos, que tipo de reward ele irá receber(automático onLogin) [10] = {items = {{2160,1},{2173,1}}, p_days = 1, p_points = 0 , out = {0,0}}, [25] = {items = {{2160,2},{2173,1}}, p_days = 0, p_points = 0 , out = {0,0}}, [50] = {items = {{2160,3},{2173,1}}, p_days = 0, p_points = 0 , out = {0,0}}, [100] = {items = {{2160,4},{2173,1}}, p_days = 0, p_points = 0 , out = {0,0}}, [200] = {items = {{2160,5},{2173,1}}, p_days = 0, p_points = 0 , out = {0,0}}, [250] = {items = {{2160,6},{2173,1}}, p_days = 0, p_points = 0 , out = {0,0}}, [500] = {items = {{2160,7},{2173,1}}, p_days = 0, p_points = 0 , out = {0,0}} } } function getInvitePoints(cid) return getPlayerStorageValue(cid, _invite_friends.storages[1]) < 0 and 0 or getPlayerStorageValue(cid, _invite_friends.storages[1]) end function hasInviteFriend(cid) return getPlayerStorageValue(cid, _invite_friends.storages[2]) > 0 and true or false end function doInviteFriend(cid, GUID) return setPlayerStorageValue(cid, _invite_friends.storages[2], GUID) end function getNameFriend(cid) return getPlayerNameByGUID(getPlayerStorageValue(cid, _invite_friends.storages[2])) end function addInvitePoints(name, amount) local pid, Guid = getPlayerByNameWildcard(name), getPlayerGUIDByName(name) if not pid then local getFriendPoints = db.getResult("SELECT `value` FROM `player_storage` WHERE `player_id` = ".. Guid .." AND `key` = ".._invite_friends.storages[1]) if (getFriendPoints:getID() ~= -1) then db.executeQuery("UPDATE `player_storage` SET `value` = ".. (getFriendPoints:getDataInt("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 getRewardsFriend(name, pid) local acc = getAccountIdByName(name) if isPlayer(getPlayerByNameWildcard(name)) then local target = getPlayerByNameWildcard(name) local FriendPoints, CheckPoints = getInvitePoints(target), getPlayerStorageValue(target, _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 doPlayerAddPremiumDays(target, 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+' .. ka.p_points ..' WHERE id=' .. acc) str = str.."Premium Points:\n"..ka.p_points.." Premium Points." end if ka.out[1] > 0 then doPlayerAddOutfit(target, getPlayerSex(target) == 0 and ka.out[1] or ka.out[2], 3) str = str.."[New Outfit]\nRecebeu uma Nova Outfit." end setPlayerStorageValue(target, _invite_friends.storages[4], FriendPoints) MandarItensProDp(name, ka.items, str) doPlayerSendTextMessage(target, 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 MandarItensProDp(name, items, texto) local parcel = doCreateItemEx(ITEM_PARCEL) for _, i_i in ipairs(items) do local item, amount = i_i[1],i_i[2] if isItemStackable(item) or amount == 1 then doAddContainerItem(parcel, item, amount) else for i = 1, amount do doAddContainerItem(parcel, item, 1) end end end local carta = doAddContainerItem(parcel, 1952) doItemSetAttribute(carta, "writer", "[+] Invite Players System [+]") doItemSetAttribute(carta, "text", texto) doPlayerSendMailByName(name, parcel) return true end -- function adicional -- 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] .. ' ' .. getItemNameById(items[i][1]) if i ~= table.maxn(items) then str = str .. ', ' end end end return str end  
    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 = 1, p_points = 0 , out = {0,0}},
            [25] = {items = {{2160,2},{2173,1}}, p_days = 0, p_points = 0 , out = {0,0}},
            [50] = {items = {{2160,3},{2173,1}}, p_days = 0, p_points = 0 , out = {0,0}},
            [100] = {items = {{2160,4},{2173,1}}, p_days = 0, p_points = 0 , out = {0,0}},
            [200] = {items = {{2160,5},{2173,1}}, p_days = 0, p_points = 0 , out = {0,0}},
            [250] = {items = {{2160,6},{2173,1}}, p_days = 0, p_points = 0 , out = {0,0}},
            [500] = {items = {{2160,7},{2173,1}}, p_days = 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, p_points = 0 , out = {0,0}},     com 10 pontos ele irá receber 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   p_points = 0 -- se o jogador vai receber Premium Points? 0 ou Quantidade que vc deseja dar   out = {0,0} -- se vai receber outfit? {FEMALE, MALE} OU {0 , 0}  para nenhuma. obs:(lembrando que o id das outfits ficam em outfits.xml)  
     
  12. Gostei
    buchal deu reputação a Vodkart em [8.6] Invite Players System!   
    VDD, faltava arrumar a variavel, n tinha testado com points no site, o certo era a linha estar assim:
     
     
    db.executeQuery('UPDATE accounts SET premium_points=premium_points+' .. ka.p_points ..' WHERE id=' .. acc)  
     
    Desculpe qualquer incomodo! 
     
    já está arrumado
  13. Gostei
    buchal recebeu reputação de Vodkart em [8.6] Invite Players System!   
    Se você alterar a quantidade de p_points = 0 sobre p_points = 1
     
    data/lib/050-function.lua:750: attempt to concatenate a boolean value [5:32:28.838] stack traceback: [5:32:28.838]   data/lib/050-function.lua:750: in function 'getRewardsFriend' db.executeQuery('UPDATE accounts SET premium_points=premium_points+' .. p_points ..' WHERE id=' .. acc) str = str.."Premium Points:\n"..ka.p_points.." Premium Points."  
    No caso de p_points = 0 não recebe itens.

Informação Importante

Confirmação de Termo