Olá,
Eu fiz esse script para um servidor ao qual eu era membro da equipe. Mas como o servidor "já era".
Vou postar aqui.
Nada mais é do que um saffari system.
Antes de tudo, é necessários que você tenha adicionado a saffari ball (catch, go back, nurse etc).
Pois eu não vou mostrar como adicionar ela agora. =)
O que o npc faz?
O Npc irá checar se o player possui outro tipo de ball para catch (pokeball, great, super, ultra).
Caso sim, ele não deixa entrar. Caso não, ele deixa você entrar.
-----recomendo colocar um depot na casa do safari para facilitar aos players-----
Ao entrar no saffari ele te dar 30 saffari ball para catch.
Como ele está adaptado ao sistema do PxG, não é contado tempo. Você é expulso do safari quando as saffari balls acabam.
Scripts
NPC
focus = 0
talk_start = 0
target = 0
following = false
attacking = false
local saffari = {x=1145, y=1411, z=7}
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('See ya.')
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) < 3 then
selfSay('Olá Eu posso deixa-lo entrar na Saffari Zone por um preço de 3000 Dollars, Aceita?')
focus = cid
talk_start = os.clock()
elseif (msgcontains(msg, 'yes') ) then
if getPlayerItemCount(cid,2391) >=1 or getPlayerItemCount(cid,2394) >=1 or getPlayerItemCount(cid,2392) >=1 or getPlayerItemCount(cid,2393) >=1 then
selfSay('Você não pode entrar na saffari portando Pokeballs para catch. Até logo.')
focus = 0
talk_start = 0
elseif getPlayerItemCount(cid,2152) < 30 and getPlayerItemCount(cid,2160) < 1 then
selfSay('Você não possui dinheiro suficiente. Até logo.')
focus = 0
talk_start = 0
elseif getPlayerStorageValue(cid, 98796) >= 1 or getPlayerStorageValue(cid, 98797) >=1 then
selfSay('Você Já está na saffari.')
focus = 0
talk_start = 0
else
setPlayerStorageValue(cid, 98796, 1)
setPlayerStorageValue(cid, 98797, 1)
doPlayerAddItem(cid, 2144, 30)
doPlayerRemoveMoney(cid, 300000)
doTeleportThing(cid, saffari)
talk_start = os.clock()
end
elseif (msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 3) then
selfSay('Sorry, Im busy at this moment.')
elseif (msgcontains(msg, 'bye') and focus == cid and getDistanceToCreature(cid) < 3) then
selfSay('Good bye then.')
focus = 0
talk_start = 0
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('See ya.')
end
focus = 0
end
end
Não está muito dificil de configurar:
De vermelho é o id e a quantidade de pokeballs;
De verde a quantidade de dinheiro que precisa
Agora vá em data/creaturescript/login.lua abra o arquivo Login.lua como bloco de notas
Adicione a seguinte tag dentro do arquivo.
if getPlayerStorageValue(cid, 98797) >= 1 then ---Saffari
remm = getPlayerItemCount(cid, 2144)
doPlayerRemoveItem(cid, 2144, remm)
doTeleportThing(cid, safarioff)
setPlayerStorageValue(cid, 98797, 0)
setPlayerStorageValue(cid, 98796, 0)
end
Agora vá em data/actions/scripts e abra o arquivo Catch.lua.
Antes de
function onUse(cid, item, frompos, item3, topos)
adicione a seguinte tag:
local storage = 987960 local storage2 = 987970 local safarioff = {x=1152, y=1411, z=7}
Logo depois de "function onUse..." adicione:
if getPlayerStorageValue(cid, 98797) >= 1 then
if getPlayerStorageValue(cid, 98796) >= 30 then
setPlayerStorageValue(cid, 98796, 0)
setPlayerStorageValue(cid, 98797, 0)
remm = getPlayerItemCount(cid, 2144)
doPlayerRemoveItem(cid, 2144, remm)
doTeleportThing(cid, safarioff)
elseif getPlayerStorageValue(cid, 98796) <30 then
setPlayerStorageValue(cid, 98796, (getPlayerStorageValue(cid, 98796))+1)
end
end
obs.: Os Ids de vermelho são os da saffari ball de catch.
Créditos:
BobStriker - 100%
Merece um Rep+ ?