Ir para conteúdo
Entre para seguir isso  
Muliouch

[Sistema] Guild Fairy Tail

Recommended Posts

Muliouch    0
Muliouch

Sintaxe: minha_funcao(pos, item, itemtr)

Descrição: Função que faz você pegar certo level ser mandado ao Rei, Escolher Sua Guilda.

Requerimentos: MySQL / Lua 5.1+

 

 

Primeiramente Vou me apresentar, Muliouch. Velho aqui, mais novo em postagens, vim trazer um script feito por min.

 

Vai em data/creaturescripts e poe :

[font=Tahoma][i]
<event type="combat" name="attacknacao" script="attacknacao.lua"/>
          <event type="look" name="Look" event="script" value="look.lua"/>
[/i][/font]

Vai em data/creaturescripts/scripts Crie uma .lua com nome attacknacao.lua e poe :

[font=Tahoma][i]
--script by Muliouch
function onCombat(cid, target)
local creatureSkull = getCreatureSkullType(cid)


if isPlayer(target) and getPlayerReino(cid) ~= tostring("0") and getPlayerReino(target) ~= tostring("0") then
       if isPlayer(target) and getPlayerReino(cid) == getPlayerReino(target) then
           doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Não pode atacar jogadores da mesma Guilda.")
           doCreatureSetSkullType(cid, creatureSkull)
           return false
       end
   end
return true
end


[/i][/font]

 

Vai em data/creaturescripts/scripts Crie uma .lua com nome loguin.lua e poe :

[font=Tahoma][i]
registerCreatureEvent(cid, "Look")
          registerCreatureEvent(cid, "attacknacao")
[/i][/font]

Vai em data/creaturescripts/scripts Crie uma .lua com nome look.lua e poe :

[font=Tahoma][i]
--Script feito por Muliouch
function onLook(cid, thing)


