armyman
Member
- Joined
- Feb 15, 2014
- Messages
- 318
- Reaction score
- 14
I have this configuration in config.lua
I put "false" in this line, but the npc's continue working with free acc
NPC boat script.
LUA:
FreeBoats = false
I put "false" in this line, but the npc's continue working with free acc
NPC boat script.
LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local money, randompos
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 GreyhoundBehaviour (cid, type, msg)
if(msgcontains(msg:lower(),"yes")) and (npcHandler.Topic == 1) and (npcHandler:isFocused(cid)) then
if (isPremium(cid) == TRUE) then
if (getConfigValue("FreeBoats") == true) or (doPlayerRemoveMoney(cid, money) == TRUE) then
v = randompos[math.random(#randompos)]
addEvent(doSendMagicEffect, 100, getThingPos(cid), 10)
addEvent(doSendMagicEffect, 100, v, 10)
doTeleportThing(cid,v)
npcHandler:setMessage(MESSAGE_TRAVEL, "Set the sails!")
npcHandler:onTravel(cid)
else
npcHandler:say("You don't have enough money.",cid)
end
else
npcHandler:say("I'm sorry, but you need a premium account in order to travel onboard our ships.",cid)
end
npcHandler:doTopic(cid, 0)
elseif(msgcontains(msg:lower(),"thais")) and (npcHandler:isFocused(cid)) then
if (getPlayerStorageValue(cid, 681) == 1) then
npcHandler:say("Do you seek a passage to Thais for 100 gold?",cid)
randompos = {
{x=32315, y=32209, z=7},
{x=32313, y=32212, z=7},
{x=32314, y=32215, z=7},
}
money = 100
npcHandler:doTopic(cid, 1)
else
npcHandler:say("Do you seek a passage to Thais for 110 gold?",cid)
randompos = {
{x=32315, y=32209, z=7},
{x=32313, y=32212, z=7},
{x=32314, y=32215, z=7},
}
money = 110
npcHandler:doTopic(cid, 1)
end
elseif(msgcontains(msg:lower(),"ab'dendriel")) and (npcHandler:isFocused(cid)) then
if (getPlayerStorageValue(cid, 681) == 1) then
npcHandler:say("Do you seek a passage to Ab'dendriel for 70 gold?",cid)
randompos = {
{x=32733, y=31662, z=7},
{x=32734, y=31666, z=7},
{x=32732, y=31669, z=7},
}
money = 70
npcHandler:doTopic(cid, 1)
else
npcHandler:say("Do you seek a passage to Ab'dendriel for 80 gold?",cid)
randompos = {
{x=32733, y=31662, z=7},
{x=32734, y=31666, z=7},
{x=32732, y=31669, z=7},
}
money = 80
npcHandler:doTopic(cid, 1)
end
elseif(msgcontains(msg:lower(),"edron")) and (npcHandler:isFocused(cid)) then
if (getPlayerStorageValue(cid, 681) == 1) then
npcHandler:say("Do you seek a passage to Edron for 100 gold?",cid)
randompos = {
{x=33173, y=31765, z=7},
{x=33177, y=31766, z=7},
{x=33181, y=31765, z=7},
}
money = 100
npcHandler:doTopic(cid, 1)
else
npcHandler:say("Do you seek a passage to Edron for 110 gold?",cid)
randompos = {
{x=33173, y=31765, z=7},
{x=33177, y=31766, z=7},
{x=33181, y=31765, z=7},
}
money = 110
npcHandler:doTopic(cid, 1)
end
elseif(msgcontains(msg:lower(),"venore")) and (npcHandler:isFocused(cid)) then
if (getPlayerStorageValue(cid, 681) == 1) then
npcHandler:say("Do you seek a passage to Venore for 120 gold?",cid)
randompos = {
{x=32953, y=32023, z=7},
{x=32960, y=32022, z=7},
{x=32955, y=32025, z=7},
}
money = 120
npcHandler:doTopic(cid, 1)
else
npcHandler:say("Do you seek a passage to Venore for 130 gold?",cid)
randompos = {
{x=32953, y=32023, z=7},
{x=32960, y=32022, z=7},
{x=32955, y=32025, z=7},
}
money = 130
npcHandler:doTopic(cid, 1)
end
elseif (npcHandler.Topic == 1) then
npcHandler:say("We would like to serve you some time.", cid)
npcHandler:doTopic(cid, 0)
end
npcHandler:AddFocus({"hi", "hello"}, "Welcome on board, Sir |PLAYERNAME|.", "Welcome on board, Madam |PLAYERNAME|.", cid, msg)
npcHandler:AddQueue({"hi", "hello"}, "One moment please |PLAYERNAME|. You're next in line.", 0, cid, msg)
npcHandler:RemoveFocus({"bye", "farewell"}, "Good bye. Recommend us, if you were satisfied with our service.", 0, cid, msg)
local keywords = {
["name"] = {response = "My name is Captain Bluebear from the Royal Tibia Line."},
["carlin"] = {response = "This is Carlin. Where do you want to go?"},
["name"] = {response = "My name is Captain Greyhound from the Royal Tibia Line."},
["job"] = {response = "I am the captain of this sailing-ship."},
["captain"] = {response = "I am the captain of this sailing-ship."},
["ship"] = {response = "The Royal Tibia Line connects all seaside towns of Tibia."},
["line"] = {response = "The Royal Tibia Line connects all seaside towns of Tibia."},
["company"] = {response = "The Royal Tibia Line connects all seaside towns of Tibia."},
["route"] = {response = "The Royal Tibia Line connects all seaside towns of Tibia."},
["tibia"] = {response = "The Royal Tibia Line connects all seaside towns of Tibia."},
["good"] = {response = "We can transport everything you want."},
["passenger"] = {response = "We would like to welcome you on board."},
["trip"] = {response = "Where do you want to go? To Thais, Ab'Dendriel, Venore or Edron?"},
["passage"] = {response = "Where do you want to go? To Thais, Ab'Dendriel, Venore or Edron?"},
["town"] = {response = "Where do you want to go? To Thais, Ab'Dendriel, Venore or Edron?"},
["destination"] = {response = "Where do you want to go? To Thais, Ab'Dendriel, Venore or Edron?"},
["sail"] = {response = "Where do you want to go? To Thais, Ab'Dendriel, Venore or Edron?"},
["go"] = {response = "Where do you want to go? To Thais, Ab'Dendriel, Venore or Edron?"},
["ice"] = {response = "I'm sorry, but we don't serve the routes to the Ice Islands."},
["senja"] = {response = "I'm sorry, but we don't serve the routes to the Ice Islands."},
["folda"] = {response = "I'm sorry, but we don't serve the routes to the Ice Islands."},
["vega"] = {response = "I'm sorry, but we don't serve the routes to the Ice Islands."},
["darashia"] = {response = "I'm not sailing there. This route is afflicted by a ghost ship! However I've heard that Captain Fearless from Venore sails there."},
["darama"] = {response = "I'm not sailing there. This route is afflicted by a ghost ship! However I've heard that Captain Fearless from Venore sails there."},
["ghost"] = {response = "Many people who sailed to Darashia never returned because they were attacked by a ghostship! I'll never sail there!"},
}
for v in pairs(keywords) do
if (msgcontains(msg, v)) and (npcHandler:isFocused(cid)) then
npcHandler:say(keywords[v].response, cid)
npcHandler:doTopic(cid, 0)
end
end
return 1
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, GreyhoundBehaviour)