Ir para conteúdo
  • Cadastre-se

Posts Recomendados

  • Administrador

Perfect VIP System 2.0

Galera, esse é o melhor sistema de VIP que eu já vi, ele foi criado pelo meu antigo parceiro, nicekid (vodkart), estou apenas divulgando ele.

Sistema atualizado dia 22 de setembro de 2010

Versão Testada: TFS 0.3.6
Creditos pelas modificações: Kydrai, Nicekid (Vodkart) e Marcryzius
Explicação do Novo sistema: O sistema de vip agora ele conta com a função ''os.time()'', uma function que retorna o tempo atual do CPU em segundos, sendo contado desde a criação da linguagem LUA. Ou sejá, ele conta o tempo da VIP a partir do instante que o player adquiriu ela.

O que contém no VIP Sistem 2.0?

- Compra Vip pela talkaction ( Comando !buyvip ) -- ou sem o comando.
- Tile para somente Players Vip passarem ( conta também com funçâo os.time )
- verifica quantos dias de Vip o character ainda possui.
- Administradores(GOD) podem adicionar e remover dias de Vip para characters.
-- Administradores(GOD) podem checkar dias de Vip dos Players.
-- É adicionado [VIP] ao nome e retirado quando a vip Acabar.

God Adicionando e Removendo dias de VIP

Comprando VIP e Checkando dia da sua VIP

Comando:

Comprar VIP:

!buyvip

Checkar dias de vip:

!vipdays

God checkar dias de VIP do character:

/checkvip Nick

Exemplo: /checkvip Nicekid

God adionar dias ao character:

/addvip Nick,dias

Exemplo: /addvip Nicekid,5
Aqui adicionei 5 dias de vip.

God Retirar dias de Vip do character:

/delvip Nick,dias

Exemplo: /delvip Nicekid,5
Aqui retirei 5 dias de vip.


ggfdfgfgff.jpgPrimeiro passo

Vá até talkactions/scripts, crie um arquivo.lua e renomeie para systemvip.lua, dentro coloque:

-- Script SYtem vip 2.0 --

function onSay(cid, words, param)
if(words == "!buyvip") then
local price = 5000000
if doPlayerRemoveMoney(cid, price) == TRUE then
local days = 30
local daysvalue = days * 24 * 60 * 60
local storageplayer = getPlayerStorageValue(cid, 13540)
local timenow = os.time()

if getPlayerStorageValue(cid, 13540) - os.time() <= 0 then
time = timenow + daysvalue
else
time = storageplayer + daysvalue
end

if string.find(tostring(getCreatureName(cid)),"[[Vip]]") then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Foram adicionados ".. days .." dias de VIP no seu character.")
setPlayerStorageValue(cid, 13540, time)
local quantity = math.floor((getPlayerStorageValue(cid, 13540) - timenow)/(24 * 60 * 60))
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você tem ".. quantity .." dias de VIP restantes.")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Foram adicionados ".. days .." dias de VIP no seu character.")
setPlayerStorageValue(cid, 13540, time)
local name = getCreatureName(cid)
db.executeQuery("UPDATE `players` SET `name` = '[Vip] "..name.."' WHERE `id` = "..getPlayerGUID(cid)..";")
doRemoveCreature(cid)
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você precisa de "..price.." gp's para colocar vip.")
end

elseif(words == "!vipdays") then
local timenow = os.time()
local quantity = math.floor((getPlayerStorageValue(cid, 13540) - timenow)/(24 * 60 * 60))
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você tem ".. (quantity < 0 and 0 or quantity) .." dias de VIP no seu character.")

elseif(words == "/checkvip") then
if getPlayerAccess(cid) == 5 then
if not param then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")
end

local player = getPlayerByName(param)
if not isPlayer(player) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player "..player.." not found.")
end

local timenow = os.time()

local quantity = math.floor((getPlayerStorageValue(player, 13540) - timenow)/(24 * 60 * 60))
doPlayerPopupFYI(cid, "O jogador tem ".. (quantity < 0 and 0 or quantity) .." dias de VIP no character.")
return TRUE
end

elseif(words == "/addvip") then
if getPlayerAccess(cid) == 5 then
local t = string.explode(param, ",")
if not t[2] then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")
end

local player = getPlayerByName(t[1])
local name = getCreatureName(player)
local days = t[2]
local pid = getPlayerByNameWildcard(t[1])
if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player with this name doesn\'t exist or is offline.")
return TRUE
end

local daysvalue = days*3600*24
local storageplayer = getPlayerStorageValue(player, 13540)
local timenow = os.time()
local time = storageplayer <= 0 and (timenow + daysvalue) or (storageplayer + daysvalue)

if string.find(tostring(getCreatureName(pid)),"[[Vip]]") then
doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "Foram adicionados "..days.." dias de VIP no seu character.")
setPlayerStorageValue(player, 13540, time)
local quantity = math.floor((getPlayerStorageValue(player,13540) - timenow)/(3600*24))
doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "Você tem "..quantity.." dias de VIP restantes.")
else
setPlayerStorageValue(player, 13540, time)
db.executeQuery("UPDATE `players` SET `name` = '[Vip] "..name.."' WHERE `id` = "..getPlayerGUID(player)..";")
doRemoveCreature(player)
end
end

elseif(words == "/delvip") then
if getPlayerAccess(cid) == 5 then
local dec = MESSAGE_INFO_DESCR
if(param == "") then return TRUE,doPlayerSendTextMessage(cid,18,"Command param required.")end
local C,t = {},string.explode(param, ",")
C.pos = getPlayerPosition(cid)
C.uid = getCreatureByName(t[1])
C.time = ((tonumber(t[2]) == nil) and 1 or tonumber(t[2]))*3600*24 --Tempo da vip por dia.
C.days = (tonumber(t[2]) == nil) and 1 or tonumber(t[2]) --Dias de vip.

