• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Need a Boat Npc Script that works for TFS 0.2

gunmetal

New Member
Joined
Oct 15, 2007
Messages
75
Reaction score
0
I tried searching for one and every one i used is not working this is the one im using and the npc will gree you but after using any other words does not reply


PHP:
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
 
	--//////////////////////GUEST CARD//////////////////////--
	-- [City Name]
	-- TALK = switching 1, 2, 3, 4 accoring to the number of cities
	-- COST = How many will costs the travel (gold coins)
	-- LEVEL = level needed to travel with this NPC
	-- STOR = True or False,
	---------[True] if the player needs a certain storage in DATABASE.
	---------[False] if you wanna disable this function.
	-- STORID = In case you put 'True', paste this your StorageID, required to travel.
	-- DESTINATION = X, Y, Z Position of place where will be teleported.
	--//////////////////////GUEST CARD//////////////////////--
 
	local travels = {
    ["Edron"] = {talk=1, cost=350, level=0,  stor=false,  storId=1010, destination={x=1411, y=700, z=6}},
    ["Yalahar"] = {talk=2, cost=250, level=0, stor=false,  storId=1010, destination={x=2551, y=906, z=6}},
	["Goroma"] = {talk=3, cost=500, level=0, stor=false,  storId=1010, destination={x=688, y=782, z=6}},
	["Lightbourne city"] = {talk=4, cost=0, level=0, stor=false,  storId=1010, destination={x=1053, y=1008, 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 must got Norseman Mission\'s to travel with me. Hics! Hi ckS ! Hic.', 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())
 
Back
Top