Pitufo™
InfinityOT.com
I made this because of requests, so enjoy it.
If you whant to enter a new travel just add a new line in the table of "travel":
You can config(cost, level, stor, storId and destination).
Rep++ Ofc!
Lua:
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 travels = {
["gengia"] = {talk=1, cost=0, level=0, stor=true, storId=34343, destination={x=34472, y=32697, z=6}},
["pyre"] = {talk=2, cost=0, level=0, stor=false, storId=43433, destination={x=33623, y=4003, z=6}}
}
for k, v in pairs(travels) do
if(msgcontains(msg, k)) then
if v.stor then
if getPlayerStorageValue(cid, v.storId) > 0 then
selfSay('Do you want to travel to '..k..' for '..v.cost..' gold coins?', cid)
talkState[talkUser] = v.talk
else
selfSay('You are not able to travel to this place?', cid)
talkState[talkUser] = 0
end
else
selfSay('Do you want to travel to '..k..' for '..v.cost..' gold coins?', cid)
talkState[talkUser] = v.talk
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == v.talk) then
if getPlayerLevel(cid) >= v.level then
if(doPlayerRemoveMoney(cid, v.cost) == TRUE) then
doTeleportThing(cid, v.destination, FALSE)
selfSay('Traveled to '..k..'.', cid)
else
selfSay('Sorry, you don\'t have enough gold coins.', cid)
end
else
selfSay('Sorry, you don\'t have enough level.', cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({v.talk}, talkState[talkUser]) == TRUE) then
talkState[talkUser] = 0
selfSay('Ok then.', cid)
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
If you whant to enter a new travel just add a new line in the table of "travel":
Lua:
local travels = {
["gengia"] = {talk=1, cost=0, level=0, stor=true, storId=34343, destination={x=34472, y=32697, z=6}},
["pyre"] = {talk=2, cost=0, level=0, stor=false, storId=43433, destination={x=33623, y=4003, z=6}}
}
You can config(cost, level, stor, storId and destination).
[] Brackets = The message you wll tell to the npc.
Talk = For each travel you add you most add +1
Level = Level to be able to travel
Stor = true/false
StorId = You only need to config this if "Stor" is equal true.
Destination = The destination to be traveled.
Rep++ Ofc!