Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
- -- ["nome do item"] = {Qntos pontos vao custar, id do item}
- local t = {
- ["boots of haste"] = {15, 2195}, --
- ["demon helmet"] = {25, 2493},
- ["frozen starlight"] = {30, 2361},
- ["royal crossbow"] = {20, 8851},
- ["solar axe"] = {30, 8925},
- ["soft boots"] = {50, 2640},
- ["demon armor"] = {100, 2494},
- ["firewalker boots"] = {50, 9932},
- ["magic plate armor"] = {70, 2472},
- ["flame blade"] = {100, 8931}
- }
- if (msgcontains(msg, 'trade') or msgcontains(msg, 'TRADE'))then
- local str = ""
- str = str .. "Eu vendo estes items: "
- for name, pos in pairs(t) do
- str = str.." {"..name.."} = "..pos[1].." Points/"
- end
- str = str .. "."
- npcHandler:say(str, cid)
- elseif t[msg] then
- if (doAccountRemovePoints(cid, t[msg][1]) == TRUE) then
- doPlayerAddItem(cid,t[msg][2],1)
- npcHandler:say("Aqui está seu ".. getItemNameById(t[msg][2]) .."!", cid)
- else
- npcHandler:say("você não tem "..t[msg][1].." Points", cid)
- end
- end
- return TRUE
- end
- npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
- npcHandler:addModule(FocusModule:new())
Advertisement
Add Comment
Please, Sign In to add comment