if(getPlayerStorageValue(C.uid,13540) < C.time)then
doPlayerSendTextMessage(cid,dec,'O jogador '..t[1]..' não possui '..C.days..' dias de vip.')
else
doPlayerSendTextMessage(cid,dec,'Você removeu '..C.days..' dias de vip do player '..t[1]..'.')
setPlayerStorageValue(C.uid,13540,getPlayerStorageValue(C.uid,13540)-C.time)
end
doSendMagicEffect(C.pos, math.random(28,30))
end
end

return TRUE
end
price = é o quanto a vip vai custar em gps
days = quantos dias de vip serão adicionados ao player

Em talkactions.xml adicione a tag:

<talkaction words="!vipdays;!buyvip;/checkvip;/addvip;/delvip" script="systemvip.lua"/>
Pronto primeiro passo terminado.

Sistema vip sem o !buyvip abra a spoiler

para quem quiser o sistema em que o player não poderá comprar vip,apenas vão ser os 4 comandos:

para player
!vipdays

para God
/addvip
/delvip
/checkvip

Use este sistema:

-- Script SYtem vip 2.0 --

function onSay(cid, words, param)

if(words == "!vipdays") then
local timenow = os.time()
local quantity = math.floor((getPlayerStorageValue(cid, 13540) - timenow)/(24 * 60 * 60))
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você tem ".. (quantity < 0 and 0 or quantity) .." dias de VIP no seu character.")

elseif(words == "/checkvip") then
if getPlayerAccess(cid) == 5 then
if not param then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")
end

local player = getPlayerByName(param)
if not isPlayer(player) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player "..player.." not found.")
end

local timenow = os.time()

local quantity = math.floor((getPlayerStorageValue(player, 13540) - timenow)/(24 * 60 * 60))
doPlayerPopupFYI(cid, "O jogador tem ".. (quantity < 0 and 0 or quantity) .." dias de VIP no character.")
return TRUE
end

elseif(words == "/addvip") then
if getPlayerAccess(cid) == 5 then
local t = string.explode(param, ",")
if not t[2] then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")
end

local player = getPlayerByName(t[1])
local name = getCreatureName(player)
local days = t[2]
local pid = getPlayerByNameWildcard(t[1])
if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player with this name doesn\'t exist or is offline.")
return TRUE
end

local daysvalue = days*3600*24
local storageplayer = getPlayerStorageValue(player, 13540)
local timenow = os.time()
local time = storageplayer <= 0 and (timenow + daysvalue) or (storageplayer + daysvalue)

if string.find(tostring(getCreatureName(pid)),"[[Vip]]") then
doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "Foram adicionados "..days.." dias de VIP no seu character.")
setPlayerStorageValue(player, 13540, time)
local quantity = math.floor((getPlayerStorageValue(player,13540) - timenow)/(3600*24))
doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "Você tem "..quantity.." dias de VIP restantes.")
else
setPlayerStorageValue(player, 13540, time)
db.executeQuery("UPDATE `players` SET `name` = '[Vip] "..name.."' WHERE `id` = "..getPlayerGUID(player)..";")
doRemoveCreature(player)
end
end

elseif(words == "/delvip") then
if getPlayerAccess(cid) == 5 then
local dec = MESSAGE_INFO_DESCR
if(param == "") then return TRUE,doPlayerSendTextMessage(cid,18,"Command param required.")end
local C,t = {},string.explode(param, ",")
C.pos = getPlayerPosition(cid)
C.uid = getCreatureByName(t[1])
C.time = ((tonumber(t[2]) == nil) and 1 or tonumber(t[2]))*3600*24 --Tempo da vip por dia.
C.days = (tonumber(t[2]) == nil) and 1 or tonumber(t[2]) --Dias de vip.

if(getPlayerStorageValue(C.uid,13540) < C.time)then
doPlayerSendTextMessage(cid,dec,'O jogador '..t[1]..' não possui '..C.days..' dias de vip.')
else
doPlayerSendTextMessage(cid,dec,'Você removeu '..C.days..' dias de vip do player '..t[1]..'.')
setPlayerStorageValue(C.uid,13540,getPlayerStorageValue(C.uid,13540)-C.time)
end
doSendMagicEffect(C.pos, math.random(28,30))
end
end

return TRUE
end

Em talkactions.xml adicione a tag:


<talkaction words="!vipdays;/addvip;/delvip;/checkvip" script="systemvip.lua"/>



----------------------------------------------------------------------------------------------------------------------------

Tile VIP

ggfdfgfgff.jpgSegundo passo.

Vá até movements/scripts crie um arquivo.lua e renomeie para vipe.lua dentro coloque:

-- Script Vip Sytem 1.0 --
function onStepIn(cid, item, position, fromPosition)

local config = {
msgDenied = "Você não e vip ,fale com Administrador do Server.",
msgWelcome = "Seja Bem Vindo a Area vip."
}

if getPlayerStorageValue(cid, 13540) - os.time() <= 0 then
doTeleportThing(cid, fromPosition, true)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, config.msgDenied)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
return TRUE
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, config.msgWelcome)
return TRUE
end
Em movements.xml adicione a tag:

<movevent type="StepIn" uniqueid="13700" event="script" value="vipe.lua"/>
FIM DA VIP

Em creaturescript/script

Crie um arquivo.lua e renomeie para endvip.lua

--[[ by vodkart ]]--
function onLogin(cid)

