Ir para conteúdo
Banner com Efeitos

MrBoom

Membro
  • Registro em

  • Última visita

Histórico de Curtidas

  1. Gostei
    MrBoom deu reputação a Vodkart em [TFS 1.2+] 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, 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+' .. ka.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
     
    _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 = {0, 0}}, [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 adicione 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 = {0, 0}},
    [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

Informação Importante

Confirmação de Termo