Bom De Tanto Fikar No Suportes Da Otserv Resolvi Cria Esse Tutorial Aki oks..
Edite: Download xD
Vamos Ao Assunto..
Primeiro Copie Um Script de um npc qualquer e Nomei Ele Assim house
AGora Pega Essas Scripts A Baixo e Cole Dentro Dele..
- Código:
-
local focus = 0
local talk_start = 0
local target = 0
local days = 0
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye then.')
focus = 0
talk_start = 0
end
end
function onCreatureTurn(creature)
end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Ola ' .. creatureGetName(cid) .. '! Eu vendo premium e posso lhe Dar acess para comprar casa.')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Desculpe, ' .. creatureGetName(cid) .. '! Falarei com voce em alguns instantes.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'acess') or msgcontains(msg, 'acess') then
if getPlayerVocation(cid) > 4 then
selfSay('Desculpe, voce ja esta com acess, procure uma house e comprea...')
talk_state = 0
elseif getPlayerLevel(cid) < 20 then
selfSay('Voce precisa ter no minimo level 20...')
talk_state = 0
elseif not isPremium(cid) then
selfSay('Compre uma premium antes, depois eu lhe darei acess.')
talk_state = 0
else
selfSay('Voce quer ter acess por 20k?')
talk_state = 1
end
elseif msgcontains(msg, 'premium') or msgcontains(msg, 'premmy') then
selfSay('Voce quer comprar 2 dias de premium por 3k?')
talk_state = 2
elseif talk_state == 1 then
if msgcontains(msg, 'yes') then
if pay(cid,20000) then
doPlayerSetVocation(cid, getPlayerAcces(cid)+1)
selfSay('acess adicionado!')
else
selfSay('Voce nao tem dinheiro suficiente.')
end
end
talk_state = 0
elseif talk_state == 2 then
if msgcontains(msg, 'yes') then
if pay(cid,3000) then
selfSay('/premium '.. creatureGetName(cid) ..', 2')
selfSay('Voce recebeu 2 dias de premium!')
else
selfSay('Sorry, you do not have enough money.')
end
end
talk_state = 0
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
doNpcSetCreatureFocus(focus)
if (os.clock() - talk_start) > 10 then
if focus > 0 then
selfSay('Next Please...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.')
focus = 0
end
end
end
Feito Isso Va Em Data/npc Copie Um npc.xml QualQuer E Nomei Assim House
Agora Copie Esses Scripts Abaixo E Cole Dentro Do House.xml
- Código:
-
<?xml version="1.0"?>
<npc name="House" script="data/npc/scripts/house.lua" access="3" lookdir="2" autowalk="25">
<mana now="800" max="800"/>
<health now="200" max="200"/>
<look type="73" head="20" body="30" legs="40" feet="50" corpse="3128"/>
</npc>
Feito Isso Seu Npc Esta Pronto...
AGora Vamos Por Ele No Mapper Editor...
Coloke Essa Tag No Seu Mapper Editor..
Ela Vai Em Creatures.xml
- Código:
-
<creature looktype="73" name="House" head="20" body="30" legs="40" feet="50" type="npc"/>
Agora Abra Comandos.xml Do Server E Altera Desse Jeito.:
[code]<command cmd="!sellhouse" access="1" /> -- Sell your house to a player
<command cmd="!buyhouse" access="1" /> -- Buy a house
<command cmd="!leavehouse" access="1" /> -- Leave a house [/color]
Bom Onde Estiver 0 nessa parte De Comando Mude Para 1 Como Segue Na Citacao Acima
Agora Abra O Seu Config.lua E Mude A Seguinte Parte..
[code]-- access to walk into houses and open house doors
accesshouse = 3
-- access to login without waiting in the queue or when server is closed
accessenter = 2
-- access to ignore damage, exhaustion, cap limit and be ignored by monsters
accessprotect = 3
-- access to broadcast messages and talk in colors (#c blabla - in public channels)
accesstalk = 2
-- access to move distant items from/to distant locations
accessremote = 3
-- access to see id and position of the item you are looking at
accesslook = 2[/code]
Bom Onde Tiver 1 No seu config.lua coloke 2 igual na citacao acima
[code]Agora Abra Seu Mapper Editor Abra Seu Mapa Nele Pronto Adicione Um Respaw Selecione O Npc Chamado House No Mapper Editor Adicione No Seu Mapa E Pronto Ja Tem Um Npc Que Vende acess Para Comprar Casa.. [/code]
Pode Abrir Seu OT Server Ele Esta Perfeito Agora Espero Que Aprovem Esse Tutorial Porque Esta Cheio Dessa Duvida Em Suporte
DUVIDAS POSTEM
Créditos
Admin