if getPlayerStorageValue(cid, 13540) - os.time() > 0 then
setPlayerStorageValue(cid, 9898, 1)
end

local pos = {x = 157, y = 50, z = 7} -- posiçao do templo.

function Vodka(cid)
if isPlayer(cid) then
db.executeQuery("UPDATE `players` SET `name` = '"..string.sub(getCreatureName(cid), 7).."' WHERE `id` = "..getPlayerGUID(cid)..";")
doRemoveCreature(cid)
end
end

if getPlayerStorageValue(cid, 9898) == 1 and getPlayerStorageValue(cid, 13540) - os.time() < 1 or getPlayerStorageValue(cid, 13540) - os.time() == 0 then
doTeleportThing(cid, pos)
doPlayerPopupFYI(cid, "Sua vip Account acabou.")
setPlayerStorageValue(cid, 9898, -1)
if string.find(tostring(getCreatureName(cid)),"[[Vip]]") then
addEvent(Vodka, 3*1000, cid)
end
end
return TRUE
end
Em creaturescript.xml adicione a tag:

<event type="login" name="CheckVip" script="endvip.lua"/>
Pronto Seu sistema Vip está terminado.

 

dm3o5y8.png

 
Você gostou deste conteúdo!? Este conteúdo te ajudou!? Isso será realmente útil pra você!?
Então, se possível, faça uma doação (de qualquer valor) que estará me ajudando também! :P
 

TibiaKing Team- KingTópicos
www.tibiaking.com

Link para o post
Compartilhar em outros sites
  • 1 month later...

Matheus funcionou certinho,ele Add [VIP] antes do nome,mas quando acaba o player fica com 0 dias ele não consegue entrar,mas a [VIP] continua no nome,ele tinha que tirar sozinho ou tiro manualmente?

Link para o post
Compartilhar em outros sites

Era pra tirar sozinho, essa é a linha que é executado tal comando no arquivo endvip.lua

db.executeQuery("UPDATE `players` SET `name` = '"..string.sub(getCreatureName(cid), 7).."' WHERE `id` = "..getPlayerGUID(cid)..";")

Vou tentar arrumar isso, e dps eu edito o post aqui.

# Regras Gerais - TibiaKing.com #
Contato: [email protected]
Não respondo dúvidas via MP.


1C2tu.png4Tlqo.png1C2tu.png


 

Link para o post
Compartilhar em outros sites

Beleza Augusto,obrigadão ^^

@Aproveitando o tópico,para não precisar criar outro...Eu estou colocando novas outfits,mas apenas as 2 primeiras funcionam ( quando eu adiciono as 2 novas ficam no total de 26),ai que vem a pergunta,como aumento o numero de outfit,pq acho que o máximo é de 26,se alguém souber,ajuda por favor.

Abraços.

Link para o post
Compartilhar em outros sites
  • 5 weeks later...

Literamente perfect VIP System, haha!

Reputado.

@Gabriel10101

A respeito da sua dúvida, você procedeu dessa seguinte maneira na hora de adicionar os novos outfits:

<outfit id="24" premium="yes">

<list gender="0" lookType="366" name="Wayfarer"/>

<list gender="1" lookType="367" name="Wayfarer"/>

</outfit>

<outfit id="25" premium="yes">

<list gender="0-3" lookType="159" name="Elf"/>

</outfit>

<outfit id="26" premium="yes">

<list gender="0-3" lookType="160" name="Dwarf"/>

</outfit>

<outfit id="27" premium="yes">

<list gender="0-3" lookType="226" name="Frog"/>

</outfit>

<outfit id="28" premium="yes">

<list gender="0-3" lookType="194" name="Cult"/>

</outfit>

Por acaso você ao adicionar as novas outfits, colocou os <outfid id="?"> sucessivamente, por exemplo:

24, 25, 26...

A respeito da sua pergunta se tem limites de outfits, não há limites. :D

Não sei se essa era sua dúvida, mais caso não for mande me PM especificando melhor!

Editado por Doughell (veja o histórico de edições)

E-mail para contato: [email protected]

Quer ter um fórum mais organizado? Cumpra as regras!

EU VOLTEI GAROTAS!

31/12/2011

Atenciosamente,

Guilherme Salviati.

Link para o post
Compartilhar em outros sites

Oras Kimoszin nunca peguei um servidor assim, interessante em saber.

E-mail para contato: [email protected]

Quer ter um fórum mais organizado? Cumpra as regras!

EU VOLTEI GAROTAS!

31/12/2011

Atenciosamente,

Guilherme Salviati.

Link para o post
Compartilhar em outros sites
  • 3 weeks later...

Fiquei com uma dúvida..

No que vai dar caso aconteça isso:

o player se chame Renato e compra uma vip, ele fica [VIP] Renato

Uma outra pessoa cria um char chamado Renato, o que vai dar pois o Renato de antes foi alterado pra [VIP] Renato no banco de dados.

Então minha vip acaba, e eu volto a ser Renato

vai ter dois Renatos reinando sobre o server?

Link para o post
Compartilhar em outros sites
  • 4 months later...

Como faço para fazer com que o nome [VIP] saia automaticamente ?

Morrer lutando não é sinal de derrota, é sinal de conquista quem não teme a lutar ♪

Desconheço o medo mais sei que ele me domina, se a vida é louca a morte será mais ainda ♪

Se eu avançar, siga-me, se eu recuar, mate-me, se eu morrer, vingue-me, porque todos nóis somos da mesma familia³ ♪

- Mc Orelha

Link para o post
Compartilhar em outros sites
  • 1 month later...
  • 2 weeks later...
  • 2 months later...

Leia o tópico explica sim

¬¬'

data/movements/scripts


