viking
Member
- Joined
- Aug 20, 2015
- Messages
- 323
- Reaction score
- 22
Please, Help me with this error?
TFS 1.2 SCRIPT:
First part (big script)
TFS 1.2 SCRIPT:
First part (big script)
Code:
dofile('data/lib/killingInTheNameOfQuest.lua')
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
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
local choose = {}
local cancel = {}
local available = {}
local grizzlyAdamsConfig = {
ranks = {
huntsMan_rank = {
{id=11208, buy=0, sell=50, name='antlers'},
{id=10549, buy=0, sell=100, name='bloody pincers'},
{id=11183, buy=0, sell=35, name='crab pincers'},
{id=10573, buy=0, sell=55, name='cyclops toe'},
{id=10564, buy=0, sell=30, name='frosty ear of a troll'},
{id=11193, buy=0, sell=600, name='hydra head'},
{id=11366, buy=0, sell=80, name='lancer beetle shell'},
{id=10578, buy=0, sell=420, name='mutated bat ear'},
{id=11222, buy=0, sell=400, name='sabretooth'},
{id=11367, buy=0, sell=20, name='sandcrawler shell'},
{id=10547, buy=0, sell=280, name='scarab pincers'},
{id=11365, buy=0, sell=60, name='terramite legs'},
{id=11363, buy=0, sell=170, name='terramite shell'},
{id=11184, buy=0, sell=30000, name='terrorbird beak'},
{id=7398, buy=0, sell=500, name='cyclops trophy'},
{id=11315, buy=0, sell=15000, name='draken trophy'},
{id=11330, buy=0, sell=8000, name='lizard trophy'},
{id=7401, buy=0, sell=500, name='minotaur trophy'}
},
bigGameHunter_rank = {
{id=7397, buy=0, sell=3000, name='deer trophy'},
{id=7400, buy=0, sell=3000, name='lion trophy'},
{id=7394, buy=0, sell=3000, name='wolf trophy'}
},
trophyHunter_rank = {
{id=7393, buy=0, sell=40000, name='demon trophy'},
{id=7396, buy=0, sell=20000, name='behemoth trophy'},
{id=7399, buy=0, sell=10000, name='dragon lord trophy'},
{id=10518, buy=1000, sell=0, name='demon backpack'},
},
}
}
local Topic = {}
function greetCallback(cid)
Topic[cid] = 0
return true
end
local function setNewTradeTable(table)
local items = {}
for _, v in ipairs(table) do
items[v.id] = {itemId = v.id, buyPrice = v.buy, sellPrice = v.sell, subType = 0, realName = v.name}
end
return items
end
local function setNewLineTable(oldTable, newTable)
for k, v in pairs(oldTable) do
table.insert(newTable, k, v)
end
return true
end
function creatureSayCallback(cid, type, msg)
local player = Player(cid)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid
if (msgcontains(msg, "hi") or msgcontains(msg, "hello")) and (not npcHandler:isFocused(cid)) then
if (player:getStorageValue(JOIN_STOR) == -1) then
npcHandler:say("Welcome "..getCreatureName(cid)..". Would you like to join the 'Paw and Fur - Hunting Elite'?", cid)
npcHandler:addFocus(cid)
npcHandler.topic[cid] = 5
else
npcHandler:say("Welcome back old chap. What brings you here this time?", cid)
npcHandler:addFocus(cid)
npcHandler.topic[cid] = 0
end
return true
end
if(not npcHandler:isFocused(cid)) then
return false
end
if msgcontains(msg, "bye") or msgcontains(msg, "farewell") then
npcHandler:say("Happy hunting, old chap!", cid, TRUE)
Topic[talkUser] = 0
npcHandler:releaseFocus(cid)
end
if (isInArray({"yes", "join"}, msg:lower()) and npcHandler.topic[cid] == 5) then
player:setStorageValue(JOIN_STOR, 1)
npcHandler:say("Great! A warm welcome to our newest member: "..getCreatureName(cid).."! Ask me for a {task} if you want to go on a hunt.", cid)
npcHandler.topic[cid] = 0
elseif (msg:lower() == "no" and npcHandler.topic[cid] == 5) then
npcHandler:say("No problem old chap. Come back if you change your mind.", cid)
end
if (player:getStorageValue(JOIN_STOR) == -1) then
npcHandler:say("You'll have to {join} us to get more information.",cid)
return false
end