pid = thing.uid
[color=#008000]local access = {[1] = {[0] = 'has no vocation',[/color]
[color=#008000]                       [1] = 'a Sorcerer',[/color]
[color=#008000]                       [2] = 'a Druid',[/color]
[color=#008000]                       [3] = 'a Paladin',[/color]
[color=#008000]                       [4] = 'a Knight',[/color]
[color=#008000]                       [5] = 'a Magician',[/color]
[color=#008000]                       [6] = 'a Warlock',[/color]
[color=#008000]                       [7] = 'a Templar',[/color]
[color=#008000]                       [8] = 'a Healer',[/color]
[color=#008000]                       [9] = 'a Assassin',[/color]
[color=#008000]                       [10] = 'a Archer',[/color]
[color=#008000]                       [11] = 'a Lord Knight',[/color]
[color=#008000]                       [12] = 'a Defender',},[/color]
[color=#008000]                [2] = {'a Tutor'},[/color]
[color=#008000]                [3] = {'a Senior Tutor'},[/color]
[color=#008000]                [4] = {'a Gamemaster'},[/color]
[color=#008000]                [5] = {'a GOD'},}       [/color]


local art = {
           [0] = 'She',
           [1] = 'He',
           }

 if isPlayer(pid) then
   local nacao = getPlayerAccess(pid) > 2 and '' or ' Nação '.. getPlayerReino(pid) ..''
   local guild = (getPlayerGuildName(pid)~='' and " ".. art[getPlayerSex(pid)] .." is ".. getPlayerGuildRank(pid) .." of the ".. getPlayerGuildName(pid) .."" .. (getPlayerGuildNick(pid)~='' and ' ('.. getPlayerGuildNick(pid) ..').' or '.') or '')
   local guild1 = (getPlayerGuildName(pid)~='' and " You are ".. getPlayerGuildRank(pid) .." of the ".. getPlayerGuildName(pid) .."" .. (getPlayerGuildNick(pid)~='' and ' ('.. getPlayerGuildNick(pid) ..').' or '.') or '')
   local voc = getPlayerAccess(pid) > 2 and access[getPlayerAccess(pid)][1] or access[1][getPlayerVocation(pid)]
   local level = getPlayerAccess(pid) > 2 and '.' or ' (Level '.. getPlayerLevel(pid) ..').'
   local msg = ('You see '.. getPlayerName(pid) ..''.. level .. ' '.. art[getPlayerSex(pid)] ..' is '.. voc ..'.'..nacao)..guild
   local msg1 = ('You see yourself. You are '.. voc ..'.'..nacao)..guild1
   if getPlayerName(pid) == getPlayerName(cid) then
     if getPlayerAccess(cid) > 2 then
       if getPlayerStorageValue(cid, 1078) == 1 then
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg1)
       else
         return true
       end
     else 
       doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg1)
     end
   else
     if getPlayerAccess(cid) > 2 then
       if getPlayerStorageValue(cid, 1078) == 1 then
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg)
       else
         return true
       end
     else
       doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg)
     end
   end
 elseif not isPlayer(pid) then
   return true
 end
end

[/i][/font]

Verde: As Vocations Vai De Acordo Com o Serv

Vai em data/lib crie um .lua. nacao.lua :

[font=Tahoma][i]
--Script feito por Muliouch
local nacao = {
       [1] = "Fairy Tail",
       [2] = "Phantom Lord",
       [3] = "Blue Pegasus",
       [4] = "Lamia Scale",
       [5] = "Cait Shelte"
}
function reinoSetTable()
local i = db.executeQuery("ALTER TABLE `players` ADD `reino` VARCHAR(50) NOT NULL DEFAULT '0' AFTER `name`;")
 return i
end
function setPlayerReino(cid, new)
   dofile("config.lua")
   db.executeQuery("UPDATE `"..sqlDatabase.."`.`players` SET `reino` = '".. nacao[new].."' WHERE `name` = '".. getPlayerName(cid).."';")
   return true
end
function getPlayerReino(cid)
   local get = db.getResult("SELECT `reino` FROM `players` WHERE `name` = '".. getPlayerName(cid).."';")
   local j = get:getDataString('reino')
   return j
end
function haveReino(cid)
   if type(getPlayerReino(cid)) == 'string' then
   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Nação: ".. getPlayerReino(cid).."")
   end
end

[/i][/font]

Vai em data/talkactions/scripts e crie um .lua reino.lua :

[font=Tahoma][i]
--script feito por GustavoMassa e adaptado por Muliouch
function onSay(cid, words, param)
   local c = { levelmin = 20,
            reipos = {x = 851, y = 1687, z = 7},  <----------------- x,y,z, as coordenadas do Castelo do NPC do Rei no MAP.
            reino1pos = {x = 99, y = 99, z = 7},  <----------------- x,y,z, as coordenadas do reino da "Fairy Tail", aonde so os players da Fairy Tail podem ir.
            reino2pos = {x = 99, y = 99, z = 7},   <-----------------x,y,z, as coordenadas do reino da "Phantom Lord", aonde so os players da Phantom Lord podem ir.
            reino3pos = {x = 99, y = 99, z = 7},   <-----------------x,y,z, as coordenadas do reino da "Blue Pegasus", aonde so os players da Blue Pegasus podem ir.
            reino4pos = {x = 99, y = 99, z = 7},   <-----------------x,y,z, as coordenadas do reino da "Lamia Scale", aonde so os players da Lamia Scale podem ir.
            reino5pos = {x = 99, y = 99, z = 7}    <-----------------x,y,z, as coordenadas do reino da "Cait Shelte", aonde so os players da Cait Shelte podem ir.
}

   if isPlayerPzLocked(cid) then
       doPlayerSendCancel(cid, "You cannot use this command during battle.")
       return true
   end

       if param == '' then
           if getPlayerLevel(cid) < c.levelmin then
               doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe, você precisa alcançar o lvl 20 para poder ir ate o Rei.")
               return false
           elseif getPlayerLevel(cid) > c.levelmin and getPlayerReino(cid) == tostring("0") then
               doTeleportThing(cid,c.reipos)
               doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Agora vá falar com o Rei e escolher sua Nação!")
               return true
           elseif getPlayerLevel(cid) > c.levelmin and getPlayerReino(cid) == tostring("Fairy Tail") then
               doTeleportThing(cid,c.reino1pos)
               doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Bem-Vindo "..getPlayerName(cid).." a Guilda Fairy Tail.")
               return true
           elseif getPlayerLevel(cid) > c.levelmin and getPlayerReino(cid) == tostring("Phantom Lord") then
               doTeleportThing(cid,c.reino2pos)
               doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Bem-Vindo "..getPlayerName(cid).." a Guild Phantom Lord.")
               return true
           elseif getPlayerLevel(cid) > c.levelmin and getPlayerReino(cid) == tostring("Blue Pegasus") then
               doTeleportThing(cid,c.reino3pos)
               doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Bem-Vindo "..getPlayerName(cid).." a Guilda Blue Pegasus.")
               return true
           elseif getPlayerLevel(cid) > c.levelmin and getPlayerReino(cid) == tostring("Lamia Scale") then
               doTeleportThing(cid,c.reino4pos)
               doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Bem-Vindo "..getPlayerName(cid).." a Guilda Lamia Scale.")
               return true
           elseif getPlayerLevel(cid) > c.levelmin and getPlayerReino(cid) == tostring("Cait Shelte") then
               doTeleportThing(cid,c.reino5pos)
               doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Bem-Vindo "..getPlayerName(cid).." a Guilda Cait Shelte.")
               return true
           end
       end
return true
end


[/i][/font]

[b][b][b][b]Vai em data/npc e crie um npc chamado rei :[b]
[font=Tahoma][i]
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Rei" script="rei.lua" walkinterval="0" floorchange="0">
   <health now="9999" max="9999"/>
   <look type="325" head="95" body="94" legs="60" feet="113" addons="3"/>
   <parameters>
       <parameter key="message_greet" value="Bem-Vindo ao meu Castelo |PLAYERNAME|."/>
   </parameters>
</npc>
[/i][/font]
[/b][/b][/b]

Vai em data/talkactions e poe :

[font=Tahoma][i]
<talkaction words="/reino" event="script" value="nacao/nacao.lua"/>
[/i][/font]

Vai em data/npc e crie um .lua rei :

[font=Tahoma][i]
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)


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 oracle(cid, message, keywords, parameters, node)
   if(not npcHandler:isFocused(cid)) then
       return false
   end

   local reinoNode = node:getParent()
   local reino = reinoNode:getParameters().new
   if getPlayerReino(cid) == tostring("0") then
       setPlayerReino(cid, reino)
       selfSay('Agora você pertence ao Reino {'..getPlayerReino(cid)..'}.',cid)
   elseif getPlayerReino(cid) ~= tostring("0") then
       selfSay('Você já pertence ao Reino {'..getPlayerReino(cid)..'}.',cid)
       npcHandler:resetNpc()
   end
return true
end


function greetCallback(cid)
   if(getPlayerLevel(cid) < 20) then
       selfSay('Volte quando alcançar o Nível 20.',cid)
       npcHandler:resetNpc()
   else
   return true
   end
end
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setMessage(MESSAGE_GREET, '|PLAYERNAME| está preparado para escolher seu reino?')


local yesNode = KeywordNode:new({'sim' or 'sím'}, oracle)
local noNode = KeywordNode:new({'nao' or 'não'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Então, que Reino ira escolher?'})


local node1 = keywordHandler:addKeyword({'sim' or 'sím'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Você quer se juntar aa guilda {Fairy Tail}, a guilda {Phantom Lord}, a guilda {Blue Pegasus}, a guilda {Lamia Scale}, a guilda {Cait Shelt}?'})
   local node2 = node1:addChildKeyword({'Fairy Tail'}, StdModule.say, {npcHandler = npcHandler, new = 1, onlyFocus = true, text = 'Então, vai se juntar a Guilda {Fairy Tail}? A decisão é irreversível!'})
           node2:addChildKeywordNode(yesNode)
           node2:addChildKeywordNode(noNode)
       node2 = node1:addChildKeyword({'Phantom Lord'}, StdModule.say, {npcHandler = npcHandler, new = 2, onlyFocus = true, text = 'Então, vai se juntar a Guilda {Phantom Lord}? A decisão é irreversível!'})
           node2:addChildKeywordNode(yesNode)
           node2:addChildKeywordNode(noNode)
       node2 = node1:addChildKeyword({'Blue Pegasus'}, StdModule.say, {npcHandler = npcHandler, new = 3, onlyFocus = true, text = 'Então, vai se juntar a Guilda {Blue Pegasus}? A decisão é irreversível!'})
           node2:addChildKeywordNode(yesNode)
           node2:addChildKeywordNode(noNode)
       node2 = node1:addChildKeyword({'Lamia Scale'}, StdModule.say, {npcHandler = npcHandler, new = 4, onlyFocus = true, text = 'Então, vai se juntar a Guilda {Lamia Scale}? A decisão é irreversível!'})
           node2:addChildKeywordNode(yesNode)
           node2:addChildKeywordNode(noNode)
       node2 = node1:addChildKeyword({'Cait Shelte'}, StdModule.say, {npcHandler = npcHandler, new = 5, onlyFocus = true, text = 'Então, vai se juntar a Guilda {Cait Shelte}? A decisão é irreversível!'})
           node2:addChildKeywordNode(yesNode)
           node2:addChildKeywordNode(noNode)
keywordHandler:addKeyword({'nao' or 'não'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Volte quando estiver pronto.'})


npcHandler:addModule(FocusModule:new())


[/i][/font]

 

Espero Que Goste ;)[/b][/b]

Compartilhar este post


Link para o post
Majesty    1755
Majesty

Obrigado por contribuir, Aprovado.

Compartilhar este post


Link para o post
Visitante
Este tópico está impedido de receber novos posts.
Entre para seguir isso  
  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×