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
if(msgcontains(msg, 'enchanted chicken wing')) then
npcHandler:say('Do you want trade Boots of Haste for Enchanted Chicken Wing?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(doPlayerRemoveItem(cid, 2195, 1) == TRUE) then
npcHandler:say('Here you are.', cid)
doPlayerAddItem(cid, 5891, 1)
else
npcHandler:say('Sorry, you don\'t have the item.', cid)
end
talkState[talkUser] = 0
end
if(msgcontains(msg, 'fighting spirit')) then
npcHandler:say('Do you want trade 2 Royal Helmet\'s for fighting Spirit?', cid)
talkState[talkUser] = 2
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
if(doPlayerRemoveItem(cid, 2498, 2) == TRUE) then
npcHandler:say('Here you are.', cid)
doPlayerAddItem(cid, 5884, 1)
else
npcHandler:say('Sorry, you don\'t have the item.', cid)
end
talkState[talkUser] = 0
end
if(msgcontains(msg, 'magic sulphur')) then
npcHandler:say('Do you want trade 3 Fire Sword\'s for Magic Sulphur?', cid)
talkState[talkUser] = 3
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 3) then
if(doPlayerRemoveItem(cid, 2392, 3) == TRUE) then
npcHandler:say('Here you are.', cid)
doPlayerAddItem(cid, 5904, 1)
else
npcHandler:say('Sorry, you don\'t have the item.', cid)
end
talkState[talkUser] = 0
end
if(msgcontains(msg, 'warrior sweat')) then
npcHandler:say('Do you want trade 4 Warrior Helmet for Warrior Sweat\'s?', cid)
talkState[talkUser] = 4
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 4) then
if(doPlayerRemoveItem(cid, 2475, 4) == TRUE) then
npcHandler:say('Here you are.', cid)
doPlayerAddItem(cid, 5885, 1)
else
npcHandler:say('Sorry, you don\'t have the item.', cid)
end
talkState[talkUser] = 0
end
if(msgcontains(msg, 'ticket')) then
npcHandler:say('For what you want trade Ticket? (vial, small flask, medium flask, or big flask)', cid)
talkState[talkUser] = 5
elseif(msgcontains(msg, 'vial') and talkState[talkUser] == 5) then
if(doPlayerRemoveItem(cid, 2006, 100) == TRUE) then
npcHandler:say('Here you are.', cid)
doPlayerAddItem(cid, 5957, 1)
else
npcHandler:say('Sorry, you don\'t have the item.', cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'small flask') and talkState[talkUser] == 5) then
if(doPlayerRemoveItem(cid, 7636, 100) == TRUE) then
npcHandler:say('Here you are.', cid)
doPlayerAddItem(cid, 5957, 1)
else
npcHandler:say('Sorry, you don\'t have the item.', cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'medium flask') and talkState[talkUser] == 5) then
if(doPlayerRemoveItem(cid, 7634, 100) == TRUE) then
npcHandler:say('Here you are.', cid)
doPlayerAddItem(cid, 5957, 1)
else
npcHandler:say('Sorry, you don\'t have the item.', cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'big flask') and talkState[talkUser] == 5) then
if(doPlayerRemoveItem(cid, 7635, 100) == TRUE) then
npcHandler:say('Here you are.', cid)
doPlayerAddItem(cid, 5957, 1)
else
npcHandler:say('Sorry, you don\'t have the item.', cid)
end
talkState[talkUser] = 0
end
if(msgcontains(msg, 'spider silk yarn')) then
npcHandler:say('Do you want trade a 10 Giant Spider silk\'s for Spider Silk Yarn?', cid)
talkState[talkUser] = 6
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 6) then
if(doPlayerRemoveItem(cid, 5879, 10) == TRUE) then
npcHandler:say('Here you are.', cid)
doPlayerAddItem(cid, 5886, 1)
else
npcHandler:say('Sorry, you don\'t have the item.', cid)
end
talkState[talkUser] = 0
end
if(msgcontains(msg, 'green tunic')) then
npcHandler:say('Do you want trade a green tunic for green piece of cloth?', cid)
talkState[talkUser] = 7
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 7) then
if(doPlayerRemoveItem(cid, 2652, 1) == TRUE) then
npcHandler:say('Here you are.', cid)
doPlayerAddItem(cid, 5910, 1)
else
npcHandler:say('Sorry, you don\'t have the item.', cid)
end
talkState[talkUser] = 0
end
if(msgcontains(msg, 'red robe')) then
npcHandler:say('Do you want trade a Red Robe for Red Piece of Cloth?', cid)
talkState[talkUser] = 8
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 8) then
if(doPlayerRemoveItem(cid, 2655, 1) == TRUE) then
npcHandler:say('Here you are.', cid)
doPlayerAddItem(cid, 5911, 1)
else
npcHandler:say('Sorry, you don\'t have the item.', cid)
end
talkState[talkUser] = 0
end
if(msgcontains(msg, 'mystic turban')) then
npcHandler:say('Do you want trade a Mystic Turban for Blue Piece of Cloth?', cid)
talkState[talkUser] = 9
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 9) then
if(doPlayerRemoveItem(cid, 2663, 1) == TRUE) then
doPlayerAddItem(cid, 5912, 1)
npcHandler:say('Here you are.', cid)
else
npcHandler:say('Sorry, you don\'t have the item.', cid)
end
talkState[talkUser] = 0
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
trzymaj
djiin.lua
Code: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 if(msgcontains(msg, 'enchanted chicken wing')) then npcHandler:say('Do you want trade Boots of Haste for Enchanted Chicken Wing?', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if(doPlayerRemoveItem(cid, 2195, 1) == TRUE) then npcHandler:say('Here you are.', cid) doPlayerAddItem(cid, 5891, 1) else npcHandler:say('Sorry, you don\'t have the item.', cid) end talkState[talkUser] = 0 end if(msgcontains(msg, 'fighting spirit')) then npcHandler:say('Do you want trade 2 Royal Helmet\'s for fighting Spirit?', cid) talkState[talkUser] = 2 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then if(doPlayerRemoveItem(cid, 2498, 2) == TRUE) then npcHandler:say('Here you are.', cid) doPlayerAddItem(cid, 5884, 1) else npcHandler:say('Sorry, you don\'t have the item.', cid) end talkState[talkUser] = 0 end if(msgcontains(msg, 'magic sulphur')) then npcHandler:say('Do you want trade 3 Fire Sword\'s for Magic Sulphur?', cid) talkState[talkUser] = 3 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 3) then if(doPlayerRemoveItem(cid, 2392, 3) == TRUE) then npcHandler:say('Here you are.', cid) doPlayerAddItem(cid, 5904, 1) else npcHandler:say('Sorry, you don\'t have the item.', cid) end talkState[talkUser] = 0 end if(msgcontains(msg, 'warrior sweat')) then npcHandler:say('Do you want trade 4 Warrior Helmet for Warrior Sweat\'s?', cid) talkState[talkUser] = 4 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 4) then if(doPlayerRemoveItem(cid, 2475, 4) == TRUE) then npcHandler:say('Here you are.', cid) doPlayerAddItem(cid, 5885, 1) else npcHandler:say('Sorry, you don\'t have the item.', cid) end talkState[talkUser] = 0 end if(msgcontains(msg, 'ticket')) then npcHandler:say('For what you want trade Ticket? (vial, small flask, medium flask, or big flask)', cid) talkState[talkUser] = 5 elseif(msgcontains(msg, 'vial') and talkState[talkUser] == 5) then if(doPlayerRemoveItem(cid, 2006, 100) == TRUE) then npcHandler:say('Here you are.', cid) doPlayerAddItem(cid, 5957, 1) else npcHandler:say('Sorry, you don\'t have the item.', cid) end talkState[talkUser] = 0 elseif(msgcontains(msg, 'small flask') and talkState[talkUser] == 5) then if(doPlayerRemoveItem(cid, 7636, 100) == TRUE) then npcHandler:say('Here you are.', cid) doPlayerAddItem(cid, 5957, 1) else npcHandler:say('Sorry, you don\'t have the item.', cid) end talkState[talkUser] = 0 elseif(msgcontains(msg, 'medium flask') and talkState[talkUser] == 5) then if(doPlayerRemoveItem(cid, 7634, 100) == TRUE) then npcHandler:say('Here you are.', cid) doPlayerAddItem(cid, 5957, 1) else npcHandler:say('Sorry, you don\'t have the item.', cid) end talkState[talkUser] = 0 elseif(msgcontains(msg, 'big flask') and talkState[talkUser] == 5) then if(doPlayerRemoveItem(cid, 7635, 100) == TRUE) then npcHandler:say('Here you are.', cid) doPlayerAddItem(cid, 5957, 1) else npcHandler:say('Sorry, you don\'t have the item.', cid) end talkState[talkUser] = 0 end if(msgcontains(msg, 'spider silk yarn')) then npcHandler:say('Do you want trade a 10 Giant Spider silk\'s for Spider Silk Yarn?', cid) talkState[talkUser] = 6 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 6) then if(doPlayerRemoveItem(cid, 5879, 10) == TRUE) then npcHandler:say('Here you are.', cid) doPlayerAddItem(cid, 5886, 1) else npcHandler:say('Sorry, you don\'t have the item.', cid) end talkState[talkUser] = 0 end if(msgcontains(msg, 'green tunic')) then npcHandler:say('Do you want trade a green tunic for green piece of cloth?', cid) talkState[talkUser] = 7 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 7) then if(doPlayerRemoveItem(cid, 2652, 1) == TRUE) then npcHandler:say('Here you are.', cid) doPlayerAddItem(cid, 5910, 1) else npcHandler:say('Sorry, you don\'t have the item.', cid) end talkState[talkUser] = 0 end if(msgcontains(msg, 'red robe')) then npcHandler:say('Do you want trade a Red Robe for Red Piece of Cloth?', cid) talkState[talkUser] = 8 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 8) then if(doPlayerRemoveItem(cid, 2655, 1) == TRUE) then npcHandler:say('Here you are.', cid) doPlayerAddItem(cid, 5911, 1) else npcHandler:say('Sorry, you don\'t have the item.', cid) end talkState[talkUser] = 0 end if(msgcontains(msg, 'mystic turban')) then npcHandler:say('Do you want trade a Mystic Turban for Blue Piece of Cloth?', cid) talkState[talkUser] = 9 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 9) then if(doPlayerRemoveItem(cid, 2663, 1) == TRUE) then doPlayerAddItem(cid, 5912, 1) npcHandler:say('Here you are.', cid) else npcHandler:say('Sorry, you don\'t have the item.', cid) end talkState[talkUser] = 0 end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
rep++
Rozumiem, że skrypt posiada własne modyfikacje i jest kompatybilny z najnowszymi wersjami TFS?
Ma ktoś npc djinn shop działającego pod 0.3.5pl1?
REp++ za pomoc ;p