-- Script Vip Sytem 1.0 --

function onStepIn(cid, item, position, fromPosition)


local config = {

msgDenied = "Você não e vip ,fale com Administrador do Server.",

msgWelcome = "Seja Bem Vindo a Area vip."

}


if getPlayerStorageValue(cid, 13540) - os.time() <= 0 then

doTeleportThing(cid, fromPosition, true)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, config.msgDenied)

doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)

return TRUE

end

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, config.msgWelcome)

return TRUE

end
TAG
<movevent type="StepIn" uniqueid="13700" event="script" value="nome_do_script.lua"/>

Retirado.

 

Skype: joaoxtibia85.

Link para o post
Compartilhar em outros sites
  • 4 weeks later...

psylokoats, no caso como se trata de ot eu não entendo muito, então eu faço pelo meio mas facil,se o seu ot já tiver uma area q só vip podem passar vc abre o mapa com o RME e copia aquele SQm e faz a sua area vIP, espro ter ajudado ;D

Link para o post
Compartilhar em outros sites
  • 1 month later...

Grato tem RME que nao vem todas sa configuraçoes assim como de colocar areas vip ou area protect, infelizmente nao sei ql a melhor verçao para voce baixa, indico ver videos no youtub pos voce vendo aprende bem mas do que epanas lendo tutorial.

Link para o post
Compartilhar em outros sites
  • 6 months later...

Galera me ajudem? Consegui fazer tudo certinho, blz mais na hora do comando não funfa. Por quê? Alguém Poderia Me Ajudar?   :unsure: 

 

Se quiser Add skype é Henrique0006

Ajudar os outros sobre o que se sabe não dói pois amanhã quem pode precisar de ajuda é você!  ;)

 

 

