Crie um arquivo chamado npcteleporvip.lua na pasta data/npc/scripts e cole isto
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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 creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local toPos = {x=160, y=154, z=7}
local storage = 12345
if msgcontains(msg, 'ok') then
if getPlayerStorageValue(cid, storage) >= 1 then
doTeleportThing(cid, toPos)
doSendMagicEffect(toPos, 10)
npcHandler:say('You have been teleported to the VIP area, make good use of it!', cid)
else
npcHandler:say('Sorry, but you are not VIP and can not have access to this area.', cid)
end
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Configurando
Crie um arquivo chamado NpcVIP.xml na pasta data/npc e cole isto
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Nome Npc" script="data/npc/scripts/npcteleporvip.lua" walkinterval="25" floorchange="0" access="5" level="1" maglevel="1">
<health now="150" max="150"/>
<look type="128" head="97" body="100" legs="115" feet="114" corpse="2212"/>
<parameters>
<parameter key="message_greet" value="Hello, |PLAYERNAME|! Would like to know the VIP area? If yes says {ok}"/>
<parameter key="message_walkaway" value="Hey Hey, where you go?"/>
<parameter key="message_farewell" value="Goodbye |PLAYERNAME|."/>
</parameters>
</npc>
Configurando
Não testado, se der erro avise.
Dúvidas? Me avise.
Att.
Giovani Rodrigo