Só sei que nada sei. ~ Sócrates  :cool:

 

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.


  • Conteúdo Similar

    • Por MatheusMkalo
      Todos os scripts foram testados em um ot 8.6
      Bem o script é auto-explicativo, e ainda tem um video do sistema, acho que nao preciso explicar o que faz ne?
      AGORA EM MOD, MUITO MAIS PRATICO DE INSTALAR. SE FOR USAR O MOD VA ATE O FINAL DO POST, É EXATAMENTE IGUAL A VERSAO NORMAL, SO QUE MAIS PRATICO. FUNCIONA DO MESMO JEITO.
      Video:
      obs: Veja em fullscreen para ver melhor as msgs que retornam.
      Vá em data/lib e adicione esse script.lua com o nome de WarArenaLib:
        -- [[ Area and Positions Infos ]] -- areaplayersteam = { {1,1,1,1}, {1,1,1,1}, {1,1,1,1}, {1,1,1,1}, {1,1,1,1} } areateam1ext = {x=80, y=305, z=7} -- Ponta superior esquerda da area do time um areateam2ext = {x=87, y=305, z=7} -- Ponta superior esquerda da area do time dois leaderteam1pos = {x=83, y=307, z=7, stackpos=255} -- Posição do lider do time um (que puxara a alavanca) leaderteam2pos = {x=87, y=307, z=7, stackpos=255} -- Posição do lider do time dois (que puxara a alavanca) newplayersposteam1 = {x=67, y=300, z=7} -- Posição para onde os players do time um serao teleportados newplayersposteam2 = {x=67, y=330, z=7} -- Posição para onde os players do time dois serao teleportados team1leverpos = {x=84, y=307, z=7, stackpos=1} -- Posição da alavanca que o lider do time um puxara team2leverpos = {x=86, y=307, z=7, stackpos=1} -- Posição da alavanca que o lider do time dois puxara leverafter, leverbefore = 9825, 9826 -- Ids das alavancas antes de puxadas e depois, consecutivamente (9825 = antes; 9826 = depois) posbenterteam1 = {x=78, y=307, z=7} -- Posiçao do sqm antes de entrar na arena do time 1 posbenterteam2 = {x=92, y=307, z=7} -- Posiçao do sqm antes de entrar na arena do time 2 backteampos = {x=77, y=307, z=7} -- [[ Storage Infos ]] -- team1leverstorage = 123497 -- Storage que sera usado quando puxarem a alavanca do time 1 team2leverstorage = 123498 -- Storage que sera usado quando puxarem a alavanca do time 2 haveteaminarena = 123499 -- Storage que sera usado para ve se tem algum time lutando na arena storageteam1death = 123500 -- Storage usado para ver quantos morreram do time 1 storageteam2death = 123501 -- Storage usado para ver quantos morreram do time 2 storageteam1 = 123502 -- Storage usado para ver quantas pessoas entraram na arena no time 1 storageteam2 = 123503 -- Storage usado para ver quantas pessoas entraram na arena no time 2 storageleader1 = 123504 -- Storage onde ficara guardado o uid do lider do time 1 storageleader2 = 123505 -- Storage onde ficara guardado o uid do lider do time 2 storageplayersteam1 = 123506 -- Storage que todos os players do team 1 iram ter. storageplatersteam2 = 123507 -- Storage que todos os players do team 2 iram ter. -- [[ Player Infos ]] -- needlevelarena = 20 -- Level que os outros jogadores sem ser o lider teram que ter. leaderlevel = 4000 -- Level que o lider tera que ter. onlyguildwars = true -- Se os membros de um time tem que ser da mesma guild do lider. (Nesse caso somente o lider da guild podera puxar a alavanca.) needplayers = 2 -- Quantidade de players que cada time tem que ter. -- [[ Functions ]] -- function getUidsFromArea(firstpos, area) local result = {} for i,x in pairs(area) do for s,z in pairs(x) do if isPlayer(getThingFromPos({x=firstpos.x+s-1, y=firstpos.y+i-1, z=firstpos.z, stackpos=255}).uid) then table.insert(result, getThingFromPos({x=firstpos.x+s-1, y=firstpos.y+i-1, z=firstpos.z, stackpos=255}).uid) end end end return result end function teleportUidsToPos(uids, pos) for i,x in pairs(uids) do doTeleportThing(x, pos) end end function isAllUidsSameGuild(uids, guildid) for i,x in pairs(uids) do if not (getPlayerGuildId(x) == guildid) then return false end end return true end function isAllUidsLevel(uids, level) for i,x in pairs(uids) do if not (getPlayerLevel(x) >= level) then return false end end return true end function haveQuantPlayersInArea(firstpos, area, quant) local result = 0 for i,x in pairs(area) do for s,z in pairs(x) do if isPlayer(getThingFromPos({x=firstpos.x+s-1, y=firstpos.y+i-1, z=firstpos.z, stackpos=255}).uid) then result = result+1 end end end return result >= quant end function addStorageToUids(uids, storage, value) for i,x in pairs(uids) do setPlayerStorageValue(x, storage, value) end end function checkPoses(pos1, pos2) if pos1.x == pos2.x and pos1.y == pos2.y and pos1.z == pos2.z then return true end return false end function startArena() setGlobalStorageValue(storageleader1, getThingFromPos(leaderteam1pos).uid) setGlobalStorageValue(storageleader2, getThingFromPos(leaderteam2pos).uid) addStorageToUids(team1uids, storageplayersteam1, 1) addStorageToUids(team2uids, storageplayersteam2, 1) teleportUidsToPos(team1uids, newplayersposteam1) teleportUidsToPos(team2uids, newplayersposteam2) setGlobalStorageValue(storageteam1, #team1uids) registerCreatureEventUids(team1uids, "DeathTeam1") registerCreatureEventUids(team2uids, "DeathTeam2") setGlobalStorageValue(storageteam2, #team2uids) setGlobalStorageValue(haveteaminarena, 1) setGlobalStorageValue(team1leverstorage, 0) setGlobalStorageValue(team2leverstorage, 0) doTransformItem(getThingFromPos(team1leverpos).uid, leverafter) doTransformItem(getThingFromPos(team2leverpos).uid, leverafter) end function haveTeamInArena() return getGlobalStorageValue(haveteaminarena) == 1 and true or false end function isSqmFromArea(firstpos, area, sqmpos) for i,x in pairs(area) do for s,z in pairs(x) do if sqmpos.x == firstpos.x+s-1 and sqmpos.y == firstpos.y+i-1 and sqmpos.z == firstpos.z then return true end end end return false end function registerCreatureEventUids(uids, event) for i,x in pairs(uids) do registerCreatureEvent(x, event) end end Agora vá em data/actions/scripts e adicione um script.lua com o nome de WarArenaLever:
        function onUse(cid, item, fromPosition, itemEx, toPosition) team1uids = getUidsFromArea(areateam1ext, areaplayersteam) team2uids = getUidsFromArea(areateam2ext, areaplayersteam) if haveTeamInArena() then return doPlayerSendCancel(cid, "Already have a team in arena.") end if checkPoses(toPosition, team1leverpos) then if checkPoses(getCreaturePosition(cid), leaderteam1pos) then if getGlobalStorageValue(team1leverstorage) == 1 then setGlobalStorageValue(team1leverstorage, 0) return doTransformItem(getThingFromPos(team1leverpos).uid, leverafter) end if onlyguildwars and getPlayerGuildLevel(cid) < 3 then return doPlayerSendCancel(cid, "You need to be the leader of your guild.") end if onlyguildwars and not isAllUidsSameGuild(team1uids, getPlayerGuildId(cid)) then return doPlayerSendCancel(cid, "All of your team need to be in your guild.") end if not isAllUidsLevel(team1uids, needlevelarena) then return doPlayerSendCancel(cid, "All of your team need to be level " .. needlevelarena .. " or more.") end if getPlayerLevel(cid) < leaderlevel then return doPlayerSendCancel(cid, "You, the leader of the team, need to be level " .. leaderlevel .. " or more.") end if not haveQuantPlayersInArea(areateam1ext, areaplayersteam, needplayers) then return doPlayerSendCancel(cid, "Your team need " .. tostring(needplayers) .. " players.") end setGlobalStorageValue(team1leverstorage, 1) doTransformItem(getThingFromPos(team1leverpos).uid, leverbefore) if getGlobalStorageValue(team2leverstorage) >= 1 then startArena() end else doPlayerSendCancel(cid, "You must be the leader of the team to pull the lever.") end elseif checkPoses(toPosition, team2leverpos) then if checkPoses(getCreaturePosition(cid), leaderteam2pos) then if getGlobalStorageValue(team2leverstorage) == 1 then setGlobalStorageValue(team2leverstorage, 0) return doTransformItem(getThingFromPos(team2leverpos).uid, leverafter) end if onlyguildwars and getPlayerGuildLevel(cid) < 3 then return doPlayerSendCancel(cid, "You need to be the leader of your guild.") end if onlyguildwars and not isAllUidsSameGuild(team2uids, getPlayerGuildId(cid)) then return doPlayerSendCancel(cid, "All of your team need to be in your guild.") end if not isAllUidsLevel(team2uids, needlevelarena) then return doPlayerSendCancel(cid, "All of your team need to be level " .. needlevelarena .. " or more.") end if getPlayerLevel(cid) < leaderlevel then return doPlayerSendCancel(cid, "You, the leader of the team, need to be level " .. leaderlevel .. " or more.") end if not haveQuantPlayersInArea(areateam2ext, areaplayersteam, needplayers) then return doPlayerSendCancel(cid, "Your team need " .. tostring(needplayers) .. " players.") end setGlobalStorageValue(team2leverstorage, 1) doTransformItem(getThingFromPos(team2leverpos).uid, leverbefore) if getGlobalStorageValue(team1leverstorage) >= 1 then startArena() end else doPlayerSendCancel(cid, "You must be the leader of the team to pull the lever.") end end return TRUE end E em actions.xml bote essa linha:
        <action actionid="12349" event="script" value="WarArenaLever.lua"/> Agora vá em data/creaturescripts/scripts e adicione dois scripts.lua com esses nomes: WarArenaDeathTeam1:
        function onDeath(cid) setPlayerStorageValue(cid, storageplayersteam1, 0) setGlobalStorageValue(storageteam1death, getGlobalStorageValue(storageteam1death) >= 0 and getGlobalStorageValue(storageteam1death)+1 or 1) if getGlobalStorageValue(storageteam1death) >= getGlobalStorageValue(storageteam1) then if onlyguildwars then doBroadcastMessage("The Team 2 won the war, guild " .. getPlayerGuildName(getGlobalStorageValue(storageleader2)) .. ".") else doBroadcastMessage("The Team 2 won the war, team leader name is " .. getCreatureName(getGlobalStorageValue(storageleader2)) .. ".") end setGlobalStorageValue(storageteam1death, 0) setGlobalStorageValue(storageteam2death, 0) setGlobalStorageValue(haveteaminarena, 0) end return TRUE end WarArenaDeathTeam2:
        function onDeath(cid) setPlayerStorageValue(cid, storageplayersteam2, 0) setGlobalStorageValue(storageteam2death, getGlobalStorageValue(storageteam2death) >= 0 and getGlobalStorageValue(storageteam2death)+1 or 1) if getGlobalStorageValue(storageteam2death) >= getGlobalStorageValue(storageteam2) then if onlyguildwars then doBroadcastMessage("The Team 1 won the war, guild " .. getPlayerGuildName(getGlobalStorageValue(storageleader1)) .. ".") else doBroadcastMessage("The Team 1 won the war, team leader name is " .. getCreatureName(getGlobalStorageValue(storageleader1)) .. ".") end setGlobalStorageValue(storageteam1death, 0) setGlobalStorageValue(storageteam2death, 0) setGlobalStorageValue(haveteaminarena, 0) end return TRUE end Agora abra o creaturescripts.xml e adicione essas linhas:
        <event type="death" name="DeathTeam1" event="script" value="WarArenaDeathTeam1.lua"/> <event type="death" name="DeathTeam2" event="script" value="WarArenaDeathTeam2.lua"/> Agora vá em data/movements/scripts e adicione tres scripts.lua com esses nomes: WarArenaMovement1:
        function onStepOut(cid, item, position, fromPosition) local team = (fromPosition.x == leaderteam1pos.x and fromPosition.y == leaderteam1pos.y and fromPosition.z == leaderteam1pos.z) and "team1" or (fromPosition.x == leaderteam2pos.x and fromPosition.y == leaderteam2pos.y and fromPosition.z == leaderteam2pos.z) and "team2" if team == "team1" then if getGlobalStorageValue(team1leverstorage) == 1 then setGlobalStorageValue(team1leverstorage, 0) doTransformItem(getThingFromPos(team1leverpos).uid, leverafter) end elseif team == "team2" then if getGlobalStorageValue(team2leverstorage) == 1 then setGlobalStorageValue(team2leverstorage, 0) doTransformItem(getThingFromPos(team2leverpos).uid, leverafter) end end end WarArenaMovement2:
        function onStepIn(cid, item, position, fromPosition) local team = isSqmFromArea(areateam1ext, areaplayersteam, fromPosition) and "team1" or isSqmFromArea(areateam2ext, areaplayersteam, fromPosition) and "team2" if team == "team1" then if getGlobalStorageValue(team1leverstorage) == 1 then if not haveQuantPlayersInArea(areateam1ext, areaplayersteam, needplayers) then setGlobalStorageValue(team1leverstorage, 0) doTransformItem(getThingFromPos(team1leverpos).uid, leverafter) end end elseif team == "team2" then if getGlobalStorageValue(team2leverstorage) == 1 then if not haveQuantPlayersInArea(areateam2ext, areaplayersteam, needplayers) then setGlobalStorageValue(team2leverstorage, 0) doTransformItem(getThingFromPos(team2leverpos).uid, leverafter) end end end if getGlobalStorageValue(team1leverstorage) == 1 then if checkPoses(fromPosition, posbenterteam1) then doTeleportThing(cid, fromPosition) return doPlayerSendCancel(cid, "You can't enter now.") end elseif getGlobalStorageValue(team2leverstorage) == 1 then if checkPoses(fromPosition, posbenterteam2) then doTeleportThing(cid, fromPosition) return doPlayerSendCancel(cid, "You can't enter now.") end end end WarArenaMovement3:
        function onStepIn(cid, item, position, fromPosition) if getPlayerStorageValue(cid, storageplayersteam1) >= 1 then setPlayerStorageValue(cid, storageplayersteam1, 0) doTeleportThing(cid, posbenterteam1) setGlobalStorageValue(storageteam1death, getGlobalStorageValue(storageteam1death) >= 0 and getGlobalStorageValue(storageteam1death)+1 or 1) if getGlobalStorageValue(haveteaminarena) >= 1 then if getGlobalStorageValue(storageteam1death) >= getGlobalStorageValue(storageteam1) then if onlyguildwars then doBroadcastMessage("The Team 2 won the war, guild " .. getPlayerGuildName(getGlobalStorageValue(storageleader2)) .. ".") else doBroadcastMessage("The Team 2 won the war, team leader name is " .. getCreatureName(getGlobalStorageValue(storageleader2)) .. ".") end setGlobalStorageValue(storageteam1death, 0) setGlobalStorageValue(storageteam2death, 0) setGlobalStorageValue(haveteaminarena, 0) end end elseif getPlayerStorageValue(cid, storageplayersteam2) >= 1 then setPlayerStorageValue(cid, storageplayersteam2, 0) doTeleportThing(cid, posbenterteam2) setGlobalStorageValue(storageteam2death, getGlobalStorageValue(storageteam2death) >= 0 and getGlobalStorageValue(storageteam2death)+1 or 1) if getGlobalStorageValue(haveteaminarena) >= 1 then if getGlobalStorageValue(storageteam2death) >= getGlobalStorageValue(storageteam2) then if onlyguildwars then doBroadcastMessage("The Team 1 won the war, guild " .. getPlayerGuildName(getGlobalStorageValue(storageleader1)) .. ".") else doBroadcastMessage("The Team 1 won the war, team leader name is " .. getCreatureName(getGlobalStorageValue(storageleader1)) .. ".") end setGlobalStorageValue(storageteam1death, 0) setGlobalStorageValue(storageteam2death, 0) setGlobalStorageValue(haveteaminarena, 0) end end end return TRUE end E adicione essas linhas em movements.xml:
        <movevent type="StepOut" actionid="12350" event="script" value="WarArenaMovement1.lua"/> <movevent type="StepIn" actionid="12351" event="script" value="WarArenaMovement2.lua"/> <movevent type="StepIn" actionid="12352" event="script" value="WarArenaMovement3.lua"/> Pronto acabou rairiaria. Adicionando os Actions IDS: Nas 2 alavancas, adicione o actionid 12349. Nos 2 sqms que os players vao estar antes de entrar na arena adicione o actionid 12351. Nos 2 quadrados aonde os lideres irao ficar (na frente da alavanca) bote o actionid 12350. No sqm de sair da arena bote o actionid 12352. NA AREA DOS TIMES E NA ARENA, BOTE PELO MAP EDITOR PARA NAO PODER LOGAR. (Se voce nao fizer isso pode haver bugs.) Bem, se voce souber ler o script da lib, vai saber configura-lo para seu otserver. Versão MOD: (Abra o spoiler)
      O modo de configurar é exatamente igual ao normal. Flws.
      By MatheusMkalo
    • Por Garou
      ADVANCED FORGE SYSTEM
      O SISTEMA DE CRIAÇÃO DE ITENS PARA SEU SERVIDOR
       
      Creio que muitos já conhecem o sistema de forja criado por mim, acontece que o código já estava um pouco obsoleto, então resolvi reescrever ele do 0.
      Simplesmente consiste em um sistema de criação de itens avançado que ressuscita um pouco do RPG perdido nos servidores de hoje em dia. O jogador poderá criar itens através de forja, agindo como um verdadeiro ferreiro medieval. Adiciona itens em cima de uma bigorna previamente colocada no mapa e com um martelo cria um item totalmente novo.
      CARACTERÍSTICAS DA VERSÃO FINAL:
      - Configuração intuitiva e fácil de compreender;
      - Mini-tutorial auxiliando criação de novas receitas;
      - Receitas podem conter até 250 itens diferentes com suas respectivas quantidades;
      - Sistema inteligente que identifica uma receita em qualquer ordem;
      - Código totalmente orientado a objetos;
      - Possibilidade de configurar diferentes requerimentos, diferentes skills, magic level e level
       
      Há dois modos de instalar o Advanced Forge System, o primeiro é seguir os passos deste tópico e o segundo e baixar pasta data/ anexada no tópico com os arquivos em seus respectivos diretórios, precisando apenas o registro das chaves nos arquivos XML.
      Escolha o modo que mais convém a você.
       
      Crie um arquivo em data/lib chamado forgesystem.lua e cole o conteúdo abaixo:
        --[[ ADVANCED FORGE SYSTEM FINAL Criado por Oneshot É proibido a venda ou a cópia sem os devidos créditos desse script. ]]-- RecipeHandler = { itemtype = 0, items = {}, level = 1, maglevel = 0, skills = {[0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0, [6] = 0} } Forge = { type = nil, position = nil, magicEffect = CONST_ME_MAGIC_GREEN, messages = { class = MESSAGE_STATUS_DEFAULT, success = "You have successfully forged a %s.", needskill = "You don't have enough %s to create a %s.", needlevel = "You need level %s to create a %s.", needmaglevel = "You need magic level %s to create a %s." } } function RecipeHandler:new(itemtype, items, level, maglevel, skills) local obj = { itemtype = (itemtype or 0), items = (items or {}), level = (level or 1), maglevel = (maglevel or 0), skills = (skills or {[0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0, [6] = 0}) } table.insert(Recipes, obj) return setmetatable(obj, {__index = self}) end function RecipeHandler:setItem(itemtype) self.itemtype = (itemtype or 0) end function RecipeHandler:setRecipe(...) self.items = {...} end function RecipeHandler:setRecipeItem(itemid, amount) table.insert(self.items, {itemid, amount}) end function RecipeHandler:setSkill(skillid, value) self.skills[skillid] = value end function RecipeHandler:setLevel(value) self.level = value end function RecipeHandler:setMagLevel(value) self.maglevel = value end function RecipeHandler:check(position) local match = false for n, item in ipairs(self.items) do local thing = getTileItemById(position, item[1]) if thing.uid > 0 and math.max(1, thing.type) >= item[2] then if n == #self.items then match = true end else break end end return match end function RecipeHandler:get(position) if self:check(position) == true then return setmetatable({type = self, position = position}, {__index = Forge}) end return false end function Forge:create(cid) if self.type.itemid == 0 then print("[FORGE SYSTEM - ERROR] ATTEMPT TO CREATE A RECIPE ITEMID 0") return end local status = true if(cid) then if getPlayerLevel(cid) < self.type.level then doPlayerSendTextMessage(cid, self.messages.class, self.messages.needlevel:format(self.type.level, getItemNameById(self.type.itemtype))) return end if getPlayerMagLevel(cid) < self.type.maglevel then doPlayerSendTextMessage(cid, self.messages.class, self.messages.needmaglevel:format(self.type.maglevel, getItemNameById(self.type.itemtype))) return end for skillid, value in pairs(self.type.skills) do if getPlayerSkillLevel(cid, skillid) < value then status = false doPlayerSendTextMessage(cid, self.messages.class, self.messages.needskill:format(SKILL_NAMES[skillid], getItemNameById(self.type.itemtype))) break end end end if status == true then for _, item in ipairs(self.type.items) do local thing = getTileItemById(self.position, item[1]) doRemoveItem(thing.uid, item[2]) end doSendMagicEffect(self.position, self.magicEffect) doPlayerSendTextMessage(cid, self.messages.class, self.messages.success:format(getItemNameById(self.type.itemtype))) doCreateItem(self.type.itemtype, self.position) end end dofile(getDataDir() .."/lib/recipes.lua") Crie um arquivo em data/lib chamado recipes.lua e adicione o conteúdo abaixo:
        ---------------------------------------- -----** TUTORIAL DE CONFIGURAÇÃO **----- ---------------------------------------- --[[ O 'ADVANCED FORGE SYSTEM' é muito fácil e intuitivo de configurar, você só precisa chamar a função RecipeHandler:new(...), sendo que você já configurar os atributos da receita nela ou usar outras funções para isso. Por exemplo, quero criar uma Magic Sword que precise de 100 Gold Nuggets. RecipeHandler:new(2400, {{2157, 100}}) Ou então Magic_Sword = RecipeHandler:new() Magic_Sword:setItem(2400) Magic_Sword:setRecipe({2157, 100}) Funções do Sistema: RecipeHandler:new(itemtype, items, level, maglevel, skills) --> Cria uma nova instância de forja. RecipeHandler:setItem(itemtype) --> Atribui um certo itemid como resultado da receita. RecipeHandler:setRecipe(recipe) --> Atribui uma receita. RecipeHandler:setRecipeItem(itemid, amount) --> Adiciona um itemid e sua quantidade a receita. RecipeHandler:setSkill(skillid, value) --> Atribui um valor necessário de uma certa skill para poder criar a receita. RecipeHandler:setLevel(value) --> Atribui o level necessário para criar uma receita. RecipeHandler:setMagLevel(value) --> Atribui o magic level necessário para criar uma receita. ]]-- --[[ Este é um exemplo de receita usando algumas funções. É uma Magic Sword (ITEMID: 2400) que precisa de 100 Gold Nuggets (ITEMID: 2157), além disso, o personagem que tentar forjar, precisa ter Level 100 e Sword Fighting 50. ]]-- Recipes = {} magicsword = RecipeHandler:new() magicsword:setItem(2400) magicsword:setRecipeItem(2157, 100) magicsword:setLevel(100) magicsword:setSkill(2, 50) Agora em data/actions/scripts, crie um arquivo chamado iron_hammer.lua e adicione o conteúdo abaixo:
        function onUse(cid, item, fromPosition, itemEx, toPosition) local recipe = nil for _, v in ipairs(Recipes) do recipe = v:get(toPosition) if(recipe ~= false) then break end end if(recipe) then recipe:create(cid) else doPlayerSendCancel(cid, "This is not a valid recipe.") end return true end E por fim em actions.xml, adicione a seguinte linha:
        <action itemid="4846" event="script" value="iron_hammer.lua"/> OPCIONAL - TALKACTION A talkaction abaixo mostra ao jogadoras receitas configuradas no servidor que ele pode fazer. Em data/talkactions/scripts, crie um arquivo chamado recipes.lua e adicione o conteúdo abaixo:
        function onSay(cid, words, param, channel) local ret = {} local msg = " ADVANCED FORGE SYSTEM\n" for _, recipe in ipairs(Recipes) do local skills = true for skillid, value in pairs(recipe.skills) do if getPlayerSkillLevel(cid, skillid) < value then skills = false break end end if skills == true then if getPlayerLevel(cid) >= recipe.level and getPlayerMagLevel(cid) >= recipe.maglevel then table.insert(ret, {recipe, true}) else table.insert(ret, {recipe, false}) end else table.insert(ret, {recipe, false}) end end for _, recipe in ipairs(ret) do msg = msg .."\nRecipe for ".. getItemNameById(recipe[1].itemtype) ..":\n\n" if recipe[2] == true then for _, item in ipairs(recipe[1].items) do msg = msg .."* ".. getItemNameById(item[1]) .." [".. math.min(item[2], math.max(0, getPlayerItemCount(cid, item[1]))) .."/".. item[2] .."]\n" end else msg = msg .."[LOCKED]\n" end end doShowTextDialog(cid, 2555, msg) return true end Em data/talkactions/talkactions.xml, adicione a linha:
        <talkaction words="/recipes" event="script" value="recipes.lua"/> Siga as instruções para configuração de novas receitas.
      Em breve vídeo de funcionamento
      Advanced Forge System.rar
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo